コード例 #1
0
ファイル: core.php プロジェクト: jorwsmit/BlueJays
function db_delete($table, $idcol, $idval)
{
    $q = "DELETE FROM " . $table . " WHERE " . $idcol . "='" . $idval . "'";
    queryrun($q, connectSql());
}
コード例 #2
0
ファイル: removecourse.php プロジェクト: jorwsmit/BlueJays
    } else {
        if ($_SERVER["REQUEST_METHOD"] == "PUT") {
            //db_update("StudentCoursesRelation", $data, "email");
            //queryrun($q, connectSql());
            //"UPDATE SCR SET is_active=0 WHERE email='' AND course_id=''"
            /*
            function db_update($table, $values, $idcol) {
            		date_default_timezone_set('America/New York');
            
            		$q = "UPDATE " . $table . " SET ";
            		foreach ($values as $key => $val) {
            			if ($key != $idcol) {
            				$d = DateTime::createFromFormat('m/d/Y', $val);
            				if ($d != false) {
            					$val = $d->format('Y-m-d');
            				}
            				$q .= $key . "='" . htmlspecialchars($val, ENT_QUOTES) . "',";
            			}
            		}
            		$q = rtrim($q, ",");
            		$q .= " WHERE " . $idcol . "='" . $values[$idcol] . "'";
            
            		queryrun($q, connectSql());
            	}
            */
            //queryrun("UPDATE StudentCoursesRelation SET is_active='".htmlspecialchars(false, ENT_QUOTES)."' WHERE email='".$data["email"]."' AND course_id='"+$data["course_id"]."'", connectSql());
            //queryrun("UPDATE StudentCoursesRelation SET is_active='".false."' WHERE email='".$data["email"]."' AND course_id='"+$data["course_id"]."'", connectSql());
            queryrun("UPDATE StudentCoursesRelation SET is_active=0 WHERE email='" . $data["email"] . "' AND course_id='" . $data["course_id"] . "';", connectSql());
        }
    }
}
コード例 #3
0
ファイル: tutorresponse.php プロジェクト: jorwsmit/BlueJays
    if (ctype_digit($_GET["id"])) {
        echo json_encode(db_select("StudentTutor", "google_id", $_GET["id"]));
    } else {
        echo "ERROR!!! You have included something strange with your request.";
    }
} else {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if (db_select("StudentTutor", "google_id", $data["google_id"]) == NULL) {
            db_insert("StudentTutor", $data);
        }
    } else {
        if ($_SERVER["REQUEST_METHOD"] == "PUT") {
            //db_update("StudentTutor", $data, "google_id");
            if ($data["accept"] == true) {
                //db_update("Request", $data, "id");
                //queryrun("UPDATE Request SET accept=1 WHERE to_email='".$data["to_email"]."' AND from_email='".$data["from_email"]."' AND subject='".$data["subject"]."';", connectSql());
                queryrun("UPDATE Request SET accept=1 WHERE id='" . $data["id"] . "';", connectSql());
            } else {
                if ($data["accept"] == false) {
                    //db_update("Request", $data, "id");
                    //queryrun("UPDATE Request SET accept=0 WHERE to_email='".$data["to_email"]."' AND from_email='".$data["from_email"]."' AND subject='".$data["subject"]."';", connectSql());
                    queryrun("UPDATE Request SET accept=0 WHERE id='" . $data["id"] . "';", connectSql());
                } else {
                    //db_update("Request", $data, "id");
                    //queryrun("UPDATE Request SET accept=null WHERE to_email='".$data["to_email"]."' AND from_email='".$data["from_email"]."' AND subject='".$data["subject"]."';", connectSql());
                    queryrun("UPDATE Request SET accept=NULL WHERE id='" . $data["id"] . "';", connectSql());
                }
            }
        }
    }
}