} else {
		//$_SESSION['notification'][] = 'Foute invoer';
		return false;
	}
}

if(isset($_POST["registreer"])){
		// controleer geldigheid e-mailadres en of velden zijn ingevuld
		if(!checkInput()){
			$_SESSION['notification'][] = 'Foute invoer';
			header('Location: registratie-form.php');
			break; //  vervangen door een Throw exception??
		} 

		// check of ingevuld email bestaat:
		if(!checkEmailExists($_POST['email'])){

			 $_SESSION['email'] = $_POST['email'];
			 $_SESSION['paswoord'] = $_POST['paswoord'];

			 $ingevoerdPaswoord = $_SESSION['paswoord'];
			 $ingevoerdEmail = $_SESSION['email'];
			 $salt = generateSalt();
			 $HashedSaltPlusPaswoord = hash('SHA512', $ingevoerdPaswoord . $salt);

			// connectie maken:
			$db = connectToDatabase(); 

			// data inputten
			try {
Example #2
0
     if (checkUserNameExists($username)) {
         $error = '<li>Username already exists.</li>';
     }
 }
 if (strlen($name) > 30) {
     $error .= '<li>Name must be less than 30 characters.</li>';
 }
 if (strlen($password) > 30) {
     $error .= '<li>Password must be less than 30 characters.</li>';
 }
 // TODO: uncomment on deploy, and check email not used before
 //if (filter_var($email, FILTER_VALIDATE_EMAIL) === false)
 //{
 //  $error .= 'Not Valide Email Address.\n';
 //}
 if (checkEmailExists($email)) {
     $error .= '<li>User email already exists.</li>';
 }
 if (!$error) {
     if (insertUser($name, $username, $password, $email)) {
         echo "<p>Registration is done!, you will be redirected in a second ...</p>";
         header('refresh:1; url=http://localhost/qa/pending.php');
     } else {
         echo "<p>Oops, Something went wrong! Try again and if you see this message again contact the technical support.</p>";
         header('refresh:3; url=http://localhost/qa/signup.php');
     }
 } else {
     echo '<div style="color:white;">';
     echo "<h1> The following errors occured, fix them and try again. </h1>";
     echo '<ol>' . $error . "</ol></div>";
     header('refresh:5; url=http://localhost/qa/signup.php');
Example #3
0
if (!empty($_GET['username'])) {
    if ($_GET['username'] == $_SESSION['UA_DETAILS']['username']) {
        echo "true";
    } else {
        if (checkUsernameExists($db, $_GET['username'])) {
            echo "false";
        } else {
            echo "true";
        }
    }
}
if (!empty($_GET['email'])) {
    if ($_GET['email'] == $_SESSION['UA_DETAILS']['email']) {
        echo "true";
    } else {
        if (checkEmailExists($db, $_GET['email'])) {
            echo "false";
        } else {
            echo "true";
        }
    }
}
/////////////////////////////////////////////////////////////////////////////
///////////     Special Actions     ////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
if ($_GET['error'] == "take_quiz") {
    $_SESSION['ERROR']['type'] = 'Notice';
    $_SESSION['ERROR']['reason'] = "You Should Login to Take the Quiz.";
}
function loginBase($auth, $db)
{
Example #4
0
function checkUsernameEmail($username, $email)
{
    // Implementing the Javascript check in case that is broken on the site
    $regex = preg_match("#[<>\"'%;()&]#i", $username);
    if (strlen($username) < 2 || $regex) {
        aecErrorAlert(JText::_('AEC_VALIDATE_ALPHANUMERIC'));
        return JText::_('AEC_VALIDATE_ALPHANUMERIC');
    }
    if (checkUsernameExists($username)) {
        aecErrorAlert(JText::_('AEC_VALIDATE_USERNAME_EXISTS'));
        return JText::_('AEC_VALIDATE_USERNAME_EXISTS');
    }
    if (!empty($email)) {
        if (checkEmailExists($email)) {
            aecErrorAlert(JText::_('AEC_VALIDATE_EMAIL_EXISTS'));
            return JText::_('AEC_VALIDATE_EMAIL_EXISTS');
        }
    }
    return true;
}