<?php

if (isset($_POST["register"])) {
    $_SESSION["first_login"] = true;
    //The user's first login
    $Register = new Register($Database);
    //Instantiate the register class
    try {
        $Register->setRegisterType('datehitter');
        //The user is registering through Datehitter
        $Register->setUsername($_POST["username"]);
        //The user's username
        $Register->setFirstName($_POST["first_name"]);
        //The user's first name
        $Register->setLastName($_POST["last_name"]);
        //The user's last name
        $Register->setEmail($_POST["email"]);
        //The user's email
        $Register->setPassword($_POST["password"], $salt);
        //The user's password
        $Register->setThumbnail($url . '/images/default_pp.png');
        //Save the user's thumbnail
        $Register->insertUser();
        //Register the user
    } catch (Exception $e) {
        echo $e->getMessage();
        //Echo any errors
    }
}
Exemple #2
0
}
if (isset($_POST['submit'])) {
    $data = array('Firstname' => $_POST['fname'], 'Lastname' => $_POST['lname'], 'Gender' => $_POST['gender'], 'Username' => $_POST['username'], 'Password' => $_POST['password'], 'Email' => $_POST['email'], 'Address' => $_POST['address']);
    $pass = true;
    foreach ($data as $var => $value) {
        if (empty($value)) {
            echo $var . " is empty!";
            $pass = false;
            break;
        }
    }
    if ($pass) {
        $db = new DBCOnnection();
        $register->setDB($db->connect());
        if ($register->verification('email', $data['Email']) && $register->verification('username', $data['Username'])) {
            $register->setFirstname($data['Firstname']);
            $register->setLastname($data['Lastname']);
            $register->setGender($data['Gender']);
            $register->setUsername($data['Username']);
            $register->setPassword($data['Password']);
            $register->setEmail($data['Email']);
            $register->setAddress($data['Address']);
            $register->setIsDoctor($_POST['is_doctor']);
            if ($register->insert() != -1) {
                $register->redirect();
            }
        } else {
            echo Register::getMessage();
        }
    }
}