Redigér profiltekst
Hejsa! Jeg er igang med et community, og er løbet ind i et problem. Jeg har siddet i timevis uden at kunne forstå hvad der er galt. Den bliver ved med at sende til siden ?nMsg=2, og jeg forstår ikke hvorfor, her er koden, håber I har et svar:if($_POST['new']){
if(empty($_POST['username']) OR empty($_POST['password']) OR empty($_POST['password2']) OR empty($_POST['first_name']) OR empty($_POST['email'])){
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=1");
break;
}
if($_POST['password'] != "$_POST[password2]"){
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=4");
break;}else{
$c1 = mysql_query("SELECT * FROM users WHERE id = '$_COOKIE[user]'");
while($rs = mysql_fetch_array($c1)){
if(strtolower(addslashes($_POST['username'])) == "$rs[username]"){
$insert = mysql_query("UPDATE users SET username = '".addslashes($_POST['username'])."', first_name = '".addslashes($_POST['first_name'])."', email = '".addslashes($_POST['email'])."', born_day = '".addslashes($_POST['born_day'])."', born_month = '".addslashes($_POST['born_month'])."', born_year = '".addslashes($_POST['born_year'])."', gender = '".addslashes($_POST['gender'])."', last_name = '".addslashes($_POST['last_name'])."', occupation = '".addslashes($_POST['occupation'])."', www = '".addslashes($_POST['www'])."', status = '".addslashes($_POST['status'])."', location = '".addslashes($_POST['location'])."', password = '".addslashes($_POST['password'])."' WHERE id = '$_COOKIE[user]' LIMIT 1") or die(mysql_error());
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=3");
ob_end_flush;
}else{
$c2 = mysql_query("SELECT * FROM users WHERE username = '".addslashes($_POST[username])."'");
$c5 = mysql_fetch_array($c2);
$c3 = mysql_num_rows($c2);
if($c3 != "0"){
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=2");
break;
}else{
$usercheck = "$_POST[username]";
if (strlen($usercheck) > 20) {
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=5");
break;
}elseif (strlen($usercheck) < 2) {
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=6");
break;
}
else if(!eregi("^([0-9a-z])+$", $usercheck)){
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=7");
break;
}
if($c3 != "0"){
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=2");
break;
}else{
Header("location: ".$_SERVER["PHP_SELF"]."?nMsg=3");
break;
}}
}
}
}
}