Hi i wounder if some one can help me with getting a name check before getting verified...
Check de code... i wount it to check if ther are a user and if it is not a user it shoulde print "Ooops! - The nickname you chose don't exists!";!!!
But i can manage to get it to work!! whats wrong?
<?php
$username = $_POST["username"];
$set = $_POST["set"];
function emailsyntax_is_valid($email) {
$to_work_out = explode("@", $email);
if (!isset($to_work_out[0])) return FALSE;
if (!isset($to_work_out[1])) return FALSE;
$pattern_local = '^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?).([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$';
$pattern_domain = '^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?).([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*.[a-z]{2,4}$';
$match_local = eregi($pattern_local, $to_work_out[0]);
$match_domain = eregi($pattern_domain, $to_work_out[1]);
if ($match_local && $match_domain) {
return TRUE;
}
return FALSE;
}
if ($set=="set") {
$username_control = 1;
$username2_control = 1;
$username3_control = 1;
$main_control = 1;
if($username == ""){
$empty_username = "Ooops! - You forgot to enter your username.";
$username_control = 0;
$main_control = 0;
}
elseif(strlen($username) < 4){
$empty_username = "Ooops! - Your username should be at least 4 letters long.";
$username2_control = 0;
$main_control = 0;
}
elseif(strlen($username) > 20){
$empty_username = "Ooops! - Your username can't be larger than 20 letters.";
$username3_control = 0;
$main_control = 0;
}
elseif($main_control == 1){
$str = $username;
$str = strtolower($str);
require ('./management/mysqlcondbrr.php');
$result = mysql_query("SELECT username FROM reg_info where username=$str", $starta);
while ($array = mysql_fetch_array($result)) {
if($str == $array["username"]) {
$empty_username = "Ooops! - The nickname you chose don't exists!";
$main_control2 = 1;
break;
mysql_close($starta);
}
}
}
}
if($main_control2 != 1 && $main_control == 1) {
}
?>
<br>
<form action="<?=$PHP_SELF?>" method="post" name="hej">
<b>Your Username Here:</b><br><br>
<input type="text" name="username" size="15" class="inputSidebar" value="<?php
if($username_control != 0){ echo $_POST['username'];}
elseif(username2_control !=0){ echo $_POST['username'];}
elseif(username3_control !=0){ echo $_POST['username'];}
else{ echo ''; } ?>">
<?php echo $empty_username; ?>    
<input class="button" type="submit" name="submit" value="Get password">
<input type="hidden" name="set" value="set">
</form>