Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 02:41

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

 

script account sqlsrv & php check before registering

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2010
Posts: 11
Received Thanks: 0
Exclamation script account sqlsrv & php check before registering

Good day friends , I 'm programming a code for registering new accounts , the code below works for me perfectly , but only need to do, check if the account exists, if the account exists give me a warning, else proceed with the registration.

thanks, waiting for answers = )

HTML Code:
<form action="reg.php" method="post" id="myform">

  <span style="text-align: center">
              <label for="login">Login</label>
  
  <input id="login" name="login" class="text" />
  </span>
    
      <span style="text-align: center">
      <label for="pass">Password</label>
      <input id="pass" name="pass" class="password" />
      </span>

      <span style="text-align: center">
      <input type="image" src="images/sendButton.png" class="send" />
      </span>
      <div class="clr"></div>

    </form>
PHP Code:
<?php
$login 
$_REQUEST["login"];
$pass $_REQUEST["pass"];
$md5_key '5dd23';
$endPw $md5_key $pass;
$md5 md5($endPw);

$serverName "localhost";   
$uid "admin";     
$pwd "123456789";    
$databaseName "auth";   

$connectionInfo = array( "UID"=>$uid,                              
                         
"PWD"=>$pwd,                              
                         
"Database"=>$databaseName);   

/* Connect using SQL Server Authentication. */    
$conn sqlsrv_connect$serverName$connectionInfo);    

$tsql "insert into dbo.Accounts (login_name, password, block, withdraw_remain_time, age, auth_ok, pcbang, last_login_server_idx, referral_id, referral_code, server_list_mask) values ('$login','$md5','0','0','18','1','1','1','0','0','0')";   

/* Execute the query. */    

$stmt sqlsrv_query$conn$tsql);    

if ( 
$stmt )    
{    
     
$something "Submission successful.";
}     
else     
{    
     
$something "Submission unsuccessful.";
     die( 
print_rsqlsrv_errors(), true));    
}
    
$output=$something;
/* Free statement and connection resources. */    
sqlsrv_free_stmt$stmt);    
sqlsrv_close$conn);
?>



gresk3k is offline  
Old   #2
 
elite*gold: 0
Join Date: Jan 2014
Posts: 182
Received Thanks: 45
Quote:
Originally Posted by gresk3k View Post
Good day friends , I 'm programming a code for registering new accounts , the code below works for me perfectly , but only need to do, check if the account exists, if the account exists give me a warning, else proceed with the registration.

thanks, waiting for answers = )

HTML Code:
<form action="reg.php" method="post" id="myform">

  <span style="text-align: center">
              <label for="login">Login</label>
  
  <input id="login" name="login" class="text" />
  </span>
    
      <span style="text-align: center">
      <label for="pass">Password</label>
      <input id="pass" name="pass" class="password" />
      </span>

      <span style="text-align: center">
      <input type="image" src="images/sendButton.png" class="send" />
      </span>
      <div class="clr"></div>

    </form>
PHP Code:
<?php
$login 
$_REQUEST["login"];
$pass $_REQUEST["pass"];
$md5_key '5dd23';
$endPw $md5_key $pass;
$md5 md5($endPw);

$serverName "localhost";   
$uid "admin";     
$pwd "123456789";    
$databaseName "auth";   

$connectionInfo = array( "UID"=>$uid,                              
                         
"PWD"=>$pwd,                              
                         
"Database"=>$databaseName);   

/* Connect using SQL Server Authentication. */    
$conn sqlsrv_connect$serverName$connectionInfo);    

$tsql "insert into dbo.Accounts (login_name, password, block, withdraw_remain_time, age, auth_ok, pcbang, last_login_server_idx, referral_id, referral_code, server_list_mask) values ('$login','$md5','0','0','18','1','1','1','0','0','0')";   

/* Execute the query. */    

$stmt sqlsrv_query$conn$tsql);    

if ( 
$stmt )    
{    
     
$something "Submission successful.";
}     
else     
{    
     
$something "Submission unsuccessful.";
     die( 
print_rsqlsrv_errors(), true));    
}
    
$output=$something;
/* Free statement and connection resources. */    
sqlsrv_free_stmt$stmt);    
sqlsrv_close$conn);
?>
U need to put an select query in it too which will check if account exists. And this script is not save about sql injections.

Tomorrow when im at my pc i will writte here my old php script.


g_d_dragon is offline  
Thanks
1 User
Old   #3


 
elite*gold: 30
Join Date: May 2011
Posts: 4,801
Received Thanks: 3,181
Try to use something like mysql_escape_string() (not the best solution tho) at least before inserting into the database.
I could get access to your server in a second if you keep it like that.
You should read about
Xijezu is offline  
Thanks
1 User
Old   #4
 
elite*gold: 0
Join Date: Apr 2010
Posts: 11
Received Thanks: 0
Quote:
Originally Posted by g_d_dragon View Post
U need to put an select query in it too which will check if account exists. And this script is not save about sql injections.

Tomorrow when im at my pc i will writte here my old php script.
ok bro ty and please post here your script ty again


gresk3k is offline  
Old   #5
 
