<?php
//ADMINISTARTOR USERNAME
//userame trimmed in lowercase
$Username = strtolower(trim($_POST['username']));
//username can not be blank
if(empty($Username)) $AdminError['username'] = 'username field is blank';
//username must have more than/equal to 4 chars.
if(strlen($Username) < 4) $AdminError['username'] = 'username must have more than 3 characters';
//valid chars are a-z, 0-9, - only
if(!(ereg("^[a-z0-9-]+$", $Username))) $AdminError['username'] = 'Username contains invalid characters, only alphabets, numbers and hyphens(-) are allowed';
//first letter cannot be - or 0
if(ereg("^[0-]", $Username)) $AdminError['username'] = 'First letter must be an alphabet or a number between 1-9 and not zero(0) or a hyphen(-)';
//last letter can not be a -
if(ereg("[-]$", $Username)) $AdminError['username'] = 'Last letter must not be an hyphen(-)';
//no two consecutive -s
if(ereg("--", $Username)) $AdminError['username'] = 'There are two consecutive hyphens(-) in the username, which is not permitted';
//ADMINISTARTOR PASSWORD
//password blank? nah
if(empty($_POST['password1'])) $AdminError['password'] = 'Your password is blank';
//Password, atleast 5 chars.
if(strlen($_POST['password1']) < 5) $AdminError['password'] = 'Password must have more than 4 chars';
$Password1 = md5($_POST['password1']);
$Password2 = md5($_POST['password2']);
if(!($Password1 === $Password2)) $AdminError['password'] = 'Passwords do not match';
//ADMINISTARTOR E-MAIL
//E-mail
if(empty($_POST['email'])) $AdminError['email'] = 'Please write your E-mail';
$Email = $_POST['email'];
?>