Jump to content

[SOLVED] Register Page


zackcez

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.