function getAllPendingUsers() { checkConnectivity(); $list = array(); $query = sprintf("select * from user"); $result = mysqli_query($GLOBALS['connection_link'], $query); while ($row = mysqli_fetch_assoc($result)) { if (getUserTypeString($row['type']) == 'waiting user') { $list[] = $row; } } return $list; }
} $navbar_signup_login = ""; $header_tag_extras = ""; $header_section_styles = ""; $header_section_metas = ""; $header_section_scripts = ""; $header_section_extras = ""; $body_tag_extras = ""; $body_section_styles = ""; $body_section_scripts = ""; //require('../database/selectQuires.php'); require '../database/models.php'; $loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']); $logged_in_name = "Welcome " . $loggedin_user_info['name']; $info = getUserInfoByUserID($_REQUEST['page_user_id']); $type = getUserTypeString($info['type']); $body_section_content = '<h1> Information About User: </h1>'; $body_section_content .= '<p>you can change the user\'s role, approve or delete the user.</p> <form action="approve.php"> ID: <input type="text" name="ID" readonly value="' . $info['ID'] . '"/><br> username: <input type="text" name="username" readonly value="' . $info['user_name'] . '"/><br> Name: <input type="text" name="name" readonly value="' . $info['name'] . '"/><br> email: <input type="text" name="email" readonly value="' . $info['email'] . '"/><br> Role: <input type="text" name="role" readonly value="' . $type . '"/><br> new role:<select name="type"> <option value="instractor">Instructor</option> <option value="admin">Admin</option> <option value="qa_member">QA member</option> <option value="department_manager">Department Manager</option> </select><br>'; if (strcmp($type, 'waiting user') == 0) {
if (isset($_SESSION['user_id'])) { echo "<p>You are already Loged in, you will be redirected to the homepage ...</p>"; header('refresh:4; url=http://localhost/qa/index.php'); die; } else { // check for login credentials, if user submit login request if (isset($_POST['username']) && isset($_POST['password'])) { require 'database/models.php'; $ret = getUserInfoByCredential($_POST['username'], $_POST['password']); if ($ret == false) { echo "<p>Bad username and password combination, try again!</p>"; header('refresh:4; url=http://localhost/qa/login.php'); die; } else { $_SESSION['user_id'] = $ret['ID']; $type = getUserTypeString($ret['type']); $_SESSION['type'] = $type; if (strcmp($type, 'qa_member') == 0) { echo "<p>Welcome QA Member, you will be redirected to the homepage ...</p>"; header('refresh:4; url=http://localhost/qa/quality-assurance/index.php'); die; } else { if (strcmp($type, 'admin') == 0) { echo "<p>Welcome Admin<p>"; header('refresh:4; url=http://localhost/qa/admin/index.php'); die; } else { if (strcmp($type, 'instractor') == 0) { echo "<p>Welcome Instructor, you will be redirected to the homepage ...</p>"; header('refresh:4;url=http://localhost/qa/instructor/index.php'); die;