Jump to content

Change a name


Recommended Posts

Can any one see any reason this isnt working ? doesnt seem to change any thing or ot  its got me stumped

 

 echo " 	<Tr><Td>Username <td>:<td>$info[username] <a href=cont.php?action=name>Edit</a></td> ";
if ($_GET[action] == "name"){
	if(!$_GET[change]){
		echo "<br><form action=cont.php method=post>";
		echo "<input type=hidden name=action value=name>";
		echo "New Name: <input type=text size=30 name=change value=\"$info[username]\"><br>";
		echo "<input type=submit value=Update></form><p>";
		echo "<br><br><center>[<a href=cont.php>Back</a>]</center>";
	}else{
		$change = trim($change);
		$first = ord(substr($change,0,1));
		if((strlen($change) > 20) || (strlen($change) < 4)){
			echo "Username must be between 4 and 20 characters.";
			echo "<br><br><center>[<a href=cont.php?action=name>Back</a>]</center>";
		}elseif(substr($change,0,1) == " "){
			echo "Username can not start with a space.";
			echo "<br><br><center>[<a href=cont.php?action=name>Back</a>]</center>";
		}elseif(substr($change,0,1) == "."){
			echo "Username can not start with a dot.";
			echo "<br><br><center>[<a href=cont.php?action=name>Back</a>]</center>";
		}elseif(($first >= 48 && $first <= 57) || ($first >= 65 && $first <= 90) || ($first >= 97 && $first <= 122)  || ($first = 126)){
                  $change = eregi_replace(".com","...",$change);
                  $change = eregi_replace("www.",".",$change);
                  $change = eregi_replace(".tk",".",$change);
                  $change = eregi_replace(".net","...",$change);
    $usercheck = mysql_query("SELECT * FROM users WHERE username like '$change'");
			if(@mysql_num_rows($usercheck) > 0){
				echo "Username already taken";
				echo "<br><br><center>[<a href=cont.php?action=name>Back</a>]</center>";
	/*		}else{
				$checkip = mysql_query("SELECT * FROM users WHERE ip = '$info[ip]'");
                     if((@mysql_num_rows($checkip) > 1) && ($info[status] == "Member")){
					echo "Cannot change username while two users are on the same IP";
					echo "<br><br><center>[<a href=cont.php>Back</a>]</center>";
	*/
				}else{
					$change = htmlspecialchars($change);
					$change = eregi_replace("admin","loser",$change);
                        $change = eregi_replace("manager","loser",$change);
                        $change = eregi_replace(".com","...",$change);
                        $change = eregi_replace(".net","...",$change);
                        $change = eregi_replace("   "," ",$change);
					$change = eregi_replace("adm1n","loser",$change);



					echo "Name successfully changed from $info[username] to $change";

                        mysql_query("UPDATE users SET username = '$change' WHERE id = '$info[id]'");
					echo "<br><br>[<a href=account.php>Back</a>]</center>";
		//		}
			}
		}else{
			echo "Username MUST start with a letter or number.";
			echo "<br>*$change*<br>";
			echo "<br>*$first*<br>";
			echo "<br><br><center>[<a href=cont.php?action=name>Back</a>]</center>";
		}
	}
} 

Link to comment
https://forums.phpfreaks.com/topic/62708-change-a-name/
Share on other sites

Sorry, My bad new to all this, when i click the link to edit the details the name apears in the text box, but when i edit the name and click update nothing happens it should post name changed the change the name in the database but it does nothing when i click update just takes me back the the cont.php file. Sorry not much help.

Link to comment
https://forums.phpfreaks.com/topic/62708-change-a-name/#findComment-312115
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.