forked from staktrace/bugmash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwipe.php
39 lines (33 loc) · 857 Bytes
/
wipe.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
<?php
include_once( 'common.php' );
if (! isset( $_POST['ids'] )) {
fail( 'Required parameter not set' );
}
$_DB = new mysqli( $_MYSQL_HOST, $_MYSQL_USER, $_MYSQL_PASS, $_MYSQL_DB );
if (mysqli_connect_errno()) {
fail( 'Error connecting to db: ' . mysqli_connect_error() );
}
$ids = explode( ',', $_POST['ids'] );
foreach ($ids AS $id) {
switch ($id{0}) {
case 'r':
$table = 'reviews';
break;
case 'q':
$table = 'requests';
break;
case 'n':
$table = 'newbugs';
break;
case 'd':
$table = 'changes';
break;
case 'c':
$table = 'comments';
break;
}
$rowId = intval( substr( $id, 1 ) );
$_DB->query( "UPDATE {$table} SET viewed=1 WHERE id={$rowId}" );
}
$_DB->close();
?>