<?php
@session_start();
require_once('includes/config.php');
require_once('includes/functions.php');
if (isset($_POST['Submit']))
{
$email = $_POST['email']);
$password = $_POST['password']);
$password2 = $_POST['password2']);
if ($email == "" || $password == "" || $password2 == "") {
$error .= '<center>Missing information</center><br />';
} else {
if (strlen($password) < 25 || strlen($password) > 6){
$error .= "<center>Password must be less than 25 characters but more than 6.</center><br />";
}
if ($password != $password2) {
$error .= '<center>Confirmation password do not match</center><br />';
}
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error .= '<center>E-mail is not valid</center><br />';
} else {
//Query
//Check if email already exist
$statement = $pdo->prepare('SELECT * FROM Accounts WHERE email = :email');
$statement->execute(array(':email' => $email));
$rows = $statement->fetch(PDO::FETCH_ASSOC);
if($rows) {
$error .= '<center>Email already exist</center><br />';
}
}
}
if(!isset($error))
{
$statement = $pdo->prepare('EXEC WZ_ACCOUNT_CREATE :ip, :email, :password, 0, 0, 0,');
$params = array(
':ip' => $ip,
':email' => $email,
':password' => $password
);
if($statement->execute($params)) {
echo 'Account created!';
}
} else {
echo $error;
}
}
?>
<!--
This is only a sample script, you can remove, edit, what you want.
-->
<form method="post">
<center>
<fieldset>
<legend>Register</legend>
<!-- Email -->
<label for='email' >Email Address*:</label>
<input type='text' name='email' maxlength="50" /><br>
<!-- Password -->
<label for='password' >Password*:</label>
<input type='password' name='password' maxlength="50" /><br>
<!-- Confirm Password -->
<label for='password' >Confirm Password*:</label>
<input type='password' name='password2' maxlength="50" /><br>
<!-- Submit -->
<input type='submit' name='Submit' value='Register' />
</fieldset>
Coded by WooAf & Fixed by Secured for RZ
</center>
</form>