/var/www/onesolution.com.hk/onesupport/project/status.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
    
require_once(__DIR__ '/../checkuser.php');
    if (
isPost() && isset($_POST['id'], $_POST['status'])) {
        
extract($_POST);

        
$sql "UPDATE sup_project set status = '".(int)$_POST['status']."' WHERE id = ?";
        
$parameters = array((int)$_POST['id']);
        if (!(
$sth $dbh->prepare($sql))) {
            throw new 
Exception("sql prepare statement failure: $sql");
        }
        
$sth->setFetchMode(PDO::FETCH_ASSOC);
        if (!
$sth->execute($parameters)) {
            throw new 
Exception("sql execute statement failure: $sql");
        }

        
$statusOptions Project::statusOptions();
        
$data = array(
            
'id' => $_POST['id'],
            
'message' => 'Changed status to ' $statusOptions[$_POST['status']] . '.',
        );
        
redirectAndExit('modifyform.php?'.http_build_query($data));
    }
?>