<?php require_once "/includes/session.php"; require_once "/includes/db_connect.php"; require_once "/includes/functions.php"; $db = new DB_CONNECT(); $message = ""; // check and submit the user request for the access of the page if (isset($_POST["submit"])) { $user_id = trim($db->mysql_prep($_POST["username"])); $password = trim($db->mysql_prep($_POST["password"])); $hashed_password = sha1($password); // for the hashing of the password $queryString = "SELECT * FROM adminUser WHERE username='******' && password='******' "; $result = $db->query_db($queryString); if ($db->number_of_rows($result) > 0) { $_SESSION["username"] = $user_id; redirect_to("firstpage.php"); } else { $message = "Passowrd and Username combination is wrong"; } } ?> <html lang="en" class="no-js"> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <title>DISASTER SAFETY</title> <link rel="stylesheet" type="text/css" href="stylesheets/demo.css"> <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> <link rel="stylesheet" type="text/css" href="stylesheets/animate-custom.css"> </head>
// query failed echo "query failed"; } else { redirect_to("question_list.php?test_name=" . get_test_name()); } } else { echo "empty fields"; } } else { echo "Someting was not set"; } } else { $db = new DB_CONNECT(); $query = "SELECT * FROM test WHERE test_name='" . get_test_name() . "' AND username='******' "; $details = $db->query_database($query); if ($db->number_of_rows($details) > 0) { $i = 1; $row = $db->fetch_array($details); $table_data = array(); $table_data["test_name"] = $row["test_name"]; $table_data["start_time"] = $row["start_time"]; $table_data["end_time"] = $row["end_time"]; $table_data["event_date"] = $row["event_date"]; $table_data["duration"] = $row["duration"]; } } ?> <!DOCTYPE html> <html> <head>
<?php require_once '../includes/db_connect.php'; require_once '../includes/functions.php'; require_once '../includes/session.php'; confirm_logged_in(); $db = new DB_CONNECT(); // get username from the session $username = get_username(); //select all test created by him from test table if (isset($_GET["message"])) { $message = "The Test has been deleted."; } $query = "SELECT test_name,start_time,end_time,event_date,duration FROM test WHERE username='******'"; $admin_tests = $db->query_database($query); if ($db->number_of_rows($admin_tests) > 0) { $i = 1; while ($row = $db->fetch_array($admin_tests)) { $table_data = array(); $table_data_array[$i] = array(); $table_data["test_name"] = $row["test_name"]; $table_data["start_time"] = $row["start_time"]; $table_data["end_time"] = $row["end_time"]; $table_data["event_date"] = $row["event_date"]; $table_data["duration"] = $row["duration"]; $table_data_array[$i] = $table_data; $i++; } $no_of_rows = $i - 1; $table_data_array["number_of_rows"] = $no_of_rows; $table_html = make_test_information_table();
<?php require_once '../includes/db_connect.php'; require_once '../includes/functions.php'; require_once '../includes/session.php'; confirm_logged_in(); $db = new DB_CONNECT(); // get username from the session $username = get_username(); $test_name = urldecode($_GET['test_name']); //select all test created by him from test table $query = "SELECT * FROM " . $test_name . "_users"; $users_table = $db->query_database($query); if ($db->number_of_rows($users_table) > 0) { $i = 1; while ($row = $db->fetch_array($users_table)) { $table_data = array(); $table_data_array[$i] = array(); $table_data["first_name"] = $row["first_name"]; $table_data["last_name"] = $row["last_name"]; $table_data["email"] = $row["email"]; $table_data["phone_number"] = $row["phone_number"]; $table_data["score"] = $row["score"]; $table_data["questions_attempted"] = $row["questions_attempted"]; $table_data["correct_ans"] = $row["correct_ans"]; $table_data["wrong_ans"] = $row["wrong_ans"]; $table_data_array[$i] = $table_data; $i++; } $no_of_rows = $i - 1; $table_data_array["number_of_rows"] = $no_of_rows;