<?php include_once "../../PHP/functions.php"; $db = DBConnect(); $dbresult = ExeQuery($db, "SELECT * FROM `utils`"); $user = mysql_fetch_row($dbresult); $returntable = array(); while ($user[0] != "") { $person = array(); array_push($person, $user[2] . ' ' . $user[3]); array_push($person, $user[12]); array_push($person, $user[11]); array_push($returntable, $person); $user = mysql_fetch_row($dbresult); } ENDSql($db); echo json_encode($returntable);
require_once "PHP/functions.php"; if (isset($_POST['loginuser'])) { // Validation $firstname = $_POST['TBfirstname']; $lastname = $_POST['TBlastname']; $validation = array(); if ($firstname == "") { $validation[count($validation)] = "*Username is empty"; } if ($lastname == "") { $validation[count($validation)] = "*Password is empty"; } if (count($validation) == 0) { $db = DBConnect(); PrepareSQL($db); $exists = mysql_fetch_row(ExeQuery($db, "SELECT * FROM `utils` WHERE U_NAME = '{$firstname}' AND U_PASS = '******'")); if ($exists[0] == "") { $validation[count($validation)] = "*Login failed"; } else { ENDSql($db); session_start(); $_SESSION['MM_Username'] = $firstname; header("location: Intro.php"); } ENDSql($db); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
ExeQuery($db, "UPDATE utils SET Q_index = {$questionID} WHERE U_NAME='{$username}'"); $dbquestion = ExeQuery($db, "SELECT * FROM questions WHERE Q_ID=" . $originalID); $question = mysql_fetch_row($dbquestion); // If answer is good, increment score of user if ($_POST['AnsValue'] == (string) $question[5]) { $score = 1 + (int) $user[12]; ExeQuery($db, "UPDATE utils SET Score=" . (string) $score); } // If last question was answered, exit quiz if ($qID > 100) { echo "TERMINÉ"; $questionID = "1"; } } // Select next question and put informations into question variable $dbquestion = ExeQuery($db, "SELECT * FROM questions WHERE Q_ID=" . (string) $questionID); $question = mysql_fetch_row($dbquestion); // Closure of database connection ENDSql($db); ?> <head>> <title>Quiz - #<?php echo (string) $question[0]; ?> </title> <script language="javascript" type="text/javascript"> upImage = new Image(); upImage.src = "Images/BTNCheckH.png";
if ($username == "") { $validation[count($validation)] = "*Username is empty"; } if ($password == "") { $validation[count($validation)] = "*Password is empty"; } if (!ValidateTelephone($telephone1)) { $validation[count($validation)] = "*Telephone is not valid"; } if (strlen($password) < 8) { $validation[count($validation)] = "*Password must contain 8 characters or more"; } if (count($validation) == 0) { $db = DBConnect(); PrepareSQL($db); $exists = mysql_fetch_row(ExeQuery($db, "SELECT COUNT(*) FROM `utils` WHERE U_NAME = '{$username}'")); if ($exists[0] != 0) { $validation[count($validation)] = "*Username already exists " . $exists; } else { AddUser(array($username, $password, $firstname, $lastname, $address, $city, $state, $country, $telephone1, $telephone2, $email)); ENDSql($db); session_start(); $_SESSION['MM_Username'] = $username; header("location: Intro.php"); } ENDSql($db); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">