require_once 'function/data_holder.php';
require_once 'includes/output.html.php';
require_once 'database/connection.php';
// get old location from user.
define("route", "http://localhost.com/ajax_loader");
$conn = connection();
add_header("Home");
if (!$conn) {
    echo "Could not establish connection to database.";
    exit;
}
if (isset($_SESSION['valid_user'])) {
    $sql = " SELECT email, active FROM users WHERE email = '" . $_SESSION['valid_user'] . "'";
    $result = $conn->query($sql);
    if (!$result) {
        echo "connection to the database couldn't be establish";
        exit;
    }
    while ($row = $result->fetch_assoc()) {
        extract($row);
        if ($active == 0) {
            user_active();
            break;
        }
    }
    if (!check_profile()) {
        create_profile();
    }
} else {
    header("Location:login.php");
}
Example #2
0
}
function check_profile()
{
    global $_POST;
    global $CONST;
    if (isset($_POST["question"]) && filter_var($_POST["question"], FILTER_VALIDATE_REGEXP, array("options" => array('regexp' => "/^{$_SESSION["level"]}[1-{$CONST["questions"]}]\$/")))) {
        return check_question($_POST["question"]);
    } else {
        if (isset($_POST["advance"]) && filter_var($_POST["advance"], FILTER_VALIDATE_REGEXP, array("options" => array('regexp' => "/^[a-z\\d]+\$/i")))) {
            return check_level($_POST["advance"]);
        } else {
            return NULL;
        }
    }
}
$wrong_msg = check_profile();
unset($_POST);
?>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>NJATH - <?php 
echo $_SESSION["username"];
?>
 Profile</title>
        <link href="profile.css" rel="stylesheet" type="text/css" />
        <link href="navbar.css" rel="stylesheet" type="text/css" />
    </head>