Example #1
0
<?php

require_once "includes/functions_no_session.inc";
$stat_message = "";
if ($id = Tools::isUserLogged()) {
    Tools::redirect("index.php");
}
if ($u = Tools::valuePost("user") and $p = Tools::valuePost("pass") and Tools::valueGet("login") == 1) {
    if (Tools::signin($u, $p)) {
        Tools::redirect("index.php");
    } else {
        Tools::redirect("signin.php?status=1");
    }
}
if ($value = Tools::valueGet('status')) {
    if ($value == 1) {
        $stat_message = "<div class=\"alert animated fadeIn alert-danger text-center\">Wrong Username or Password!</div>";
    } elseif ($value == 2) {
        $stat_message = "<div class=\"alert animated fadeIn alert-danger text-center\">Missing Credentials!</div>";
    } elseif ($value == 3) {
        $stat_message = "<div class=\"alert animated fadeIn alert-success text-center\">Signup successful, login with your email or chosen username!</div>";
    } elseif ($value == 4) {
        $stat_message = "<div class=\"alert animated fadeIn alert-success text-center\">Password successfully reset login with new password.</div>";
    }
}
?>
<!DOCTYPE html>
<html class="signin no-js" lang="en">

<head>
    <title>Grade Access - SIGN IN</title>
Example #2
0
if ($subdomain = Tools::valuePost("subdomain")) {
    if ($school_id = App::findSubdomain($subdomain)) {
        $title = Tools::valuePost('title');
        $type = "parent";
        $name = Tools::valuePost('name');
        $email = Tools::valuePost('email');
        $phone = Tools::valuePost('phone');
        $password = Tools::valuePost('pass');
        $name = explode(" ", $name);
        $pass = password_hash($password, PASSWORD_DEFAULT);
        if (!App::findEmail($email)) {
            if (!App::findPhone($phone)) {
                $school = new School($school_id);
                if ($id = $school->addUser($title, $name[0], $name[1], $email, $phone, $type, $pass)) {
                    ParentClass::register($id);
                    if (Tools::signin($email, $password)) {
                        Tools::redirect("../../index.php?subpage=tour");
                    }
                } else {
                    Tools::redirect("../../signup.php?status=4");
                }
            } else {
                Tools::redirect("../../signup.php?status=3");
            }
        } else {
            Tools::redirect("../../signup.php?status=2");
        }
    } else {
        Tools::redirect("../../signup.php?status=1");
    }
}