Junior Spellweaver
- Joined
- Jan 1, 2008
- Messages
- 170
- Reaction score
- 0
I noticed that most of our ran private servers are not open for registration 24/7 and others are closed and you need to request it to be open just to register 1 account. Their main reason is probably to avoid spamming of accounts in their database so to prevent lag. Now this adds more work for admin and gm's of private servers if every minute they open their registration page so to grant the request of their player.
Now, with this Activation Page, you can now open your registration permanently.
To add this on your ran cp, follow this steps: (Note: use the files i've provided to avoid some errors)
1. Open your SQL server management. (I use SQL 2k5, don't know if this works for other sql)
2. Add this table under RanUser>dbo.UserInfo
Column Name: ActivationDate
Data Type: datetime
Allow Nulls: Yes
Next...
Column Name: ActivationCode
Data Type: varchar(21)
Allow Nulls: No
ScreenShot:
3. Now, were still on sql server management. Create a new query and paste this scripts:
Now another script is this:
4. Add this to your query.php
Since we don't have the same tables in our dbo.UserInfo, add this at the end of your INSERT_USERAUTH
(ActivationDate, ActivationCode)
VALUES (getdate(),'%s')");
It should look like this:
5. Now is to download my files which contain the ff:
config.php (or you can use your old config.php no problem with that)
index.php
activateaccount.php
register.php
login.php
put index.php and config.php to your
C:\Program Files\Abyss Web Server\htdocs\ran
and put activateaccount.php register.php and login.php to your
C:\Program Files\Abyss Web Server\htdocs\ran\page
i've also included the buttons just paste them to C:\Program Files\Abyss Web Server\htdocs\ran\img
6. Your finish, try to browse your activateaccount.php
That's all and thank you...
Addition:
If you wanna send their account info upon finish registration.. Open register.php find and replace this lines:
$CONFIG['email'] = "1"; //1=send 0=not send
Now, with this Activation Page, you can now open your registration permanently.
To add this on your ran cp, follow this steps: (Note: use the files i've provided to avoid some errors)
1. Open your SQL server management. (I use SQL 2k5, don't know if this works for other sql)
2. Add this table under RanUser>dbo.UserInfo
Column Name: ActivationDate
Data Type: datetime
Allow Nulls: Yes
Next...
Column Name: ActivationCode
Data Type: varchar(21)
Allow Nulls: No
ScreenShot:
3. Now, were still on sql server management. Create a new query and paste this scripts:
This script will delete the account which are not activated within 2 days. To change the day, edit the red text. This script has two requirements before it automatically execute, first is UserAvailable and second is the ActivationDate. If one of this two requirements were not met, the script won't execute. ALTER TRIGGER for those who have this trigger before.USE [RanUser]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[Delete_Inactive] ON [dbo].[UserInfo]
after update
as
BEGIN
DELETE FROM UserInfo
WHERE UserAvailable = 0 and
DATEDIFF(day,[UserInfo].ActivationDate, GETDATE()) >= 2
END
Now another script is this:
About this script. This makes safe your UserInfo database. The action of this script is once the account is activated, ActivationDate will be set to Null making the first script invalid since it won't meet its requirements.USE RanUser
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[Account_Activated] ON [dbo].[UserInfo]
after update
as
BEGIN
Update [UserInfo] set [UserInfo].ActivationDate=Null
From UserInfo
Where UserAvailable = 1
End
4. Add this to your query.php
DEFINE("SELECT_USER_FULLINFO1", "SELECT UserName, UserPass, UserPass2, UserLoginState, UserEmail, UserNum, UserPoint, ActivationCode FROM UserInfo WHERE UserName = '%s' ");
DEFINE("UPDATE_ACCOUNT","UPDATE UserInfo SET UserAvailable = '%s' WHERE UserName = '%s' ");
Since we don't have the same tables in our dbo.UserInfo, add this at the end of your INSERT_USERAUTH
(ActivationDate, ActivationCode)
VALUES (getdate(),'%s')");
It should look like this:
The red text are the one we insert.DEFINE("INSERT_USERAUTH", "INSERT INTO UserInfo (UserName, UserID, UserPass, UserPass2, UserType, UserAvailable, CreateDate, ChaRemain, ChaTestRemain, UserEmail, UserPoint, WebLoginState, ActivationDate, ActivationCode)
VALUES ('%s','%s','%s','%s','1','0',getdate(),'2','2','%s','0','1',getdate(),'%s')");
5. Now is to download my files which contain the ff:
config.php (or you can use your old config.php no problem with that)
index.php
activateaccount.php
register.php
login.php
put index.php and config.php to your
C:\Program Files\Abyss Web Server\htdocs\ran
and put activateaccount.php register.php and login.php to your
C:\Program Files\Abyss Web Server\htdocs\ran\page
i've also included the buttons just paste them to C:\Program Files\Abyss Web Server\htdocs\ran\img
6. Your finish, try to browse your activateaccount.php
You must be registered to see links
That's all and thank you...
Addition:
If you wanna send their account info upon finish registration.. Open register.php find and replace this lines:
with this one:echo "<div align=center><font color=green size=2><strong>Account has been created sucessfully under the ff info:<br><br>
<font color=orange size=2><strong>UserName :</strong></font> <font color=red size=2><strong>$account</strong></font><br>
<font color=orange size=2><strong>Password :</strong></font> <font color=red size=2><strong>$password</strong></font><br>
<font color=orange size=2><strong>Password #2 :</strong></font> <font color=red size=2><strong>$sandi</strong></font><br>
<font color=orange size=2><strong>Email :</strong></font> <font color=red size=2><strong>$email</strong></font><br><br>
Please save your account info for future use.</strong></font><br><br></div>";
and open your config.php and find this line:if($CONFIG['email']==0) {
echo "<font color=green size=2><strong>Your password has been reseted to...</strong></font><br><font color=green size=2>{$newpassword}</font><br><br>";
} elseif($CONFIG['email']==1) {
sendemail($CONFIG['emailsmtp'], $CONFIG['emailuser'], $CONFIG['emailpass'], $CONFIG['emailaddress'], $CONFIG['servername'], "Lost Password", $useremail, $account, $newpassword, $ssn, "<strong>Your password has been reseted and sent to your email.</strong>");
}
$CONFIG['email'] = "1"; //1=send 0=not send
Attachments
You must be registered for see attachments list
Last edited: