-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsndMsg3.php
56 lines (51 loc) · 1.42 KB
/
sndMsg3.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
<?php
require("sessionCheck.php");
require("config.php");
require("model/MP.php");
$mp = MP::from_id($_GET['id']);
if ( !$mp ){
die("invalid MP");
}
$alert = null;
$type = $_POST['type'];
$message = $_POST['message'];
if ( !is_numeric($type) ){
$alert = "Expected a numerical message type.";
} else {
switch ( (int)$type ){
case 3:
if ( !is_numeric($message) ){
$alert = "Expected a numerical filter id.";
} else {
$id = (int)$message;
$mp->reload_filter($id);
}
break;
default:
$data = pack("N", $type) . $message;
$mp->send($data);
};
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" type="image/x-icon" href="http://www.bth.se/favicon.ico" />
<title>MArC :: Measurement point control</title>
</head>
<body class="bthcss">
<div id="content">
<?php if ( !$alert ){ ?>
<div class="notice">
<p>Message sent. <a href="sendMsg.php?SID=<?=$sid?>"><br/>Back</a>.</p>
</div>
<?php } else { ?>
<div class="alert">
<p><?=$alert?> <a href="sndMsg2.php?SID=<?=$sid?>&id=<?=$mp->id?>"><br/>Back</a>.</p>
</div>
<?php } ?>
</div>
</body>
</html>