-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
298 lines (277 loc) · 9.78 KB
/
index.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="jquery-1.5.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script>
function show_confirm(sid){
console.log(sid);
var r=confirm("Are you sure you want to delete the student?");
var delete_hit = "deletion.php?sid=" + sid;
if (r==true)
{
$.ajax({
url: delete_hit,
type: 'GET',
data: {id: sid},
complete: function(){alert('Deleted. Reload to see your changes');},
error: function(){alert('Failed to delete');}
});
}
}
$(document).ready(function(){
$('#information').remove();
$("a#inline").fancybox();
$(".editor").live('click',function(){
//$("#student-editor").hide();
var sid = $(this).attr('student_id');
//$("#student-editor").show();
$('#changedetails').attr('sid_value',sid);
});
$('#changedetails #submit').live('click',function(){
var student_id = $('#changedetails').attr('sid_value');
var myname = $('#namer').val();
var myroll = $('#roller').val();
var ajax_hit = "changedetails.php?sid=" + student_id;
$.ajax({
url: ajax_hit,
type: 'POST',
data: {namefield: myname, rollfield: myroll},
complete: function(){alert('Done. Reload to see your changes');},
error: function(){alert('Failed to update');}
});
return false;
});
});
</script>
<title>: School for the Deaf :</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
</head>
<body>
<div style="display:none">
<div id ="student-editor">
<form id="changedetails" sid_value="0">
<label>New name</label>
<input type="text" name="namefield" id="namer" required="true" /><br /><br />
<label>New roll number</label>
<input type="text" name="rollfield" id="roller" required="true" size=3/><br />
<input style="text-align:center" type="submit" name="button" id="submit" value="Change" /><br />
</form>
</div>
</div>
<div id="dvmaincontainer">
<!--main div container starts here-->
<div id="dvtopcontainer">
<!-- top container starts here-->
<div id="dvlogocontainer">
<!-- logo container starts here-->
<h1>School for the Deaf</h1>
<h4>Result Management System</h4>
<!-- logo container ends here-->
</div>
<div id="dvnavicontainer">
<!-- navogation div starts here-->
<img src="images/navi_left.jpg" alt="" />
<div id="tabs1" >
<ul>
<!-- CSS Tabs -->
<li id="current"><a href="#"><span>H</span></a></li>
<li><a href="studentadder.php"><span>New Student</span></a></li>
<li><a href="upgrade_class.php"><span>Upgrade</span></a></li>
<li><a href="recover.php"><span>Restore</span></a></li>
<li><a href="backup.php"><span>Backup</span></a></li>
</ul>
</div>
<img src="images/navi_right.jpg" alt="" />
<!-- navogation div ends here-->
</div>
<!-- top container ends here-->
</div>
<div id="dvbodycontainer">
<!-- body div starts here-->
<div id="dvleftpanel">
<!-- left pannel div starts here-->
<div id="topimage">
<!-- top left div starts here-->
Search<!--<img src="images/client.jpg" alt="Client Testimonials" width="274" height="34" title="Client Testimonials" /> -->
<!-- top left div end here-->
</div>
<div id="midcont">
<p>
<!-- left body div starts here-->
<form name="studentlister" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Name:<input type="text" name="name" placeholder= "Ravee"/><br /><br />
Class:
<select name="select-class">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option selected="selected"></option>
</select>
<input type="submit" name="submit" class="printer" value="List" />
</form>
<!-- banner div starts here-->
<!-- banner div ends here-->
</p>
<p> </p>
<!-- left body div ends here-->
</div>
<div id="leftfoot">
<div id="topimage"> Print Results</div>
<div id = "left-nav">
<!-- banner left div starts here-->
<?php
if(!is_dir("C:/school_results/")){
mkdir("C:/school_results/",0777);
}
?>
<form name="printselect" action='pp.php' method="post">
Class
<select name="select-class">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<select name="select-term">
<option value="first" selected="selected">First Term</option>
<option value="second">Second Term</option>
<option value="third">Third Term</option>
</select>
<input type="submit" class="printer" name="submit" value="Print" />
</form>
</div>
<div id="topimage"> Print Summary</div>
<div id = "left-nav">
<form name="lister" action="sheet.php" method="get">
Class:
<select name="class">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
Term:
<select name="term">
<option value="first" selected="selected">First Term</option>
<option value="second">Second Term</option>
<option value="third">Third Term</option>
</select>
<br>
Year:
<input type="text" name="year" placeholder ="Enter Year" />
<input type="submit" class="printer" name="submit" value="Print" />
</form>
</div>
</div>
<!-- left pannel div ends here-->
</div>
<div id="dvrightpanel">
<!-- right panel div starts here-->
<div id="student-list-table">
<?php
$main="main";
include("connectdb.php");
if (!empty($_POST['name'])){
$myname = $_POST['name'];
$sql="SELECT * FROM `$main` where name like '%$myname%'";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$num = mysql_numrows($result);
echo "<table border=1 width=400 align=center style='border-radius:10px'><tr><td>"."Name"."</td><td>Class</td><td>Roll</td><td colspan=3>Edit Marks</td>"."</tr>";
for($k=0; $k<$num; $k++)
{
$row=mysql_fetch_array($result);
$id[$k]=$row['ID'];
$name[$k]=$row['name'];
$roll[$k]=$row['roll'];
$class[$k]=$row['class'];
?>
<tr>
<td><a href="viewdetails.php?sid=<?php echo $id[$k]; ?>"><?php echo $name[$k];?></a> <span class="at-right"><span class='minisize'><a id="inline" class="editor" student_id = <?php echo $id[$k]; ?> href="#student-editor">Edit</a></span>|<a class="deleter" onClick="show_confirm(<?php echo $id[$k]; ?>)">Delete</a></span></td>
<td><?php echo $class[$k];?></td>
<td><?php echo $roll[$k];?></td>
<td class='minisize'><a href='termexam.php?term=first&sid=<?php echo $id[$k]; ?>'>First</a></td>
<td class='minisize'><a href='termexam.php?term=second&sid=<?php echo $id[$k]; ?>'>Second</a></td>
<td class='minisize'><a href='termexam.php?term=third&sid=<?php echo $id[$k]; ?>'>Third</a></td>
</tr>
<?php }
?>
</table>
<?php
}
}
else if (!empty($_POST['select-class'])){
$myclass = $_POST['select-class'];
?><h2><?php echo "Class ".$myclass; ?> </h2><?php
$sql="SELECT * FROM `$main` where class=$myclass ORDER BY roll";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$num = mysql_num_rows($result);
echo "<table border=1 width=400 align=center style='border-radius:10px'><tr><td>"."Name"."</td><td>Roll</td><td colspan=3 style='text-align:center'>Edit Marks</td>"."</tr>";
for($k=0; $k<$num; $k++)
{
$row=mysql_fetch_array($result);
$id[$k]=$row['ID'];
$name[$k]=$row['name'];
$roll[$k]=$row['roll'];
?>
<tr>
<td><a href="viewdetails.php?sid=<?php echo $id[$k]; ?>"><?php echo $name[$k];?></a> <span class="at-right"><span class='minisize'><a id="inline" class="editor" student_id = <?php echo $id[$k]; ?> href="#student-editor">Edit</a></span>|<a class="deleter" onClick="show_confirm(<?php echo $id[$k]; ?>)">Delete</a></span></td>
<td><?php echo $roll[$k]; ?></td>
<td class='minisize'><a href='termexam.php?term=first&sid=<?php echo $id[$k]; ?>'>First</a></td>
<td class='minisize'><a href='termexam.php?term=second&sid=<?php echo $id[$k]; ?>'>Second</a></td>
<td class='minisize'><a href='termexam.php?term=third&sid=<?php echo $id[$k]; ?>'>Third</a></td>
</tr>
<?php
}?>
</table>
<?php
}
}
?>
</div>
<div class="learn"><span><a href="#">NEXT CLASS</a></span></div>
<!-- right panel div ends here-->
</div>
<!-- body div ends here-->
</div>
<div id="dvfootercontainer">
<!-- footer div starts here-->
<div id="foottop">
<p> </p>
<div class="design"><a href="#"> <img src="images/studio.jpg" alt="Studio7designs" border="0" title="Studio7designs" /></a> </div>
</div>
<!-- footer div ends here-->
</div>
<!--main div container ends here-->
</div>
</body>
<style>
.at-right{float:right;}
.deleter{cursor:pointer;}
</style>
</html>