-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
217 lines (197 loc) · 6.9 KB
/
admin.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<html>
<head>
<title>ADMIN - Code-A-Strike</title>
<link href="style1.css" type="text/css" rel="stylesheet" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="Vinit Shahdeo" />
<script>
window.history.forward(-1);
</script>
</head>
<body>
<?php
session_start();
if(isset($_SESSION['id']))
{
echo "<header><p align='left'>CodeChef VIT Chapter<span><a href='logout.php'>Logout</a></span></p></header>";
}
else
{
header("location:index.html");
}
?>
<?php
$host="localhost";
$uname="root";
$pass="";
$db="codechef";
$link=@mysql_connect($host,$uname,$pass) or
die("<script>alert('Server Error')</script>");
@mysql_select_db($db) or
die("<script>alert('Database error');</script>");
?>
<!--find-->
<?php
if(isset($_POST['find']))
{
$uid=$_POST['team_id'];
$qry="select * from registrations where team_id=$uid";
$rs=mysql_query($qry) or die(mysql_error());
$row=mysql_fetch_array($rs);
}
if(isset($_POST['update_details']))
{ $uid=$_POST['uid'];
$uname=$_POST['uname'];
$upass=$_POST['upass'];
$ufname=$_POST['ufname'];
$uemail=$_POST['uemail'];
$umobile=$_POST['umobile'];
$uaddress=$_POST['uaddress'];
$qry="update usermaster set UserName='$uname', Password='$upass', FullName='$ufname',
Email='$uemail', Mobile= $umobile, Address='$uaddress' where UserId=$uid";
mysql_query($qry) or die(mysql_error());
if(mysql_affected_rows()>0)
{
echo "<script><alert>Records Updated</alert></script>";
}
}
?>
<center><h1>Code-A-Strike</h1>
<hr>
<!--session creation-->
<form method="post" enctype="multipart/form-data">
<div align="left">
<table align="center">
<tr><th colspan="3"><center>TEAM DETAILS</center></th></tr>
<tr>
<td>Team Id</td><td><input type="text" name="team_id" placeholder="Enter Team ID"
value="<?php if(isset($row)){ echo $row[0]; } ?>"/></td>
<td><center><input type="submit" name="find" value="Find Info"/></center></td></tr>
<tr><td>Team Name</td><td><input type="text" name="team_name"
value="<?php if(isset($row)){echo $row[1];} ?>" /></td><td><input type="text" name="team_name"
value="<?php if(isset($row)){echo $row[2];} ?>" /></td></tr>
<tr><td>Gamer 1 </td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[3];} ?>" /></td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[4];} ?>" /></td></tr>
<tr><td>Gamer 2 </td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[7];} ?>" /></td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[8];} ?>" /></td></tr>
<tr><td>Coder </td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[11];} ?>" /></td><td><input type="text" name="name1"
value="<?php if(isset($row)){echo $row[12];} ?>" /></td></tr>
<tr><th colspan="3"><center>START THE GAME</center></th></tr>
<tr><td colspan="2"><center>Entry Time</center></td><td><input type="time" name="time"
value="<?php if(isset($row)){echo $row[5];} ?>" />
</td></tr>
<tr><td colspan="2"><center>Registration Fee</center></td><td> YES <input type="radio" name="fee"
value="yes"/> NO <input type="radio" name="fee" value="no"/>
</td></tr>
<tr><td colspan="3">
<center>
<input type="submit" name="start_game" value="START GAME"/>
<input type="submit" name="update_details" value="UPDATE DETAILS"/>
<input type="submit" name="view_registered" value="VIEW REGISTERED"/>
<input type="submit" name="view_playing" value="VIEW PARTICIPATED"/>
<input type="submit" name="money_collection" value="MONEY COLLECTION"/>
</center>
</td>
</tr>
</table>
</div>
</form>
</center>
</body>
</html>
<!--display-->
<?php
if(isset($_POST['view_registered']))
{
echo "<center><table>";
$qry="select * from registrations";
$rs=mysql_query($qry)
or die(mysql_error());
$count=mysql_num_fields($rs);
echo "<table border='3'><tr><th rowspan='2'>TEAM ID</th><th rowspan='2'>TEAM NAME</th><th colspan='2'><center>GAMER 1</center></th><th colspan='2'><center>GAMER 2</center></th>
<th colspan='2'><center>CODER</center></th></tr>";
echo "<tr>";
echo "<th><center>Name</center></th><th><center>Reg No</center></th>";
echo "<th><center>Name</center></th><th><center>Reg No</center></th>";
echo "<th><center>Name</center></th><th><center>Reg No</center></th>";
echo "</tr>";
while($row=mysql_fetch_array($rs))
{
echo "<tr>";
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";
echo "<td>$row[3]</td>";
echo "<td>$row[4]</td>";
echo "<td>$row[7]</td>";
echo "<td>$row[8]</td>";
echo "<td>$row[11]</td>";
echo "<td>$row[12]</td>";
echo "</tr>";
}
echo "</table></center>";
}
?>
<!--MONEY-->
<?php
if(isset($_POST['money_collection']))
{
echo "<center><table>";
$qry="select * from registrations";
$rs=mysql_query($qry)
or die(mysql_error());
$count=mysql_num_fields($rs);
echo "<table border='3'><tr><th>TEAM ID</th><th>TEAM NAME</th><th><center>MEMBER NAME</center></th><th><center>PHONE NUMBER 2</center></th>
</tr>";
while($row=mysql_fetch_array($rs))
{
echo "<tr>";
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";
echo "<td>$row[15]</td>";
echo "<td>$row[16]</td>";
echo "</tr>";
}
echo "</table></center>";
}
?>
<!---INSERT-->
<?php
if(isset($_POST['insert']))
{
$uid=$_POST['uid'];
$uname=$_POST['uname'];
$upass=$_POST['upass'];
$ufname=$_POST['ufname'];
$uemail=$_POST['uemail'];
$umobile=$_POST['umobile'];
$uaddress=$_POST['uaddress'];
$filename=$_FILES['fil']['name'];
$filetname=$_FILES['fil']['tmp_name'];
$filesize=$_FILES['fil']['size'];
$filetype=$_FILES['fil']['type'];
$filerror=$_FILES['fil']['error'];
$imagepath=fopen($filename,"r");
$bfil=fread($imagepath,$filesize);
$image=addslashes($bfil);
$qry="insert into usermaster
values($uid,'$uname','$upass','$ufname','$uemail',$umobile,'$image', '$uaddress')";
mysql_query($qry) or die(mysql_error());
if(mysql_affected_rows()>0)
{
echo "<script><alert>Records inserted</alert></script>";
}
}
?>
<!---Delete-->
<?php
if(isset($_POST['delete']))
{
$uid=$_POST['uid'];
$qry="delete from usermaster where UserId=$uid";
mysql_query($qry) or die(mysql_error());
}
?>