-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobsDelete.php
52 lines (42 loc) · 1.07 KB
/
jobsDelete.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
<?php
require('session.php');
if (isset($_GET['jobId']))
{
require('connect.php');
// first delete all files from server related to the user
$query = "select filePath from files where whichExists=1 and jobId=".$_GET['jobId'];
$result = mysql_query($query,$con);
if(!$result)
{
die("Invalid query! <br> The query is: " . $query);
}
while($row = mysql_fetch_assoc($result))
{
unlink($row['filePath']);
}
$query = "delete from jobs where jobId=".$_GET['jobId'];
$result = mysql_query($query,$con);
if(!$result)
{
die("Invalid query! <br> The query is: " . $query);
}
$query = "delete from files where jobId=".$_GET['jobId'];
$result = mysql_query($query,$con);
if(!$result)
{
die("Invalid query! <br> The query is: " . $query);
}
$query = "delete from expenses where jobId=".$_GET['jobId'];
$result = mysql_query($query,$con);
if(!$result)
{
die("Invalid query! <br> The query is: " . $query);
}
mysql_close($con);
header("Location:home.php");
}
else
{
header("Location:home.php");
}
?>