Shex
03-07-2011, 04:08 AM
I've installed Mys now and I'd like to add a feature to the registration page:
The users have to enter a special code to be able to join.
The plan is easy, I add a code in the mysql db and when a user registers and puts in this code, he gets the userID which I "reserved" for him.
As I am no coder, I just tried to do so.
I edited the registration page, so that the box to enter the code shows up (and I am kinda proud of it xD)
<p>Usercode: <input name='usercode' type='text' id='usercode' maxlength='20'></p>
<p>Enter your code here. Currently no codes are given out, sorry.
Then I added the usercode into adopts_users db, settings:
usercode varchar(20) latin1_swedish_ci Null:No Standart:None UNIQUE
And I added the "grab user information from the form"
$usercode = $_POST["usercode"];
I think it is right so far.
The last thing I edited is the query to compare the data to the db. I guess that doesn't work this way ^^
$usercode = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $usercode);
$usercode = secure($usercode);
Does anyone know what I have to change so it works? ^^
Thanks
The users have to enter a special code to be able to join.
The plan is easy, I add a code in the mysql db and when a user registers and puts in this code, he gets the userID which I "reserved" for him.
As I am no coder, I just tried to do so.
I edited the registration page, so that the box to enter the code shows up (and I am kinda proud of it xD)
<p>Usercode: <input name='usercode' type='text' id='usercode' maxlength='20'></p>
<p>Enter your code here. Currently no codes are given out, sorry.
Then I added the usercode into adopts_users db, settings:
usercode varchar(20) latin1_swedish_ci Null:No Standart:None UNIQUE
And I added the "grab user information from the form"
$usercode = $_POST["usercode"];
I think it is right so far.
The last thing I edited is the query to compare the data to the db. I guess that doesn't work this way ^^
$usercode = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $usercode);
$usercode = secure($usercode);
Does anyone know what I have to change so it works? ^^
Thanks