Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Private Server
You last visited: Today at 11:35

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

Advertisement



problem in the registration page ~ duplicated usernames

Discussion on problem in the registration page ~ duplicated usernames within the SRO Private Server forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2012
Posts: 30
Received Thanks: 0
problem in the registration page ~ duplicated usernames

I'm using the simple registration page, but I notice that you can register the same username as many as you want, it doesn't give you a message that this username already registered and it accepts any username and it gets duplicated in the database _User. May I know how to fix this problem?

Thx

Code:
<?php
	session_start();
	$server_name = "TesT SrO";             // Server name;
	$host 		 = "10.5.70.17";          // SQL server name for example PC-NAME\SQLEXPRESS
	$user 		 = "sa";                 // SQL username
	$pass		 = "bahaa";             // SQL password
	$db  		 = "SRO_VT_ACCOUNT";   // SQL Database
	$home		 = "";                // If you want to reditect after register write your hame page link here if not keep it empty.
	$silk 		 = "5000";           // Start silk amount.
	$gold		 = "1000000";		// User start gold on storage
	@$ip 		 = $_SERVER['REMOTE_ADDR']; // Don't change it
	@$connect = odbc_connect("Driver={SQL Server};Server={".$host."}; Database={".$db."}", "".$user."", "".$pass."") or die("<center><b style=\"border:1px dashed #FF0000;\">".str_replace("[Microsoft][ODBC SQL Server Driver][SQL Server]", "", odbc_errormsg())."</b></center>");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<!-- Coded by ThElitEyeS -->
	<head>
		<title><?php echo $server_name; ?></title>
		<script type="text/javascript" src="items/jquery.js" ></script>
		<script type="text/javascript">
			eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6 e(){4 1="#e";4 h=$(g).7();4 c=$(3).a();$(\'#5\').b({\'a\':c,\'7\':h});$(\'#5\').d(s);$(\'#5\').t("u",0.8);4 f=$(3).7();4 l=$(3).a();$(1).b(\'m\',f/2-$(1).7()/2);$(1).b(\'o\',l/2-$(1).a()/2);$(1).d(p);i j}$(g).q(6(){$(\'.3 #r\').k(6(){$(\'#5\').9();$(\'.3\').9();i j});$(\'#5\').k(6(){$(n).9();$(\'.3\').9()})});',31,31,'|id||window|var|mask|function|height||hide|width|css|maskWidth|fadeIn|dialog|winH|document|maskHeight|return|false|click|winW|top|this|left|2000|ready|close|1000|fadeTo|slow'.split('|'),0,{}));
		</script>
		<style type="text/css">
			<!--
			
			body {
				text-align: center;
				margin: 0 auto;
				margin-top: 10px;
				cursor: default;
			}
			
			table {
				width: 400px;
				font-size: 11px;
				font-family: Verdana, Arial, Helvetica, sans-serif;
				margin: 0 auto;
				background-color: #F1F1F1;
				border: 3px double #CCC;
			}
			
			input {
				width: 100%;
				cursor: default;
			}
			
			select {
				width: 100%;
			}
			
			input[type=text]:hover, input[type=password]:hover {
				border: 1px solid #000;
			}
			
			img {
				border: none;
			}
			
			a {
				color: #333;
				text-decoration: none;
			}
			
			a:hover {
				text-decoration: underline;
			}
			
			@font-face {
				font-family: "sro";
				src: url(items/Silkroad.ttf);
			}
			
			.title {
				text-align: center;
				border: 1px solid #000;
				padding: 4px;font-weight: bold;
				font-family: sro;
				font-size: 20px;
				font-style: italic;
			}
			
			.code, .copy {
				-webkit-user-select: none;
				-khtml-user-select: none;
				-moz-user-select: none;
				-o-user-select: none;
				user-select: none;
				font-weight: bold;
			}
			
			.copy {
				text-align: center;
			}
			
			#mask {
				position:absolute;
				left:0;
				top:0;
				z-index:9000;
				background-color:#000;
				display:none;
			}
			  
			#boxes .window {
				position:absolute;
				left:0;
				top:0;
				width:440px;
				height:200px;
				display:none;
				z-index:9999;
				padding:20px;
			}

			#boxes #dialog {
				text-align: left;
				font-size: 11px;
				font-family: Verdana, Arial, Helvetica, sans-serif;
				width:275px; 
				height:103px;
				min-height: 103px;
				height: auto !important;
				padding:10px;
				border: 2px solid #000;
				color: #000;
				background-color:#F1F1F1;
			}

			#close {
				float: right;
				cursor: pointer;
				font-weight: bold;
				color: #000;
			}

			#close:hover {
				color: #FF0000;
			}
			
			!-->
		</style>

		<!--[if IE]>
			<style type="text/css" >
				@font-face {
					font-family: "sro";
					src: url(items/Silkroad.eot);
				}
			</style>
		<![endif]-->
		
	</head>
	<body>
		<form method="POST">
			<table>
				<tr>
					<td class="title" colspan="2"><?php echo $server_name; ?></td>
				</tr>
				<tr>
					<td align="left">Username:</td><td align="right">6-16 Long (Characters A-Z,a-z 0-9) </td>
				</tr>
				<tr>
					<td colspan="2"><input type="text" name="user" value="<?php if (isset($_POST["user"])) {
						echo $_POST["user"];
					} ?>" /></td>
				</tr>
				<tr>
					<td align="left">Password:</td><td align="right">6-16 Long (Characters A-Z,a-z 0-9) </td>
				</tr>
				<tr>
					<td colspan="2"><input type="password" name="password" /></td>
				</tr>
				<tr>
					<td colspan="2" align="left">Confirm Password:</td>
				</tr>
				<tr>
					<td colspan="2"><input type="password" name="password1" /></td>
				</tr>
				<tr>
					<td align="left">E-mail:</td><td align="right">Should be Vaild</td>
				</tr>
				<tr>
					<td colspan="2"><input type="text" name="email" value="<?php if (isset($_POST["email"])) {
						echo $_POST["email"];
					} ?>" /></td>
				</tr>
				<tr>
					<td colspan="2" align="left">Confirm E-mail</td>
				</tr>
				<tr>
					<td colspan="2"><input type="text" name="email1" /></td>
				</tr>
				<tr>
					<td align="left">Name</td>
				</tr>
				<tr>
					<td colspan="2"><input type="text" name="name" value="<?php if (isset($_POST["name"])) {
						echo $_POST["name"];
					} ?>" /></td>
				</tr>
				<tr>
					<td align="left">Sex</td>
				</tr>
				<tr>
					<td colspan="2">
						<select name="sex">
							<option>Select</option>
							<option value="1" <?php 
								if (isset($_POST["sex"])) {
									if ($_POST["sex"] == 1) {
										echo "
											selected
										";
									}
								}
							?> >Male</option>
							<option value="2" <?php 
								if (isset($_POST["sex"])) {
									if ($_POST["sex"] == 2) {
										echo "
											selected
										";
									}
								}
							?> >Female</option>
						</select>
					</td>
				</tr>
				<tr>
					<td align="left">Code</td>
					<td  onselectstart="return false;" class="code" align="right"><img src="items/captcha.php" alt="Captcha code" /></td>
				</tr>
				<tr>
					<td colspan="2"><input type="text" name="code" /></td>
				</tr>
				<tr>
					<td colspan="2"><input type="submit" name="go" value="Register" /></td>
				</tr>	
				<tr>
					<td onselectstart="return false;" class="copy" colspan="2" >&copy; <?php echo $server_name; ?> Powered by <a href="http://clicktocheck.net">&#67;&#108;&#105;&#99;&#75;&#84;&#79;&#67;&#104;&#101;&#99;&#75;&#46;&#110;&#101;&#116;</a></td>
				</tr>
			</table>
		</form>
		<?php
			if(isset($_POST["go"])){
				foreach ($_POST as $key => $protect) {
					$_POST[$key] = addslashes($protect);
				}
				$user     = $_POST["user"];
				$password = $_POST["password"];
				$password1= $_POST["password1"];
				$email    = $_POST["email"];
				$email1   = $_POST["email1"];
				$name     = $_POST["name"];
				$sex      = $_POST["sex"];
				$code     = $_POST["code"];
				if(!$user) {
					$error[]="Please fill username input.";
				} else {
					if(strlen($user) < 6)   $error[] = "Username too short.";
					if(strlen($user) > 16)  $error[] = "Username too long.";
					if(!ctype_alnum($user)) $error[] = "Username should be Characters and Numbers only.";
				}
				
				if(!$password) {
					$error[]= "Please fill password input";
				} else {
					if(strlen($password) < 6)   $error[] = "Password too short.";
					if(strlen($password) > 32)  $error[] = "Password too long.";
					if(!ctype_alnum($password)) $error[] = "Password should be Characters and Numbers only.";
				}
				
				if(!$password1) {
					$error[]="Please fill confirm password input.";
				} else {
					if(strlen($password1) < 6)  $error[] = "Confirm Password too short.";
					if(strlen($password1) > 32) $error[] = "Confirm Password too long.";
				}
				
				if ($password && $password1) {
					if($password !== $password1){$error[] = "Passwords are not the same";}
				}
				
				if(!$email) {
					$error[]="Please fill E-mail input";
				}
				if(!$email1) {
					$error[]="Please fill confirm  E-mail input";
				}
				if ($email && $email1) {
					if(!filter_var($email, FILTER_VALIDATE_EMAIL)) $error[]= "E-mail is not valid";
					if($email !== $email1){$error[] = "E-mails are not the same";}
				}
				if(!$name) {
					$error[]="Please fill name input";
				} else {
					if(!ctype_alnum($name)) $error[] = "Name should be Characters and Numbers only";
				}
				if(!$sex) {
					$error[]="Please choose sex";
				} else {
					if(!ctype_alnum($sex)) $error[] = "Sex should be Characters and Numbers only";
					if ($sex > 2 || $sex < 0) {
						$error[] = "There some thing wrong with sex!";
					} else {
						if ($sex == 1) {
							$sex = "M";
						} else if ($sex == 2) {
							$sex = "F";
						}
					}
				}
				if(!$code) {
					$error[]="Please fill code input";
				} else {
					if($code != $_SESSION["captcha"]){$error[]= "Wrong captcha Code !";}
				}
				
				$check = odbc_exec($connect, "SELECT * FROM TB_User WHERE StrUserID = '".$user."'");
				if (odbc_num_rows($check) > 0) {
					$error[] = "Account with such username already exists please chose another one";
				}
				
				if (@count($error) > 0) {
					echo "
					<div id=\"boxes\">
						<div id=\"dialog\" class=\"window\">
							<b style=\"float:left;\">Message</b><div title=\"close\" id=\"close\">X</div><br /><hr />
							<div class=\"content\">
								<ol>
					";
					for($e=0;$e<count($error);$e++) {
						echo "
							<li>".$error[$e]."</li>
						";
					}
					echo "
									</ol>
								</div>
							</div>
							<div id=\"mask\"></div>
						</div>
						<script type=\"text/javascript\">
							dialog();
						</script>
					";
				} else {
					@$register = odbc_exec($connect, "INSERT INTO TB_User(StrUserID, password, Name, Email, sex, reg_ip, sec_primary, sec_content) VALUES ('".$user."', '".md5($password)."', '".$name."', '".$email."', '".$sex."', '".$ip."', '3', '3')");
					if ($register) {
						
						$find = odbc_fetch_array(odbc_exec($connect, "SELECT * FROM TB_User WHERE StrUserID = '".$user."'"));
						$gift = $find["JID"];
						odbc_exec($connect, "INSERT INTO SK_Silk(JID, silk_own) VALUES (".$gift.", ".$silk.")");
						odbc_exec($connect, "USE SRO_VT_SHARD INSERT INTO _AccountJID(AccountID, JID, Gold) VALUES ('".$user."',".$gift.", ".$gold.")");
						echo "
							<script type=\"text/javascript\">
								alert(\"Register complete\");
							</script>
						";
						
						if ($home != "") {
							echo "
								<script type=\"text/javascript\">
									window.location = \"".$home."\";
								</script>
							";
						}
						
					} else {
						echo odbc_errormsg();
					}
				}
			
			}
		?>
	</body>
</html>
elitebi is offline  
Reply


Similar Threads Similar Threads
Registration page problem
02/01/2012 - Shaiya Private Server - 5 Replies
Hi, i have a problem with my registration page. This message appear: Failed to create a new account, please try again later My sql database informations in the config file are correct. WampServer is online. Please help me, thanks.
Registration page problem.
10/19/2011 - SRO Private Server - 1 Replies
I made a new registration page, but I get this error: Fatal error: Call to undefined function: filter_var() in c:\appserv\www\reg.php on line 175 This is line 175: if(!filter_var($email, FILTER_VALIDATE_EMAIL)){$error= "E-mail is not valid";}
Registration page problem
09/19/2011 - SRO Private Server - 3 Replies
I installed XAMPP with apache server and PHP 5.3 but my registration page doesn't work, i get this blank page: http://i52.tinypic.com/2dr51qp.png what should i do? mssql extensions are enabled in php.ini
[help] Problem Make Registration Page
10/13/2008 - CO2 Private Server - 1 Replies
you do to help yourself, it reports the registration page like this, ACC should not be saved http://forum.ragezone.com/attachment.php?attachme ntid=60969&stc=1&d=1223877869



All times are GMT +2. The time now is 11:35.


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.