Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AgarwalPragy committed Feb 16, 2016
0 parents commit 24826a0
Show file tree
Hide file tree
Showing 7 changed files with 545 additions and 0 deletions.
76 changes: 76 additions & 0 deletions gatestyles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

#my-header{
background: #333;
color: #ccc;
transition: 500ms all ease;
border: 1px solid #333;
font-size: 16px;
}

#text-url {
background: #111;
color: #ccc;
width: 200px;
padding: 6px 15px 6px 15px;
border-radius: 5px;
transition: 500ms all ease;
font-size: 10px;
font-weight: bold;
}
#text-url:hover {
width:100%;
}

.notification {
width: 100%;
color: #666;
font-size: 10px;
font-weight: bold;
}

#form-submit {
background: #4B99AD;
padding: 8px 15px 8px 15px;
border: none;
color: #fff;
font-weight: bold;
display: block;
width: 100%;
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
text-decoration: none;
}

#form-submit:hover {
background: #4691A4;
}

#table-results th {
font-size: 14px;
color: #4B99AD;
font-weight: bold;
text-align: right;
padding-left: 10px;
padding-right: 5px;
}

#table-results td {
font-size: 14px;
text-align: left;
padding-left: 20px;
padding-right: 10px;
}

#table-results .table-top-header th {
color: #666;
text-align: center;
padding-left: 10px;
padding-right: 10px;
padding-top: 15px;
}

#table-results #rank {
font-size: 26px;
color: #a00;
}
44 changes: 44 additions & 0 deletions getmyrank.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

if($_GET["marks"] && $_GET["id"]) {
$marks = $_GET["marks"];
$id = "ID_" . $_GET["id"];
$existed = 0;
$myarr = getData("ranks.txt");
// echo print_r($myarr, true);
// echo "<br/>=================<br/>";
if(array_key_exists($id, $myarr)){
$existed = 1;
}
else {
$myarr[$id] = $marks;
}
// echo print_r($myarr, true);
// echo "<br/>=================<br/>";
asort($myarr, SORT_NUMERIC);
// echo print_r($myarr, true);
// echo "<br/>=================<br/>";
$rank = array_search($id, array_keys($myarr));
$total = count($myarr);
echo ($total - $rank) . " / " . $total;

if($existed == 0){
$logMarks = fopen("ranks.txt", "a") or die("Error code: 02");
fwrite($logMarks, $id . ": " . $marks . "\n");
}
exit();
}

function getData($file) {
$data = file($file);
$returnArray = array();
foreach($data as $line) {
$explode = explode(": ", $line);
$returnArray[$explode[0]] = $explode[1];
}

return $returnArray;
}


?>
50 changes: 50 additions & 0 deletions geturl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

if($_GET["url"]) {
$url = $_GET["url"];
echo get_url($url);
exit();
}

# https://andylangton.co.uk/blog/development/use-php-and-curl-retrieve-url-contents-few-options

function get_url($url,$useragent='cURL',
$headers=false,
$follow_redirects=false,
$debug=false) {

$ch = curl_init();
# specify the URL to be retrieved
curl_setopt($ch, CURLOPT_URL,$url);
# we want to get the contents of the URL and store it in a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
# specify the useragent: this is a required courtesy to site owners
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
# ignore SSL errors
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
# return headers as requested
if ($headers==true){
curl_setopt($ch, CURLOPT_HEADER,1);
}
# only return headers
if ($headers=='headers only') {
curl_setopt($ch, CURLOPT_NOBODY ,1);
}
# follow redirects - note this is disabled by default in most PHP installs from 4.4.4 up
if ($follow_redirects==true) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
}
# if debugging, return an array with CURL's debug info and the URL contents
if ($debug==true) {
$result['contents']=curl_exec($ch);
$result['info']=curl_getinfo($ch);
}
# otherwise just return the contents as a variable
else $result=curl_exec($ch);
# free resources
curl_close($ch);
# send back the data
return $result;
}

