[Release]Email Verification Registration

Newbie Spellweaver
Joined
Nov 15, 2010
Messages
33
Reaction score
8
I just finished reworking this registration that I had made awhile back when I was first learning PHP. I cleaned up a lot of it, and made it overall more efficient, though probably not as efficient as most people on here could do.

To use this, add it to your web server, and navigate to register.php. You must first add a table to your database, and edit config.php to add your SMTP User/Pass. As of now, I currently use PHPMailer, and have it configured to use gmail. You can edit this if you wish.

You must edit these variables in config.php:
PHP:
// Database configuration parameters
$db_host = "127.0.0.1"; //Your database host
$db_user = "Shaiya"; //Your database username
$db_pass = "Shaiya123"; //Your database password

//Configuration for email (Configured for gmail currently)
$smtp_user = "[email protected]"; //Your gmail email | ex. [email protected]
$smtp_pass = "yourpassword"; //Your gmail password
$reply_to_email = "your reply to email"; //Email players can reply to
$reply_to_name = "your name/server's name"; //Can be your server's name

After doing that, add this table to your database:
PHP:
USE [PS_UserData]
GO
/****** Object:  Table [dbo].[User_Verification]    Script Date: 01/24/2012 13:40:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[User_Verification](
	[UserID] [varchar](18) NOT NULL,
	[VerifyKey] [varchar](max) NOT NULL,
	[RegisterDate] [datetime] NOT NULL CONSTRAINT [DF_User_Verification_RegisterDate]  DEFAULT (getdate()),
	[VerifiedDate] [datetime] NULL,
	[isVerified] [bit] NOT NULL CONSTRAINT [DF_User_Verification_isVerified]  DEFAULT ((0))
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


I hope you enjoy this script, and it all works well for you. I've tested it and it works. What it does, is register the user with a status of -5 (one of the various banned status'), then adds the UserID/VerifyKey to the table you insert into your database. Once the user goes to his email, and clicks the link, it checks if the key exists, and hasn't been used (so the same key can't be used twice for the same user, so the user can't use it to unban his account if he's naughty). If the key is found, it'll show the key as verified in the new table and set the user as a normal user.

If you find any bugs, or have any comments, I'll be glad to know.
 

Attachments

could you please tell me what is this error?

Fatal error: Uncaught exception 'phpmailerException' with message 'SMTP Error: Could not connect to SMTP host.' in C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php:820 Stack trace: #0 C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php(705): PHPMailer->SmtpConnect() #1 C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php(576): PHPMailer->SmtpSend('Date: Tue, 29 O...', '--b1_cf0aeb1a45...') #2 C:\xampp\htdocs\Register(1)\Register\verify.php(69): PHPMailer->Send() #3 {main} thrown in C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php on line 820

and how to fix it? I understand that my host is connected
 
could you please tell me what is this error?

Fatal error: Uncaught exception 'phpmailerException' with message 'SMTP Error: Could not connect to SMTP host.' in C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php:820 Stack trace: #0 C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php(705): PHPMailer->SmtpConnect() #1 C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php(576): PHPMailer->SmtpSend('Date: Tue, 29 O...', '--b1_cf0aeb1a45...') #2 C:\xampp\htdocs\Register(1)\Register\verify.php(69): PHPMailer->Send() #3 {main} thrown in C:\xampp\htdocs\Register(1)\Register\PHPMailer\class.phpmailer.php on line 820

and how to fix it? I understand that my host is connected

check your Config.php again there is something wrong there ^^
 
tell me how to fix this error who knows
and how do I redirect instead of gmail Email found Smtp ports tried to change still gives an error

Fatal error: Uncaught exception 'phpmailerException' with message 'SMTP Error: Could not connect to SMTP host.' in C:\xampp\htdocs\Register\PHPMailer\class.phpmailer.php:820 Stack trace: #0 C:\xampp\htdocs\Register\PHPMailer\class.phpmailer.php(705): PHPMailer->SmtpConnect() #1 C:\xampp\htdocs\Register\PHPMailer\class.phpmailer.php(576): PHPMailer->SmtpSend('Date: Sun, 3 No...', '--b1_860ad33ca9...') #2 C:\xampp\htdocs\Register\verify.php(69): PHPMailer->Send() #3 {main} thrown in C:\xampp\htdocs\Register\PHPMailer\class.phpmailer.php on line 820

in config.php looks like everything is OK
 
Last edited:
Back