-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathstat.php
98 lines (56 loc) · 1.36 KB
/
stat.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
<?php
//header('Content-Type:application/json');
session_start();
require_once("config.php");
if(!isset($_SESSION["un"]))
{
header("Location:login.php");
}
if(isset($_SESSION['un']))
{
$username=$_SESSION['un'];
}
if(isset($_GET['user']))
{
$name=$_GET['user'];
}
//$qq='SELECT value from world';
//$rq=mysqli_query($con,$qq);
//$row=mysqli_fetch_array($rq);
//$us=$row['value'];
$ac="SELECT COUNT(verdict) AS verdict FROM submission where verdict='Accepted' and sname='$username'";
$wa="SELECT COUNT(verdict) AS verdict FROM submission where verdict='Wrong Answer' and sname='$username'";
$tle="SELECT COUNT(verdict) AS verdict FROM submission where verdict='Time Limit Exceed' and sname='$username'";
$s1=mysqli_query($con,$ac);
$s2=mysqli_query($con,$wa);
$s3=mysqli_query($con,$tle);
//$nac=mysqli_fetch_array($s1);
//$nwa=mysqli_fetch_array($s2);
//$ntle=mysqli_fetch_array($s3);
$data=array();
$result=array();
//$data[]=$nwa['verdict'];
//$data[]=$ntle['verdict'];
foreach($s1 as $nac)
{
$data[]=$nac;
//$i++;
}
foreach($s2 as $nwa)
{
$data[]=$nwa;
//$i++;
}
foreach($s3 as $ntle)
{
$data[]=$ntle;
//$i++;
}
print json_encode($data);
//header("Location:profile.php?name=$name");
/*foreach($data as $value) {
//echo($value['verdict']);
array_push($result,$value['verdict']);
}
print json_encode($result,JSON_FORCE_OBJECT);*/
?>