?>
55 changes: 55 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<html>
<head>
<title>GATE 2016 Marks and Rank Evaluator</title>
<link rel="stylesheet" type="text/css" href="gatestyles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="process.js"></script>
<script src="keys.js"></script>
</head>
<body>
<div id="my-header">
<table style="width: 100%;">
<tr>
<td style="width: 50%; text-align: center;" align="center">
<b>Responses URL:</b><br />
<input type="text" id="text-url" value="" />
<br />
<p class="notification">Note: This app needs to <span style="color: #6f6;">anonymously</span> log your marks to be able to show your rank.<br />Click Submit only if you agree to logging.</p>
<a href="#" id="form-submit" onclick="submitURL()">Submit</a>
</td>
<td style="width: 50%;" align="center">
<table id="table-results" class="table-results">
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->
<tr><th>Set</th><td id="set">x</td><th>Rank</th><td id="rank">x</td></tr>
<tr class="table-top-header"><th></th><th>1 mark</th><th>2 mark</th><th>Total</th></tr>
<tr>
<th>Attempted</th>
<td id="attempted-1-mark">x</td>
<td id="attempted-2-mark">x</td>
<td id="attempted-total">x</td>
</tr>
<tr>
<th>Correct</th>
<td id="correct-1-mark">x</td>
<td id="correct-2-mark">x</td>
<td id="correct-total">x</td>
</tr>
<tr class="table-top-header"><th></th><th>+ve</th><th>-ve</th><th>Total</th></tr>
<tr>
<th>Marks </th>
<td id="marks-positive">x</td>
<td id="marks-negative">x</td>
<td id="marks-total">x</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="responses"></div>
</body>
</html>
135 changes: 135 additions & 0 deletions keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
window.set1 = {
"g01": ["D", "http://gateoverflow.in/39608/gate-2016-1-ga01"],
"g02": ["A", "http://gateoverflow.in/39607/gate-2016-1-ga02"],
"g03": ["A", "http://gateoverflow.in/39606/gate-2016-1-ga03"],
"g04": ["C", "http://gateoverflow.in/39609/gate-2016-1-ga04"],
"g05": ["D", "http://gateoverflow.in/39610/gate-2016-1-ga05"],
"g06": ["B", "http://gateoverflow.in/39616/gate-2016-1-ga06"],
"g07": ["D", "http://gateoverflow.in/39613/gate-2016-1-ga07"],
"g08": ["D", "http://gateoverflow.in/39617/gate-2016-1-ga08"],
"g09": ["B", "http://gateoverflow.in/39611/gate-2016-1-ga09"],
"g10": ["B", "http://gateoverflow.in/39612/gate-2016-1-ga10"],
"c01": [11, "http://gateoverflow.in/39663/gate-2016-1-01"],
"c02": ["B", "http://gateoverflow.in/39636/gate-2016-1-02"],
"c03": [1, "http://gateoverflow.in/39630/gate-2016-1-03"],
"c04": [0.5, "http://gateoverflow.in/39661/gate-2016-1-04"],
"c05": [15, "http://gateoverflow.in/39634/gate-2016-1-05"],
"c06": ["A", "http://gateoverflow.in/39629/gate-2016-1-06"],
"c07": [-11, "http://gateoverflow.in/39649/gate-2016-1-07"],
"c08": [4, "http://gateoverflow.in/39670/gate-2016-1-08"],
"c09": [31, "http://gateoverflow.in/39632/gate-2016-1-09"],
"c10": ["A", "http://gateoverflow.in/39667/gate-2016-1-10"],
"c11": [6, "http://gateoverflow.in/39669/gate-2016-1-11"],
"c12": ["D", "http://gateoverflow.in/39638/gate-2016-1-12"],
"c13": ["D", "http://gateoverflow.in/39660/gate-2016-1-13"],
"c14": ["A", "http://gateoverflow.in/39673/gate-2016-1-14"],
"c15": [2016, "http://gateoverflow.in/39642/gate-2016-1-15"],
"c16": ["D", "http://gateoverflow.in/39640/gate-2016-1-16"],
"c17": ["C", "http://gateoverflow.in/39651/gate-2016-1-17"],
"c18": ["B", "http://gateoverflow.in/39647/gate-2016-1-18"],
"c19": [10, "http://gateoverflow.in/39675/gate-2016-1-19"],
"c20": ["A", "http://gateoverflow.in/39655/gate-2016-1-20"],
"c21": ["B", "http://gateoverflow.in/39637/gate-2016-1-21"],
"c22": ["D", "http://gateoverflow.in/39644/gate-2016-1-22"],
"c23": ["B", "http://gateoverflow.in/39646/gate-2016-1-23"],
"c24": ["C", "http://gateoverflow.in/39639/gate-2016-1-24"],
"c25": ["C", "http://gateoverflow.in/39628/gate-2016-1-25"],
"c26": [10, "http://gateoverflow.in/39693/gate-2016-1-26"],
"c27": [198, "http://gateoverflow.in/39714/gate-2016-1-27"],
"c28": [2, "http://gateoverflow.in/39717/gate-2016-1-28"],
"c29": [0.33, "http://gateoverflow.in/39709/gate-2016-1-29"],
"c30": ["D", "http://gateoverflow.in/39722/gate-2016-1-30"],
"c31": [456, "http://gateoverflow.in/39698/gate-2016-1-31"],
"c32": [33.33, "http://gateoverflow.in/39691/gate-2016-1-32"],
"c33": ["B", "http://gateoverflow.in/39688/gate-2016-1-33"],
"c34": ["D", "http://gateoverflow.in/39704/gate-2016-1-34"],
"c35": ["A", "http://gateoverflow.in/39730/gate-2016-1-35"],
"c36": ["D", "http://gateoverflow.in/39701/gate-2016-1-36"],
"c37": ["B", "http://gateoverflow.in/39706/gate-2016-1-37"],
"c38": [12, "http://gateoverflow.in/39731/gate-2016-1-38"],
"c39": [7, "http://gateoverflow.in/39725/gate-2016-1-39"],
"c40": ["B", "http://gateoverflow.in/39727/gate-2016-1-40"],
"c41": [256, "http://gateoverflow.in/39684/gate-2016-1-41"],
"c42": ["D", "http://gateoverflow.in/39705/gate-2016-1-42"],
"c43": ["D", "http://gateoverflow.in/39732/gate-2016-1-43"],
"c44": ["C", "http://gateoverflow.in/39721/gate-2016-1-44"],
"c45": [9, "http://gateoverflow.in/39697/gate-2016-1-45"],
"c46": ["C", "http://gateoverflow.in/39700/gate-2016-1-46"],
"c47": [384, "http://gateoverflow.in/39690/gate-2016-1-47"],
"c48": [346, "http://gateoverflow.in/39716/gate-2016-1-48"],
"c49": [1, "http://gateoverflow.in/39711/gate-2016-1-49"],
"c50": ["A", "http://gateoverflow.in/39719/gate-2016-1-50"],
"c51": ["A", "http://gateoverflow.in/39703/gate-2016-1-51"],
"c52": ["B", "http://gateoverflow.in/39694/gate-2016-1-52"],
"c53": [13, "http://gateoverflow.in/39712/gate-2016-1-53"],
"c54": [1.1, "http://gateoverflow.in/39720/gate-2016-1-54"],
"c55": [2500, "http://gateoverflow.in/39696/gate-2016-1-55"]
};

