Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (33 sloc) 0.857 kb
1008c0c Add wipe.php to handle the XHR requests on the server and mark items as ...
Kartikaya Gupta authored
1 <?php
2
5941fee Factor out common PHP code into common.php
Kartikaya Gupta authored
3 include_once( 'common.php' );
1008c0c Add wipe.php to handle the XHR requests on the server and mark items as ...
Kartikaya Gupta authored
4
5 if (! isset( $_POST['ids'] )) {
6 fail( 'Required parameter not set' );
7 }
8
9 $_DB = new mysqli( $_MYSQL_HOST, $_MYSQL_USER, $_MYSQL_PASS, $_MYSQL_DB );
10 if (mysqli_connect_errno()) {
11 fail( 'Error connecting to db: ' . mysqli_connect_error() );
12 }
13
14 $ids = explode( ',', $_POST['ids'] );
15 foreach ($ids AS $id) {
16 switch ($id{0}) {
17 case 'r':
18 $table = 'reviews';
19 break;
20 case 'q':
21 $table = 'requests';
22 break;
23 case 'n':
24 $table = 'newbugs';
25 break;
26 case 'd':
27 $table = 'changes';
28 break;
29 case 'c':
30 $table = 'comments';
31 break;
32 }
33 $rowId = intval( substr( $id, 1 ) );
34 $_DB->query( "UPDATE {$table} SET viewed=1 WHERE id={$rowId}" );
35 }
36
37 $_DB->close();
38
39 ?>
Something went wrong with that request. Please try again.