Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 15:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE] Secure PHP Web Registration Script

Discussion on [RELEASE] Secure PHP Web Registration Script within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Thumbs up [RELEASE] Secure PHP Web Registration Script

This is technically obsolete now, and I'd recommend using .

This is a secure registration script meant for Shaiya private servers.

I noticed a lot of private servers were using sandolkakos's registration script, which is very dangerous since it is vulnerable to SQL injection.

Ideally your UserUID column in the table PS_UserData.dbo.Users_Master should be set to auto-increment. If this is not the case, you will need to adjust this script, or ideally fix your database, to accommodate this.

You may need to modify the $sql variable in register.php to fit your database before this script will work.

I commented these scripts fairly verbosely, so please read the comments! They are meant to tell you useful stuff.

There are seven scripts you will need to make this work:
register.php (Edit the SQL in this file if needed)
register.view.php (Re-style the display in this file)
success.view.php (Re-style the success page in this file)
db.php
db.config.php (Edit this file with your personal database credentials)
recaptchalib.config.php (Edit this file with your personal reCAPTCHA key)
recaptchalib.php (From Google: )

Here are the files, which also includes the files for . You should remove the password change files if you do not wish for users to be able to change their password.
Attached Files
File Type: rar abrasive_registration.rar (9.1 KB, 5549 views)
abrasive is offline  
Thanks
69 Users
Old 01/08/2011, 20:55   #2
 
IonutTheDawg's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 103
Received Thanks: 38
how do i set UserUID to auto-increment?
IonutTheDawg is offline  
Old 01/08/2011, 21:14   #3
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by IonutTheDawg View Post
how do i set UserUID to auto-increment?
1. Open SQL Server Management Studio.
2. Navigate in Object Explorer to the [PS_UserData].[dbo].[Users_Master] table.
3. Now would be a good time to back up your Users_Master table and/or database, especially if you are doing this on a live server.
4. Right-click on the Users_Master table and select Design.
5. Highlight UserUID, and look inside the Column Properties section at the bottom of the interface for Identity Specification.
6. Expand Identity Specification, and change (Is Identity) to Yes. Identity Increment and Identity Seed should change to 1 automatically when you do this.
7. Press Ctrl + S to save.


If you get an error similar to this:


Go to Tools -> Options and uncheck "Prevent saving changes that require table recreation."
abrasive is offline  
Thanks
23 Users
Old 01/12/2011, 11:13   #4
 
shinru2004's Avatar
 
elite*gold: 260
Join Date: Oct 2009
Posts: 258
Received Thanks: 266
Quote:
Originally Posted by abrasive View Post
<script type="text/javascript">var RecaptchaOptions = {theme:'clean'};</script>
Dont forget to include the fact that you can change the recaptcha theme for those that dont know how
here is a link to the page with the different themes just replace clean within the line posted above with the new theme name

shinru2004 is offline  
Thanks
5 Users
Old 01/14/2011, 15:45   #5
 
treica's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 525
Received Thanks: 805
why dont work to change it to yes ?it are still disabled
treica is offline  
Thanks
1 User
Old 01/14/2011, 21:43   #6
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by treica View Post
why dont work to change it to yes ?it are still disabled
It's not clear to me what you are asking. Can you explain in detail what you are trying to do and what you have already tried?
abrasive is offline  
Thanks
1 User
Old 01/15/2011, 11:41   #7
 
elite*gold: 0
Join Date: Aug 2010
Posts: 241
Received Thanks: 254
I think he is having trouble with auto-increment on UserUID coloumn.
zargon05 is offline  
Thanks
1 User
Old 01/17/2011, 18:42   #8
 
elite*gold: 0
Join Date: Jul 2010
Posts: 498
Received Thanks: 449
Hello,

Im having a problem also with the auto increment on UserUID column, it wont let me save the (Is Identity) to "yes" for some reason. If i allow nulls i can create an account though but of course it has no UserUID.

Any idea?
Alladrios is offline  
Old 01/17/2011, 20:05   #9
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by Alladrios View Post
Hello,

Im having a problem also with the auto increment on UserUID column, it wont let me save the (Is Identity) to "yes" for some reason. If i allow nulls i can create an account though but of course it has no UserUID.

Any idea?
I forgot if you already have data in the table sometimes it won't allow you to change that. To get around this restriction you can create a new table with the Is Identity set. I'll call it Users_Master2 for this example.

First you will need to allow IDENTITY_INSERT on your Users_Master2 table, so you can preserve your current UserUID's when inserting your old data.

Then you'll need do a SELECT INSERT style statement to copy your data from Users_Master to Users_Master2.

Finally you need to turn IDENTITY_INSERT back off for Users_Master2.

The SQL should look something like this:
Code:
SET IDENTITY_INSERT [PS_UserData].[dbo].[Users_Master2] ON

INSERT INTO [PS_UserData].[dbo].[Users_Master2]
(
	[UserUID]
	,[UserID]
	,[Pw]
	,[CreatedDate]
	,[JoinDate]
	,[Admin]
	,[AdminLevel]
	[all the rest of YOUR column names...]
)
SELECT
	[UserUID]
	,[UserID]
	,[Pw]
	,[CreatedDate]
	,[JoinDate]
	,[Admin]
	,[AdminLevel]
	[all the rest of YOUR column names...]
FROM [PS_UserData].[dbo].[Users_Master]

