Registration modified to verify a person's email. Requires PHPMailer (Included)
You will need to change mail.php for your smtp server, possibly verify.php for your queries, and db.config.php for your database info. The rest is up to you :P
*Edit*
I uploaded a different Registration, this one is more of a "personal" one, which has jQuery to verify all fields are entered, and to check if the username already exists beforehand. It also has more commenting throughout the scripts to help explain, seeing as my previous didn't.
Listed below are things you will need to look for in the files.
This one will need quite a few edits more than likely. Going from top to bottom:
$activationKey - You can modify this to your liking, to make your own type of registration key
The queries - I commented this, but I did delete a lot of columns from the Users_Detail table. I also changed EmailAuthKey to varchar(MAX). This can be done in SQL. Right-Click the table, click design and change the column type for it. I can post pictures if needed.
This one is commented pretty much all the way through on what you need to do, but let's go through them again.
First $body - You need to change this to the body of your registration email. It can be pretty much anything BUT, It requires a link to your verify.php?$activationKey ; I mean, how else would they register without it? :P
It is currently set up for a gmail SMTP server, which isn't hard to use. You just need a gmail account. For different types of mail servers, you're going to have to google it, or check the documentation of PHPMailer.
To make it require email to log in to the server is up to you. If you look at the files, I used the UseQueue column. To make sure no one can login without verifying, I changed the Login Procedure (usp_Try_GameLogin_Taiwan), to include something like this:
-- NotExist User OR Leave User
IF( @UserUID = 0 OR @Leave = 1 )
BEGIN
SET @Status = -3
END
ELSE IF (@UseQueue='0')
BEGIN
SET @Status= -2
END
ELSE
BEGIN
-- Check Password
EXEC dbo.sp_LoginSuccessCheck @UserID, @InPassword, @Check output
IF ( @@ERROR = 0 )
BEGIN
IF( @Check <> 1 )
BEGIN
SET @Status = -1
END
END
ELSE
BEGIN
SET @Status = -1
END
END
*Note* This is NOT the full login procedure, it's merely a snippet. I am just showing you how I did made email verification a need for login. This also does not have the dupe fix, as it is just my test server.
As for the two .js files, those are for the register.php; They verify that all fields have been entered, and assist with the check for correct username.
Credits to:
Abrasive - For the registration script itself
Bane - For helping me finish
That is true. That is why I said the rest is up to you.
You need to change the queries a bit, as well as change your login procedure.
Changing the queries in them, you need to have the "verify" half of verify.php to let's say... update Users_Master and change UseQueue to 1, whereas the registering half changes it to 0.
Then alter your login procedure, if UseQueue is 0 Set Status=-2 else Set Status=0
Warning: mssql_query() [function.mssql-query]: message: Cannot insert the value NULL into column 'UserUID', table 'PS_UserData.dbo.Users_Master'; column does not allow nulls. INSERT fails. (severity 16) in H:\xampp\htdocs\Nova pasta\verify.php on line 67
Warning: mssql_query() [function.mssql-query]: Query failed in H:\xampp\htdocs\Nova pasta\verify.php on line 67
Warning: mssql_query() [function.mssql-query]: message: Cannot insert the value NULL into column 'UserUID', table 'PS_UserData.dbo.Users_Detail'; column does not allow nulls. INSERT fails. (severity 16) in H:\xampp\htdocs\Nova pasta\verify.php on line 72
Warning: mssql_query() [function.mssql-query]: Query failed in H:\xampp\htdocs\Nova pasta\verify.php on line 72
Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: REPLY EMAIL' in H:\xampp\htdocs\Nova pasta\PHPMailer\class.phpmailer.php:462 Stack trace: #0 H:\xampp\htdocs\Nova pasta\PHPMailer\class.phpmailer.php(440): PHPMailer->AddAnAddress('ReplyTo', 'REPLY EMAIL', 'YOUR NAME') #1 H:\xampp\htdocs\Nova pasta\mail.php(15): PHPMailer->AddReplyTo('REPLY EMAIL', 'YOUR NAME') #2 H:\xampp\htdocs\Nova pasta\verify.php(78): require('H:\xampp\htdocs...') #3 {main} thrown in H:\xampp\htdocs\Nova pasta\PHPMailer\class.phpmailer.php on line 462
That is true. That is why I said the rest is up to you.
You need to change the queries a bit, as well as change your login procedure.
Changing the queries in them, you need to have the "verify" half of verify.php to let's say... update Users_Master and change UseQueue to 1, whereas the registering half changes it to 0.
Then alter your login procedure, if UseQueue is 0 Set Status=-2 else Set Status=0
that's kindda similar to what i did i changed the default status when register withtout verify = -1
Quote:
$sql = "INSERT INTO PS_UserData.dbo.Users_Master
(UserUID,UserID,Pw,JoinDate,Admin,AdminLevel,UseQu eue,Status,Leave,LeaveDate,UserType,Point,UserIp)
VALUES ('{$UserUID}','{$username}','{$password}',GETDATE( ),0,0,0,-1,0,GETDATE(),'N',0,'{$user_ip}')";
btw the script was missing itemUID Newsletter and SMS collum, because those collum cant be leave NULL
$sql="UPDATE Users_Detail SET EmailAuthKey='Verified', EmailAuth=1 WHERE (UserID = '$row[UserID]')
Update Users_Master SET Status = 0 Where (UserID = '$row[UserID]')";
PS:/ on $activationKey you only need 1 mt_rand();
otherwise it will redirect you to a blank page
BTW is this script safe from SQL injection?
that's kindda similar to what i did i changed the default status when register withtout verify = -1
btw the script was missing itemUID Newsletter and SMS collum, because those collum cant be leave NULL
at the end after verify just add
PS:/ on $activationKey you only need 1 mt_rand();
otherwise it will redirect you to a blank page
BTW is this script safe from SQL injection?
If it is based off of Abrasive's script, yes, it has the escape strings and such for the injection protection.
As per the OP, I haven't checked it out, as I see it as an added and unnecessary step for account creation (provided you are already using a form of spam protection). However, if it is also applied for password changes, this becomes far more useful.
Thank you for the release. I am sure many will find it very useful.
btw the script was missing itemUID Newsletter and SMS collum, because those collum cant be leave NULL
at the end after verify just add
PS:/ on $activationKey you only need 1 mt_rand();
otherwise it will redirect you to a blank page
BTW is this script safe from SQL injection?
I did not account for the original tables at the time. My database tables are slightly editted.
I have erased all unnecessary columns in both tables, so I did not check if the original needed certain tables. As for the activationkey, I changed the column length to varchar(MAX)
Help with LOTF and Hamachi ID Tyler.PC 08/23/2008 - CO2 Private Server - 5 Replies I was messaged recently by Tyler.PC saying that the source I used on here for the lotf guide, will get me sued. He said that the source was copyrighted, and that they are going to have my server shut down, and he is gonna have them sue me for using the guide, and source. Is it possible for them to do this? If so, cant TQ sue everyone on here for using there source's? I know some things are changed, but basically still the same. So if anyone can tell me if this is possible, I would appreciate...