Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

register script problem

Junior Spellweaver
Joined
Jun 24, 2010
Messages
139
Reaction score
5
I have a register page but for some reason it wont register the account and when i click register it sends me to a blank page and says nothing how do i go about fixing this? thank you in advance

here's the script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
/* Copyright 2011 Aaron Roderigues */
function doesUsernameExist($name){
$exit = FALSE;
$result = @mssql_query("SELECT * FROM dbo.ACCOUNT_TBL WHERE account='$name'");
if(mssql_num_rows($result) != 0){
$exit = TRUE;
}
return $exit;
}
function cl($info){
return strtolower(preg_replace("|[^\w]|", "", $info));
}
function check_email($email){
$exit = FALSE;
if(filter_var($email, FILTER_VALIDATE_EMAIL)){
return $exit = TRUE;
}
else {
return $exit;
}
}

if(isset($_POST['submit'])){
/* Start editing */
$salt = "serus";
$link = @mssql_connect("STANLEY-PC\SQLEXPRESS", "sa", "root") or die ("Server is down!");
$db = @mssql_select_db('ACCOUNT_DBF') or die ("Accout table is missing!");
/* */
$username = cl($_POST['username']);
$password = cl($_POST['password']);
$password_hashed = md5($salt.$password);
$birthdate = $_POST['month']."/".$_POST['day']."/".$_POST['year'];

if(empty($username) || strlen($username) > 15){
echo "Problem with your username.";
exit();
}
else if(empty($password) || strlen($password) > 36){
echo "Problem with your password.";
exit();
}
else if(empty($_POST['email']) || !check_email($_POST['email'])){
echo "Problem with your email.";
exit();
}
else if(empty($_POST['month']) || empty($_POST['day']) || empty($_POST['year']) || strlen($_POST['month']) > 2 || strlen($_POST['day']) > 2 || strlen($_POST['year']) != 4 || !is_numeric($_POST['month']) || !is_numeric($_POST['day']) || !is_numeric($_POST['year'])){
echo "Problem with your birthdate.";
exit();
}
else if(doesUsernameExist($username)){
echo "Username already exists.";
exit();
}
/* Passed everything, so lets create the account. */
$stmt = mssql_init('dbo.webCreateAcc', $link);
mssql_bind($stmt, '@account', $username, SQLVARCHAR, false, false, 15);
mssql_bind($stmt, '@password', $password_hashed, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@birthday', $birthdate, SQLVARCHAR, false, false, 120);
mssql_bind($stmt, '@email', $_POST['email'], SQLVARCHAR, false, false, 120);
mssql_execute($stmt) or die ("Something is wrong on the execution.");
mssql_free_statement($stmt);
echo "User account created for: ".$username;
mssql_close($link);
exit();
}
?>
<!DOCTYPE html>
<html>
<body>
<div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr>
<td>Username:</td>
<td><input size="20" name="username" maxlength="15" type="text" /></td>
<td>(A-Z, a-z, 1-9)</td>
</tr>
<tr>
<td>Password:</td>
<td><input size="20" name="password" maxlength="35" type="password" /></td>
<td>(A-Z, a-z, 1-9)</td>
</tr>
<tr>
<td>Email:</td>
<td><input size="20" name="email" maxlength="255" type="text" /></td>
</tr>
<tr>
<td>Birthday:</td>
<td>
<input size="1" name="month" maxlength="2" type="text" placeholder="MM" />
<input size="1" name="day" maxlength="2" type="text" placeholder="DD" />
<input size="3" name="year" maxlength="4" type="text" placeholder="YYYY" />
</td>
</tr>
</table>
<input type="submit" name="submit" value="register" />
</form>
</div>
</body>
</html>
 
Junior Spellweaver
Joined
Jun 24, 2010
Messages
139
Reaction score
5
yes v15 do i need to change

$stmt = mssql_init('dbo.webCreateAcc', $link);

to:

$stmt = mssql_init('usp_CreateNewAccount', $link);
 
Junior Spellweaver
Joined
Jun 11, 2008
Messages
152
Reaction score
0
hmm, remove , $link at the end,

I think that worked for another person with the same problem..
yea it was me so you need to make a new db thingi for registration and change the name and then change name in the script and it will work yayiii :p
 
Back
Top