This repository has been archived by the owner on May 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
shortt.php
127 lines (107 loc) · 3.21 KB
/
shortt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="description" content="description"/>
<meta name="keywords" content="keywords"/>
<meta name="author" content="author"/>
<link rel="stylesheet" type="text/css" href="default.css" media="screen"/>
<title>Codechef Ranking System</title>
</head>
<body>
<?php include_once "connect.php";
$month="COOK43"; ?>
<div class="top">
<div class="header">
<div class="left">
Codechef Rankings
</div>
<div class="right">
<?php include "files/top-right.php"; ?>
</div>
</div>
</div>
<div class="container">
<?php include "files/nav.php";?>
<div class="main">
<div class="content">
<?php
$arr=array();
$k=1;
$names=mysql_query("SELECT name from ".$month."ques ORDER BY id");
while($row=mysql_fetch_array($names))
{
$arr[$k]=$row['name'];
$k++;
}
?>
<h2>Submission of this month's Short Contest</h2><br />
<h4><a href="add.php">(To have more faster access to ranks kindly download and install our chrome plugin.)</a></h4><br />
<?php
$result = mysql_query("SELECT * FROM `update`");
$row = mysql_fetch_array($result);
echo "<b>Last updated : ".$row['time']."</b><br/><br/>";
if($value==0)
{
include "files/select-on-page.php";
}
else
{
$sno=1;
$result = mysql_query("SELECT detail.handle,detail.name,".$month.".ques1,".$month.".ques2,".$month.".ques3,".$month.".ques4,
".$month.".ques5,".$month.".ques6,".$month.".ques7,".$month.".ques8,".$month.".ques9,".$month.".ques10
FROM detail,".$month." WHERE detail.college=".$value." AND detail.handle=SUBSTR(".$month.".handle,6)
ORDER BY ".$month.".rank");
echo "<table>
<tr>
<th>Sno.</th>
<th>Username</th>
<th>Name</th>
<th>Problems Solved</th>
<th>Total</th>
</tr>";
while($row = mysql_fetch_array($result))
{
$url="http://www.codechef.com/users/";
echo "<tr>";
echo "<td>" . $sno++. "</td>";
echo "<td><a href='".$url . $row['handle'] ."' target=_blank>".$row['handle'] . "</a></td>";
echo "<td>".$row['name']."</td>";
echo "<td>";
$all="";
$k=0;
for($i=1;$i<=10;$i++)
{
if($row['ques'.$i]==1)
{
$all=$all.$arr[$i].", ";
$k++;
}
}
echo $all;
echo "</td>";
echo "<td>" . $k . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<h2>Other members (Inactive in this contest)</h2><br />";
$sno=1;
$result = mysql_query("SELECT handle FROM detail WHERE detail.college=".$value." AND detail.handle NOT IN (SELECT SUBSTR(handle,6) FROM ".$month.") ORDER BY handle");
while($row = mysql_fetch_array($result))
{
echo $sno++. ". <a style='text-decoration:none;' href='".$url . $row['handle'] ."' target=_blank>".$row['handle']."</a><br>";
}
}
?>
</div>
<div class="sidenav">
<?php include "files/sidenav.php";?>
</div>
<div class="clearer"><span></span></div>
</div>
<div class="footer">© 2013 <a href="http://www.shivamkhandelwal.in/" target="_blank">Shivam Khandelwal</a> | Designed and Developed by Shivam Khandelwal
</div>
</div>
</body>
</html>