} execSql($db, $user_sql, "create user table"); execSql($db, $group_sql, "create groups table"); execSql($db, $task_types, "create task types table"); execSql($db, $default_task_types, "add default task types"); execSql($db, $agent_group, "create agent-group table"); execSql($db, $task_group, "create task-group table"); execSql($db, $fk_group_id, "make foreign key on task_group ('group_id')"); execSql($db, $fk_task_id, "make foreign key on task_group ('task_id')"); execSql($db, $fk_agent_agent_id, "make foreign key on agent_group ('agent_id')"); execSql($db, $fk_agent_group_id, "make foreign key on agent_group ('group_id')"); } function dummyUser($db) { $pass = hashPassword("admin"); $key = generateRandomString(); $sql = "INSERT INTO users VALUES (NULL,'admin','{$pass}','{$key}',NULL);"; execSql($db, $sql, "add admin user"); } function dummyAgents($db, $count = 10) { for ($i = 1; $i <= $count; $i++) { execSql($db, "INSERT INTO agent (id) VALUES ({$i})", "add dummy agent {$i}"); } } setupAPI($config); setupAdmin($config); $db = getDb($config); dummyUser($db); //dummyAgents($db,32); //dummy($db);
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @copyright 2015 Parsa Nikpour */ ?> <?php // Write errors to screen as needed ini_set('display_startup_errors', 1); ini_set('display_errors', 1); error_reporting(-1); // Include external functions for getting the current database connection include 'assets/php/lib.php'; dontCache(); // If admin user does not exist, redirect to admin setup page if (!adminExists()) { setupAdmin(); } // If logon failed, print error and display logon form again; otherwise, redirect to user dashboard if (!isset($_SESSION['user'])) { // destroySessionsButKeepErrors(); } else { header('Location: main'); } ?> <html> <head> <?php importResourcesFromLogin(); ?> <title>GPA 4 ME: Calculate Your GPA</title>