index.php
/**
 * Perform the trash action.
 *
 * @param $sql_conn \mysqli The mysqli connection
 */
Perform the trash action.
@param $sql_conn \mysqli The mysqli connection
Perform the trash action . @param $sql_conn \ mysqli The mysqli connection
function act_trash($sql_conn)
{
    $pid = $_POST["pid"];
    $result = $sql_conn->query("SELECT `follows` FROM `problem` WHERE `pid` = $pid;");
    if (!$result) {
        die("trash failed: get follows");
    }
    $follows = $result->fetch_assoc()["follows"];
    $result = $sql_conn->query("UPDATE `problem` SET `follows` = $follows WHERE `follows` = $pid;");
    if (!$result) {
        die("trash failed: exclude");
    }
    $result = $sql_conn->query("UPDATE `problem` SET `follows` = -1 WHERE `pid` = $pid;");
    if (!$result) {
        die("trash failed: isolate");
    }
    $result = $sql_conn->query("UPDATE `problem` SET `trashed` = NOW() WHERE `pid` = $pid;");
    if (!$result) {
        die("trash failed: set trashed timestamp");
    }
}
function act_trash ( $ sql_conn ) { $ pid = $ _POST [ " pid " ] ; $ result = $ sql_conn -> query ( " SELECT `follows` FROM `problem` WHERE `pid` =  $ pid ; " ) ; if ( ! $ result ) { die ( " trash failed: get follows " ) ; } $ follows = $ result -> fetch_assoc ( ) [ " follows " ] ; $ result = $ sql_conn -> query ( " UPDATE `problem` SET `follows` =  $ follows  WHERE `follows` =  $ pid ; " ) ; if ( ! $ result ) { die ( " trash failed: exclude " ) ; } $ result = $ sql_conn -> query ( " UPDATE `problem` SET `follows` = -1 WHERE `pid` =  $ pid ; " ) ; if ( ! $ result ) { die ( " trash failed: isolate " ) ; } $ result = $ sql_conn -> query ( " UPDATE `problem` SET `trashed` = NOW() WHERE `pid` =  $ pid ; " ) ; if ( ! $ result ) { die ( " trash failed: set trashed timestamp " ) ; } }
Perform the trash action.
Perform the trash action .
// Get action parameters // Get the problem that the target problem follows // Exclude target problem from linked list // Make target problem follow nothing else in the list // It will be completely disconnected from every other problem // Update trashed timestamp on target problem