Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 01:36

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

Advertisement



[Help] Register Page Mysql

Discussion on [Help] Register Page Mysql within the CO2 Private Server forum part of the Conquer Online 2 category.

Closed Thread
 
Old   #1
 
Beb0mn's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 42
Received Thanks: 5
[Help] Register Page Mysql

Greetings is been long time since I post here in the community. I was wondering if someone could help me out here, I am trying to edit a web page downloaded from elitepvpers (I searched for it and got a lot of sources but only one is doing what i really want which is a registration that identifies if the username exists or not and anti inject proof, as far as i know this one those the check for existing usernames, dont know about injection.) I have tried all possible ways including google, and even make up commands for mysql php codes and got nothing, the page loads but it wont send the values to the database.


If anyone please be so kind. db.config.php contains the database connection details, i know the one that needs to be fixed is this .php file to be launched

Thanks in advance.

P.S- Yes i have tried all the search results I get.
Beb0mn is offline  
Old 01/07/2014, 11:27   #2
 
Gerculy's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
I'm working on a script right now ( PDO ). If you are not in rush I might share it with you.
(Easy to use and secure)
Gerculy is offline  
Thanks
1 User
Old 01/07/2014, 16:17   #3
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
Here is one I wrote for

turk55 is offline  
Thanks
1 User
Old 01/07/2014, 16:27   #4
 
Beb0mn's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 42
Received Thanks: 5
Gerculy, thanks, Looking forward to see what you came up with. I have no rush.


turk55, I will try it as soon as I get home, is it ok if I PM you if I run into issues?
Beb0mn is offline  
Old 01/07/2014, 16:34   #5
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
Quote:
Originally Posted by Beb0mn View Post
Gerculy, thanks, Looking forward to see what you came up with. I have no rush.


turk55, I will try it as soon as I get home, is it ok if I PM you if I run into issues?
Sure and I just took a look on your script, at the username check you basically say if I can run the query the username exists. This is not how you should do it.

Code:
}elseif($row = mysql_query($stmt)){ 
            $errors[] = 'User name already exists, please choose a different user name.'; 
        }
Try this instead :
Code:
}elseif($row = mysql_query($stmt)){ 
            if(mysql_num_rows($row) > 0) {
				$errors[] = 'User name already exists, please choose a different user name.'; 
			}
        }
Not to mention you are using a question mark ("?") at the query but you are not filling it in any way plus the question mark is only used at prepared statements (the regular mysql library does not support prepared statements, mysqli does).

$sql = "SELECT Username FROM 'accounts' WHERE Username = ?";
TO:
$sql = "SELECT Username FROM 'accounts' WHERE Username = \"".$username."\"";
turk55 is offline  
Old 01/07/2014, 16:41   #6
 
Gerculy's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
Here's my ( Little simpler compared to Insomnius one's )

Config ..


Register Page [ PHP + HTML ]




It looks like this if you use Bootstrap.



Bootstrap CDN

Gerculy is offline  
Old 01/07/2014, 20:39   #7
 
Beb0mn's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 42
Received Thanks: 5
Quote:
Originally Posted by turk55 View Post
Sure and I just took a look on your script, at the username check you basically say if I can run the query the username exists. This is not how you should do it.

Code:
}elseif($row = mysql_query($stmt)){ 
            $errors[] = 'User name already exists, please choose a different user name.'; 
        }
Try this instead :
Code:
}elseif($row = mysql_query($stmt)){ 
            if(mysql_num_rows($row) > 0) {
				$errors[] = 'User name already exists, please choose a different user name.'; 
			}
        }
Not to mention you are using a question mark ("?") at the query but you are not filling it in any way plus the question mark is only used at prepared statements (the regular mysql library does not support prepared statements, mysqli does).

$sql = "SELECT Username FROM 'accounts' WHERE Username = ?";
TO:
$sql = "SELECT Username FROM 'accounts' WHERE Username = \"".$username."\"";
So all the other commands are ok except for the '?'? That source was from obdc database and i tried to change it to mysql. I dont know if the mysql calls are ok. I will do your sugestion as soon as i can.
Quote:
Originally Posted by Gerculy View Post
Here's my ( Little simpler compared to Insomnius one's )

Config ..


Register Page [ PHP + HTML ]




It looks like this if you use Bootstrap.



Bootstrap CDN

Sorry for the lack of knowledge, Do i add the bootstrap code on top of the php code in the same register page? Like style html code in html?

My thoughts are that i should since the register page is not making a call to a bootstrap.php, i just want to make sure.

Edit = I just realized everything goes in 1 uniqur register.php page. Nevermind the dumb question. I'm still wondering about the one below.

Also sorry for the demands, is it anti injection?
Beb0mn is offline  
Old 01/07/2014, 21:01   #8
 
Gerculy's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
Quote:
Originally Posted by Beb0mn View Post
Is it anti injection?
I did my best... Shouldn't have problems with it.
( A good hacker hacks anything )
Gerculy is offline  
Old 01/07/2014, 22:54   #9
 
Beb0mn's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 42
Received Thanks: 5
Ok this is what i have done so far

For the register.php that contains the form


I can fill out the information and then after the submit button is pressed he calls this page - registersucessfull.php

it says error in line 98.

If i combine both pages into one it just gives me error Please supply all data!, even if the form has been filled completely.
Beb0mn is offline  
Old 01/08/2014, 06:36   #10
 
Gerculy's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
Remove else { from the end of the page .
That should fix it.

--
You also can remove the connection to database from register.php ( It's useless )

and ?page=1 ( Line 29 )
Gerculy is offline  
Old 01/08/2014, 08:44   #11
 
Beb0mn's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 42
Received Thanks: 5
Thanks guys for the support

Thread can be close. Thank you again.
Beb0mn is offline  
Closed Thread


Similar Threads Similar Threads
[Guide]How to Program a Register Page (For MySql)
01/26/2012 - CO2 PServer Guides & Releases - 28 Replies
HTML Side Ok, in this guide im going to do my best to teach you how to make your own register page using PHP and a LITTLE of html. The first thing any register page needs is obviously the form, so thats what we will start with. To make a form, you will need to use HTML. So lets go ahead and make a new text file, and call it register.php (its .php because we will be using PHP inside of the file). The first thing to start a form, you need to make sure that the browser knows its a form in...
[HELP] MySql Register Page
08/04/2010 - CO2 Private Server - 2 Replies
Hey guys I have a small problem with my MySql register page. everytime I load the page the Account and Password box are already filled in with the username Admin and a password. My question is.... Does anyone know how to fix this? It also happens in flatfile sources as well! Any help would be much appreciated :) Thanks in advance
MySQL error for voting script & register page
04/27/2010 - Dekaron Private Server - 2 Replies
well this just happen it was working fine then it just went bad then the register page messed up to idk why it did this it was working fine for days then it just does this
[QUESTION]Making PhP working with MySQL, so i can make register page?
11/14/2009 - CO2 Private Server - 2 Replies
Title says all. How do i make PhP Scripts work with MySQL, so i can make a register page. Im totally noob at PhP. Only read some things for it on the net lol. Any mod, close this thread when i have got answers.



All times are GMT +1. The time now is 01:37.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.