SET IDENTITY_INSERT [PS_UserData].[dbo].[Users_Master2] OFF
*I changed a ton of column names in my Users_Master table and I don't have the original handy, so you'll have to provide your own column name list. An easy way to get the list is right-click on the table and choose "Select Top 1000 Rows". Cut and past the the column names from the generated SQL statement.

Now rename Users_Master to Users_Master3, and rename Users_Master2 to Users_Master.

You should now have Is Identity set on your Users_Master, will all your old data present

I did this so long ago that I totally forgot I had to do it that way.
abrasive is offline  
Thanks
6 Users
Old 01/18/2011, 16:01   #10
 
elite*gold: 0
Join Date: Jul 2010
Posts: 498
Received Thanks: 449
Well im trying on a clean usermaster (Test server, clean DB, Truncated char/account tables etc), I tested re creating the UserMaster table setting (IS indentity) to yes on UserUID but then it's the column RowID that doesnt wanna autoincrement. I tried to set them both with (IS indentity) on yes but it wont let me have this settings for both UserUID and RowID.

Only way i could insert data successfuly in the DB through the script is when i allow nulls on UserUID. I must be missing something.

The person co-owning the server with me cant help me at the moment, so i could use some help on setting this registration up.

Thanks again Abrasive and Zargon.

Code:
Warning: mssql_query() [function.mssql-query]: message: Cannot insert the value NULL into column 'RowID', table 'PS_UserData.dbo.Users_Master'; column does not allow nulls. INSERT fails. (severity 16) in C:\xampp\htdocs\register.php on line 80

Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\register.php on line 80
That's the error i get when auto increment is set on UserUID.

Re-Edit:
I allowed nulls on RowID and i can create an account. I was wondering how useful RowID is, Maybe i could just keep it that way.
Alladrios is offline  
Old 01/18/2011, 16:32   #11
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
I set the UserUID column as the primary key, and set it to Identity (auto increment). After that I deleted the RowID column because it is not needed when there is already a primary key in the table, nor is it referenced in any stored procedures.

Alternatively you could allow nulls in RowID, or give RowID a default value, if you didn't want to delete RowID.

You are not allowed to set multiple columns in the same table as Identity.
abrasive is offline  
Thanks
4 Users
Old 01/18/2011, 16:34   #12
 
elite*gold: 0
Join Date: Jul 2010
Posts: 498
Received Thanks: 449
Thanks a lot for the clarification, much appreciated. And thanks also for your script, it's gonna be a life saver right now.
Alladrios is offline  
Old 01/18/2011, 17:16   #13
 
ProfNerwosol's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 449
Received Thanks: 644
How about Guilds table? There's RowID as well and next GuildID is set similar to how UserUID was. Do you think RowID can be dropped and GuildID changed to Identity, Abrasive?
ProfNerwosol is offline  
Old 01/18/2011, 17:26   #14
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by ProfNerwosol View Post
How about Guilds table? There's RowID as well and next GuildID is set similar to how UserUID was. Do you think RowID can be dropped and GuildID changed to Identity, Abrasive?
That's how mine is set, however I don't think I've tried to create a guild since I made the change. I think it is likely to work that way, but be careful.
abrasive is offline  
Thanks
1 User
Old 01/20/2011, 19:02   #15
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
I tested guild creation after I removed the RowID from the Guild table and set GuildID to be the Identity column.

I was able to successfully create a guild, and see that it properly created it in the database. I restarted the server and logged in some toons from that guild and did not notice any side effects. Also GRB was successfully run multiple times with that change.

I don't think that change could affect anything other than guild creation anyways.

Quote:
Originally Posted by EarthCrush View Post
Hey! Don't break my db.... :'(
I only changed almost every table, and every database, hopefully for the better
abrasive is offline  
Thanks
1 User
Reply

Tags
mssql, php, script, shaiya script mssql sql


Similar Threads Similar Threads
[Release] SSE php Registration page script!
06/25/2013 - SRO PServer Guides & Releases - 38 Replies
Hello there, i'm not much using this forum, but as i recently helped out the owners of server G-Sro by making this automatic account registration page, decided to release for everyone. Hope you like it. For live preview go to: Demo Page DOWNLOAD LINK: http://www.multiupload.com/65ZMM3N7C0 Feel free to edit it however you want, but don't re-release it on other communities. Features:
[Release] Secure BHop Script
08/08/2010 - Counter-Strike Hacks, Bots, Cheats & Exploits - 5 Replies
You can't get banned for using this Script because it's only presses the Space button = no injection into the game = No VAC Ban + it's secured. Btw it's an Private BHop script so when you leech it please give the credits. Info: How to use press "^" to start and "^" to stop Virus Scan:
[Release] Simple CoEmu V2 - Registration Script
03/07/2010 - CO2 PServer Guides & Releases - 39 Replies
http://i42.tinypic.com/1qlcnd.png Download Simply open settings.php and edit it to your settings, and it'll run smoothly.
[RELEASE]Registration Script (ENG)
05/16/2009 - Dekaron Private Server - 12 Replies
I just created this registration script so enjoy. Unlike the others that are posted around, this one is built from the ground up by me. Enjoy and dont forget to say thanks! Uses mssql(); Please post your comments and suggestions!!!! Ill have more tools on the way. ~Quick tut to get it working~ 1. Download the rar 2. Extract it to a place where you can easily edit the files 3. Open up includes/db.php 4. Edit your information for your SQL server 5. Save and upload to a directory inside...



All times are GMT +2. The time now is 15:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.