window.set2 = {
"g01": ["B", "http://gateoverflow.in/39529/gate-2016-2-ga-01"],
"g02": ["D", "http://gateoverflow.in/39531/gate-2016-2-ga-02"],
"g03": ["C", "http://gateoverflow.in/39530/gate-2016-2-ga-03"],
"g04": ["D", "http://gateoverflow.in/39528/gate-2016-2-ga-04"],
"g05": ["B", "http://gateoverflow.in/39532/gate-2016-2-ga-05"],
"g06": ["A", "http://gateoverflow.in/39536/gate-2016-2-ga-06"],
"g07": ["D", "http://gateoverflow.in/39533/gate-2016-2-ga-07"],
"g08": ["D", "http://gateoverflow.in/39534/gate-2016-2-ga-08"],
"g09": ["C", "http://gateoverflow.in/39537/gate-2016-2-ga-09"],
"g10": ["C", "http://gateoverflow.in/39535/gate-2016-2-ga-10"],
"c01": [4, "http://gateoverflow.in/39568/gate-2016-2-01"],
"c02": [9, "http://gateoverflow.in/39571/gate-2016-2-02"],
"c03": [4, "http://gateoverflow.in/39553/gate-2016-2-03"],
"c04": ["C", "http://gateoverflow.in/39545/gate-2016-2-04"],
"c05": [0.55, "http://gateoverflow.in/39541/gate-2016-2-05"],
"c06": [0.125, "http://gateoverflow.in/39549/gate-2016-2-06"],
"c07": [-1, "http://gateoverflow.in/39575/gate-2016-2-07"],
"c08": ["C", "http://gateoverflow.in/39540/gate-2016-2-08"],
"c09": [1, "http://gateoverflow.in/39546/gate-2016-2-09"],
"c10": [16, "http://gateoverflow.in/39547/gate-2016-2-10"],
"c11": [31, "http://gateoverflow.in/39563/gate-2016-2-11"],
"c12": [30, "http://gateoverflow.in/39565/gate-2016-2-12"],
"c13": ["C", "http://gateoverflow.in/39561/gate-2016-2-13"],
"c14": ["C", "http://gateoverflow.in/39570/gate-2016-2-14"],
"c15": ["C", "http://gateoverflow.in/39557/gate-2016-2-15"],
"c16": [2, "http://gateoverflow.in/39562/gate-2016-2_16"],
"c17": ["C", "http://gateoverflow.in/39542/gate-2016-2-17"],
"c18": ["D", "http://gateoverflow.in/39574/gate-2016-2-18"],
"c19": ["B", "http://gateoverflow.in/39548/gate-2016-2-19"],
"c20": ["D", "http://gateoverflow.in/39559/gate-2016-2-20"],
"c21": ["A", "http://gateoverflow.in/39569/gate-2016-2-21"],
"c22": ["A", "http://gateoverflow.in/39550/gate-2016-2-22"],
"c23": ["A", "http://gateoverflow.in/39555/gate-2016-2-23"],
"c24": ["D", "http://gateoverflow.in/39543/gate-2016-2-24"],
"c25": ["C", "http://gateoverflow.in/39572/gate-2016-2-25"],
"c26": ["B", "http://gateoverflow.in/39603/gate-2016-2-26"],
"c27": ["D", "http://gateoverflow.in/39618/gate-2016-2-27"],
"c28": ["B", "http://gateoverflow.in/39595/gate-2016-2-28"],
"c29": [4, "http://gateoverflow.in/39588/gate-2016-2-29"],
"c30": [28, "http://gateoverflow.in/39627/gate-2016-2-30"],
"c31": [500, "http://gateoverflow.in/39601/gate-2016-2-31"],
"c32": [24, "http://gateoverflow.in/39622/gate-2016-2-32"],
"c33": [4, "http://gateoverflow.in/39580/gate-2016-2-33"],
"c34": [8, "http://gateoverflow.in/39585/gate-2016-2-34"],
"c35": ["C", "http://gateoverflow.in/39578/gate-2016-2-35"],
"c36": ["C", "http://gateoverflow.in/39597/gate-2016-2-36"],
"c37": [3, "http://gateoverflow.in/39602/gate-2016-2-37"],
"c38": [1500, "http://gateoverflow.in/39587/gate-2016-2-38"],
"c39": [2.33, "http://gateoverflow.in/39581/gate-2016-2-39"],
"c40": [64, "http://gateoverflow.in/39586/gate-2016-2-40"],
"c41": ["B", "http://gateoverflow.in/39620/gate-2016-2-41"],
"c42": ["B", "http://gateoverflow.in/39591/gate-2016-2-42"],
"c43": ["B", "http://gateoverflow.in/39605/gate-2016-2-43"],
"c44": ["C", "http://gateoverflow.in/39596/gate-2016-2-44"],
"c45": ["B", "http://gateoverflow.in/39594/gate-2016-2-45"],
"c46": ["A", "http://gateoverflow.in/39598/gate-2016-2-46"],
"c47": [8.25, "http://gateoverflow.in/39625/gate-2016-2-47"],
"c48": ["C", "http://gateoverflow.in/39600/gate-2016-2-48"],
"c49": [7, "http://gateoverflow.in/39576/gate-2016-2-49"],
"c50": [30, "http://gateoverflow.in/39592/gate-2016-2-50"],
"c51": ["C", "http://gateoverflow.in/39590/gate-2016-2-51"],
"c52": [2, "http://gateoverflow.in/39604/gate-2016-2-52"],
"c53": [200, "http://gateoverflow.in/39589/gate-2016-2-53"],
"c54": ["B", "http://gateoverflow.in/39593/gate-2016-2-54"],
"c55": [4, "http://gateoverflow.in/39577/gate-2016-2-55"]
};
Loading

0 comments on commit 24826a0

Please sign in to comment.