elite*gold: 0
Join Date: Jan 2014
Posts: 182
Received Thanks: 45
heres my Old PHP Regi, it was made with mssql plugin and it worked for me with xampp 1.7. u will need to change the mssql_paras.

You need the PHP Connection and HTML + PHP Code in the same Editor File

PHP Connection:
PHP Code:
<?php 
    
    $host 
"IP"// your sql instance 
    
$user "DBuser"// username 
    
$pw "DBpwd"// password 
    
$db "DB"// db 
    
$md5_key "Salt"// your md5 key 
     
    
$connect mssql_connect($host,$user,$pw
    or die(
"Can't connect to the datebase."); 
     
    
mssql_select_db($db,$connect
    or die(
"Can't select the datebase"); 

    
session_start();
?>
HTML + PHP Code:
HTML Code:
<html> 
  <head> 
    <title>Rappelz Dragon Server</title> 
    <center> 
    <h3 style="color:red">Rappelz Dragon: Register Page</h3>  
		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<style type="text/css">#error {color:#ff0000; list-style:none;}</style>
    <form action="<?php echo $_SERVER['Registration.php']; ?>" method="POST"> 
      <div style="width:436px; border:1px solid #000000; padding:16px;">
		<body><strong><img src="drache01.jpeg" width="400" height="300" align="middle"></strong></body>
		<div style="height: 5px;">&nbsp;</div>
				Username
				<input name="username" value="<?php if(isset($_POST['username'])){ echo $_POST['username']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>
				Password							
				<input name="password" type="password" value="<?php if(isset($_POST['password'])){ echo $_POST['password']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>
				Confirm password							
				<input name="password2" type="password" value="<?php if(isset($_POST['password2'])){ echo $_POST['password2']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>	
				Please enter the captcha code
				<div style="height: 5px;">&nbsp;</div>
				<img src="captcha.php" alt="Captcha" title="Please type this in the text box below to prove you are human" width=140 height=40 />
				<input type="text" name="captcha_code" size=10 />
				<div style="height: 5px;">&nbsp;</div>
				<input type="submit" value="Create Account" />
	   </div>
    </form>
    <?php 
	
		$user_ip = $_SERVER['REMOTE_ADDR'];
		$usr = isset($_POST['username']) ? trim($_POST['username']) : '';
		$pass = isset($_POST['password']) ? trim($_POST['password']) : '';
		$pass2 = isset($_POST['password2']) ? trim($_POST['password2']) : '';
		$endPw = $md5_key . $pass; 
		$md5 = md5($endPw); 
        $results = mssql_query("SELECT * FROM dbo.Account WHERE '$usr' LIKE login_name"); 
		$res = mssql_num_rows($results); 
		
						// Check if fiel Username is empty
						if(trim($usr) == true)
{						// Lenght for Username (4 - 16)
						if(strlen($usr) > 3 && strlen($usr) < 16)
 {						// Check if fiel Password is empty
						if(ctype_alnum($usr) === true)
  {						// Only Numbers and Letters
						if(trim($pass) == true)
	{					// Lenght for Password (4 - 16)
						if(strlen($pass) > 5 && strlen($pass) < 16)
	 {					// Only Numbers and Letters
						if(ctype_alnum($pass) === true)
	  {					// Check if Passwords match
						if($pass == $pass2)
		{				// Checking Captcha
						if ($_POST['captcha_code'] == $_SESSION['captcha_spam']) 
		 {				// Checking if Account already exists
						if($res > 0) 
							{echo "Account exists !";} 
							else 
						{mssql_query("INSERT INTO dbo.Account(login_name,password,referral_id,referral_code,pcbang,block,withdraw_remain_time,age,auth_ok,last_login_server_idx,event_code,server_list_mask,result,ip,game_code,gamecode,login_event) VALUES('$usr','$md5',0,0,0,0,0,18,1,0,0,0,0,0,0,0,0)"); 
							echo "Registration success !";} 
		}			 		else
							{echo "Wrong captcha code.";} 
	   }					else
							{echo "Passwords do not match.";}
	  }						else
							{echo "Password must consist of numbers and letters only.";}
	 }						else 
							{echo "Password must be between 6 and 16 characters in length.";} 
	}						else
							{echo "Please provide a password.";}
   }						else
							{echo "Username must consist of numbers and letters only.";}
 }							else
							{echo "Username must be between 4 and 16 characters in length.";}		
}							else
							{echo "Please provide a username.";}
    ?> 
    </center> 
  </head> 
</html>
g_d_dragon is offline  
Old   #6
 
elite*gold: 0
Join Date: Jun 2015
Posts: 100
Received Thanks: 45
I'd rather use .
Leqendary is offline  
Old   #7
 
elite*gold: 0
Join Date: Apr 2010
Posts: 11
Received Thanks: 0
Quote:
Originally Posted by g_d_dragon View Post
heres my Old PHP Regi, it was made with mssql plugin and it worked for me with xampp 1.7. u will need to change the mssql_paras.

You need the PHP Connection and HTML + PHP Code in the same Editor File

PHP Connection:
PHP Code:
<?php 
    
    $host 
"IP"// your sql instance 
    
$user "DBuser"// username 
    
$pw "DBpwd"// password 
    
$db "DB"// db 
    
$md5_key "Salt"// your md5 key 
     
    
$connect mssql_connect($host,$user,$pw
    or die(
"Can't connect to the datebase."); 
     
    
mssql_select_db($db,$connect
    or die(
"Can't select the datebase"); 

    
session_start();
?>
HTML + PHP Code:
HTML Code:
<html> 
  <head> 
    <title>Rappelz Dragon Server</title> 
    <center> 
    <h3 style="color:red">Rappelz Dragon: Register Page</h3>  
		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<style type="text/css">#error {color:#ff0000; list-style:none;}</style>
    <form action="<?php echo $_SERVER['Registration.php']; ?>" method="POST"> 
      <div style="width:436px; border:1px solid #000000; padding:16px;">
		<body><strong><img src="drache01.jpeg" width="400" height="300" align="middle"></strong></body>
		<div style="height: 5px;">&nbsp;</div>
				Username
				<input name="username" value="<?php if(isset($_POST['username'])){ echo $_POST['username']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>
				Password							
				<input name="password" type="password" value="<?php if(isset($_POST['password'])){ echo $_POST['password']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>
				Confirm password							
				<input name="password2" type="password" value="<?php if(isset($_POST['password2'])){ echo $_POST['password2']; } ?>" style="width:100%;" />
				<div style="height: 5px;">&nbsp;</div>	
				Please enter the captcha code
				<div style="height: 5px;">&nbsp;</div>
				<img src="captcha.php" alt="Captcha" title="Please type this in the text box below to prove you are human" width=140 height=40 />
				<input type="text" name="captcha_code" size=10 />
				<div style="height: 5px;">&nbsp;</div>
				<input type="submit" value="Create Account" />
	   </div>
    </form>
    <?php 
	
		$user_ip = $_SERVER['REMOTE_ADDR'];
		$usr = isset($_POST['username']) ? trim($_POST['username']) : '';
		$pass = isset($_POST['password']) ? trim($_POST['password']) : '';
		$pass2 = isset($_POST['password2']) ? trim($_POST['password2']) : '';
		$endPw = $md5_key . $pass; 
		$md5 = md5($endPw); 
        $results = mssql_query("SELECT * FROM dbo.Account WHERE '$usr' LIKE login_name"); 
		$res = mssql_num_rows($results); 
		
						// Check if fiel Username is empty
						if(trim($usr) == true)
{						// Lenght for Username (4 - 16)
						if(strlen($usr) > 3 && strlen($usr) < 16)
 {						// Check if fiel Password is empty
						if(ctype_alnum($usr) === true)
  {						// Only Numbers and Letters
						if(trim($pass) == true)
	{					// Lenght for Password (4 - 16)
						if(strlen($pass) > 5 && strlen($pass) < 16)
	 {					// Only Numbers and Letters
						if(ctype_alnum($pass) === true)
	  {					// Check if Passwords match
						if($pass == $pass2)
		{				// Checking Captcha
						if ($_POST['captcha_code'] == $_SESSION['captcha_spam']) 
		 {				// Checking if Account already exists
						if($res > 0) 
							{echo "Account exists !";} 
							else 
						{mssql_query("INSERT INTO dbo.Account(login_name,password,referral_id,referral_code,pcbang,block,withdraw_remain_time,age,auth_ok,last_login_server_idx,event_code,server_list_mask,result,ip,game_code,gamecode,login_event) VALUES('$usr','$md5',0,0,0,0,0,18,1,0,0,0,0,0,0,0,0)"); 
							echo "Registration success !";} 
		}			 		else
							{echo "Wrong captcha code.";} 
	   }					else
							{echo "Passwords do not match.";}
	  }						else
							{echo "Password must consist of numbers and letters only.";}
	 }						else 
							{echo "Password must be between 6 and 16 characters in length.";} 
	}						else
							{echo "Please provide a password.";}
   }						else
							{echo "Username must consist of numbers and letters only.";}
 }							else
							{echo "Username must be between 4 and 16 characters in length.";}		
}							else
							{echo "Please provide a username.";}
    ?> 
    </center> 
  </head> 
</html>
can you post the code modified to sqlsrv paras???


gresk3k is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[RELEASE]PHP 5.4/PHP Driver 3.0(SQLSRV) Account Registration Module
Hello Community, Today during some of my free time I was organizing some of my older projects that I plan to revise or revamp. I have long since...
21 Replies - Rappelz Private Server
[Question]Script Check Please..Need a Prof.To Check This Script!
Hello guys.. I want some of you to check this script and tell me if it works..or if there is any thing has to be modified or so... It's a log...
6 Replies - SRO PServer - Discussions / Questions
[ADVANCED] Registration Script / SQLSRV
-- Forewarning -- The following is in no way shape or form intended for the use of beginners and requires basic and intermediate skill levels to...
30 Replies - Rappelz Private Server
Registering an account<--
delted
0 Replies - Dekaron Private Server



All times are GMT +2. The time now is 02:41.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.