-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresult.php
More file actions
174 lines (132 loc) · 4.37 KB
/
Copy pathresult.php
File metadata and controls
174 lines (132 loc) · 4.37 KB
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
<?php
session_start();
if ($_SESSION['user_role']=='Faculty') {
require_once("./includes/header_faculty.php");
}
if ($_SESSION['user_role']=='DB-Admin') {
require_once("./includes/header_admin.php");
}
//$str= 'echo " " | sudo -k -S chmod +X -R /opt/lampp/htdocs/testautomation/tests/';
//shell_exec($str);
?>
<!--..............................CheckAll Java script start..............................--
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>-->
<script src="./js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Check/Uncheck ALl
$('#checkAll').change(function(){
if($(this).is(':checked')){
$('input[name="update[]"]').prop('checked',true);
}else{
$('input[name="update[]"]').each(function(){
$(this).prop('checked',false);
});
}
});
// Checkbox click
$('input[name="update[]"]').click(function(){
var total_checkboxes = $('input[name="update[]"]').length;
var total_checkboxes_checked = $('input[name="update[]"]:checked').length;
if(total_checkboxes_checked == total_checkboxes){
$('#checkAll').prop('checked',true);
}else{
$('#checkAll').prop('checked',false);
}
});
});
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<?php
if (isset($_POST['view-result'])) {
$tc=$_POST['tc'];
$tname=$_POST['tname'];
$noq=$_POST['noq'];
$sql="SELECT * from T".$tc;
$stmt = $pdo->prepare($sql);
$stmt->execute();
shell_exec("zip -r ".$tc.".zip ./tests/".$tc."/");
shell_exec("mv ".$tc.".zip ./tests/");
?>
<br>
<center><font color="brown" size="5"><strong>RESULT<br>Test/Assignment: <font color="brown" size="5"><?=$tc ?></font> (<font color="brown" size="5"><?=$tname ?></font>) </strong></font></center><br>
<table align="center" border="1">
<tr align="center" style="background-color: #ffffb3">
<td>Student Name</td>
<td>Roll No</td>
<td>Programming Language</td>
<?php
for ($i=1; $i<=$noq ; $i++) {
?>
<td>Q<?=$i ?> Marks</td>
<td>Q<?=$i ?> Full Marks</td>
<?php
}
?>
<td>Total Marks Obtained</td>
<td>Total Test Marks</td>
<td>Percentage</td>
<td>Viwe Output & Code</td>
<?php
while ($sr = $stmt->fetch(PDO::FETCH_ASSOC)) {
# code...
?>
</tr>
<tr align="center">
<td><?=$sr['student_name'] ?></td>
<td><?=$sr['student_roll'] ?></td>
<td><?=$sr['prog_lang'] ?></td>
<?php
for ($i=1; $i<=$noq ; $i++) {
?>
<td>
<?php
$var1="Q".$i."_marks";
$var2="Q".$i."_fm";
echo $sr[$var1];
?>
</td>
<td><?=$sr[$var2] ?></td>
<?php
}
?>
<td><?=$sr['tot_marks_obtained'] ?></td>
<td><?=$sr['full_marks'] ?></td>
<td><?=$sr['percentage'] ?></td>
<td>
<?php
for ($i=1; $i<=$noq ; $i++) {
$v="Question-".$i;
?>
<form action="test_auto_fac.php" method="POST" target="_blank">
<input type="hidden" name="tc" value="<?=$tc ?>">
<input type="hidden" name="tname" value="<?=$tname ?>">
<input type="hidden" name="proglan" value="<?=$sr['prog_lang'] ?>">
<input type="hidden" name="qn" value="<?=$i ?>">
<input type="hidden" name="student_roll" value="<?=$sr['student_roll'] ?>">
<input type="hidden" name="student_name" value="<?=$sr['student_name'] ?>">
<input type="submit" name="src_file" value="<?=$v ?>">
</form>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
<center><font color="blue" size="5">'X' in Programming Language indicates the student have not answered any question</font></center><br><br>
<center><font color="brown" size="4"><a href="./tests/<?=$tc ?>.zip" target="_blank">Click Here</a> to download ZIP file of source codes</font></center>
<?php
}
?>
<?php
require_once("./includes/footer.php");
?>