-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmupdate.php
More file actions
93 lines (80 loc) · 2.35 KB
/
mupdate.php
File metadata and controls
93 lines (80 loc) · 2.35 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
<?php
include_once 'header.php';
//Load variables with data...
$tech_email = 'tech.txt@smithville.k12.mo.us';
if ($_POST['id']){ $id = (int)$_POST['id'];}
if ($_POST['action']){ $action = $_POST['action'];}
if ($_POST['delete']){ $delete = $_POST['delete'];}
if ($_POST['assignedto']){$assignedto = $_POST['assignedto'];}
if ($_POST['email']){$email = $_POST['email'];}
if ($_POST['from']){$from = $_POST['from'];}
//Process updated work order request...
if (($action == 'update') AND ($delete != 'yes'))
{
//Build SQL statement to update a request...
$sql_statement = "UPDATE " . $db_table . " SET assignedto = '" . $assignedto . "' WHERE id = " . $id . ";";
//Execute the built query string
$execute = mysql_query($sql_statement) or $error_message = "There was an error in your query " . mysql_error();
if ($email_notification)
{
require("common/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = $smtp_server;
$mail->AddAddress("" . $email ."");
$mail->AddAddress("" . $tech_email ."");
//Configure email...
$mail->From = $email;
$mail->FromName = $from;
//Configure email...
$mail->Subject = " WO #" . $id . " claimed";
//Message...
$mail->Body = " " . $assignedto . " claimed the WO. \r\n";
$mail->Body .= "We are on the way.";
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
}
}
if (!$execute)
{
include_once 'header.php';
?>
<div data-role="dialog">
<div data-role="header" data-theme="a" data-inline="true">
<h6>Error!</h6>
</div><!-- /header -->
<div data-role="content">
<p>There was an error processing your command!</p>
<p><?php print $error_message?></p>
<script language="javascript"><!--
setTimeout("top.location.href='medit.php?id=<?php print $id;?>'",3000);
//-->
</script>
</div>
</div>
<?php
include_once 'footer.php';
} else {
include_once 'header.php';
?>
<div data-role="dialog">
<div data-role="header" data-theme="a" data-inline="true">
<h6>Success!</h6>
</div><!-- /header -->
<div data-role="content">
<p>Your Work Order Has Been Updated!</p>
<script language="javascript"><!--
setTimeout("self.location.href='index.php'",3000);
//
</script>
</div>
</div>
<?php
include_once 'footer.php';
}
include_once 'footer.php';
?>