zackcez Posted May 14, 2008 Share Posted May 14, 2008 I'm currently working on something, and I'd like to know how to make my page check to see if the user name is in use, and if it is suggest a few that aren't in use that are about the same as the wanted one...this would be awsome if someone knows this! Thanks a lot, Zack EDIT: I'd also like to know if it says a name with a swear word in it or something of that nature it will just refreash the page and not continue with the form... Link to comment https://forums.phpfreaks.com/topic/105531-solved-register-page/ Share on other sites More sharing options...
phpretard Posted May 14, 2008 Share Posted May 14, 2008 I don't understand? Link to comment https://forums.phpfreaks.com/topic/105531-solved-register-page/#findComment-540596 Share on other sites More sharing options...
zackcez Posted May 14, 2008 Author Share Posted May 14, 2008 go to RuneScape.com and click create new account...I want it kinda like that... Link to comment https://forums.phpfreaks.com/topic/105531-solved-register-page/#findComment-540602 Share on other sites More sharing options...
Fadion Posted May 14, 2008 Share Posted May 14, 2008 U dont a: Username: Guilty Name: Someone Age: 105 The username u specified is already taken. Try instead - GuiltySomeone - Guilty105 - Guilty1903 (current date - age) - GuiltyPHPFreak (some random words attached) If thats your purpose then its easy. Simply check the database for an existing record and if it finds one, suggest those usernames by appending his/her personal information, like name, age, birthdate, random words etc. If u have no technical idea on what im talking about, then ure wanting someone to create it for u, not actually asking help. Link to comment https://forums.phpfreaks.com/topic/105531-solved-register-page/#findComment-540620 Share on other sites More sharing options...
Fadion Posted May 14, 2008 Share Posted May 14, 2008 Ok i took a look at runescape and actually its probably the easiest thing to be created with php, as its only suggesting username + some random numbers. Its a totally useless feature which doesnt help your users. Anyway a simple code: <?php $username = $_POST['username']; $resultsUser = mysql_query("SELECT id, username FROM table WHERE username='$username'"); if(mysql_num_rows($resultsUser) == 1){ //do what u have to do } else{ $randNr = rand(100, 200); echo 'The username is already taken. Instead u can choose one of these<br />'; echo $username . $randNr . '<br />'; echo $username . $randNr+1 . '<br />'; echo $username . $randNr+2 . '<br />'; echo $username . $randNr+3 . '<br />'; } ?> Thats what it basically does, but what i suggested in my previous post should be a way better "suggested username" method. Link to comment https://forums.phpfreaks.com/topic/105531-solved-register-page/#findComment-540625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.