コード例 #1
0
ファイル: database.php プロジェクト: xZise/TrackMeViewer
function connect($connection = false)
{
    if ($connection === false) {
        global $DBIP, $DBNAME, $DBUSER, $DBPASS;
        $connection = toConnectionArray($DBIP, $DBNAME, $DBUSER, $DBPASS);
    }
    return new TrackMePDO("mysql:host={$connection['host']};dbname={$connection['name']}", $connection["user"], $connection["pass"]);
}
コード例 #2
0
ファイル: util.php プロジェクト: xZise/TrackMeViewer
 public static function setUpBeforeClass()
 {
     global $DBIP, $DBNAME, $DBUSER, $DBPASS;
     self::$connection = toConnectionArray($DBIP, $DBNAME, $DBUSER, $DBPASS);
 }
コード例 #3
0
ファイル: requests.php プロジェクト: xZise/TrackMeViewer
        $locked = 0;
        $result = mysql_query("Select Locked FROM trips WHERE FK_Users_ID = '{$userid}' and name='{$tripname}'");
        if ($row = mysql_fetch_array($result)) {
            $locked = $row['Locked'];
            if ($locked == 1) {
                echo "Result:8";
                die;
            }
        } else {
            echo "Result:7";
            // trip not found.
            die;
        }
        $result = mysql_query("Select ID FROM trips WHERE FK_Users_ID = '{$userid}' and name='{$newname}'");
        if ($row = mysql_fetch_array($result)) {
            echo "Result:10";
            // new name already exists
            die;
        }
        mysql_query("Update trips set name='{$newname}' where name='{$tripname}' AND FK_Users_ID = '{$userid}'");
        echo "Result:0";
        die;
    }
}
// Run by default when included/required, unless __norun is set to true
if (!isset($__norun) || !$__norun) {
    echo run(toConnectionArray($DBIP, $DBNAME, $DBUSER, $DBPASS));
}
?>