-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
31 lines (28 loc) · 791 Bytes
/
delete.php
File metadata and controls
31 lines (28 loc) · 791 Bytes
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
<html>
<body>
<p align="right"><a href="add_question.html">Add New Question</a></p>
<?php
include 'dbaccess.php';
$conn=mysqli_connect($hostname,$username,$password,$dbname);
if($conn)
{
$query = sprintf("select img0,img1,img2,img3,img_count from questions where level=%s;",$_GET['level']);
$result=mysqli_query($conn,$query);
if(mysqli_num_rows($result) > 0)
{
$row=mysqli_fetch_assoc($result);
$i=0;
while($i < $row['img_count'])
{
unlink(".".substr($row['img'.$i],0));
$i++;
}
}
$query = sprintf("delete from questions where level=%s;",$_GET['level']);
mysqli_query($conn,$query);
mysqli_close($conn);
echo "<meta http-equiv='refresh' content='0;index.php'/>";
}
?>
</body>
</html>