Jump to content

Skyfire's Account Registration


Jonathan

Recommended Posts

  • 4 weeks later...

Very nice but I got the following errors when I tried to use the register.

I edited the config.php correctly and ran it on my XAMPP server.

Maybe someone else can confirm so I know it's not just me.

Notice: Use of undefined constant db_host - assumed 'db_host' in C:\xampp\htdocs\wow\skyfire\restbhdn78874523dffs.php on line 5

Notice: Use of undefined constant db_username - assumed 'db_username' in C:\xampp\htdocs\wow\skyfire\restbhdn78874523dffs.php on line 6

Notice: Use of undefined constant db_password - assumed 'db_password' in C:\xampp\htdocs\wow\skyfire\restbhdn78874523dffs.php on line 7

Notice: Use of undefined constant db_name - assumed 'db_name' in C:\xampp\htdocs\wow\skyfire\restbhdn78874523dffs.php on line 8

Notice: Undefined index: registration in C:\xampp\htdocs\wow\skyfire\restbhdn78874523dffs.php on line 36

Also going to add the script I use.

(Even more) Minimalistic

Found and copied from another forum. Forgot who made it. I take no credit. Added & fix a few things.

You can change all the '3' to your specific minimal username length. (Be careful if you use Find and Replace.)

You can change all the '5' to your specific minimal password length. (Be careful if you use Find and Replace.)

<?php
$host		= "localhost";	//Your servers IP address
$port		= "3306";	//Your servers port
$user		= "root";	//Your database username 
$pass		= "pass";	//Your database password 
$auth		= "auth";	//Your auth database
$realmlist	= "login.server.com";	//This will show up and remind the user the change their realmlist.wtf upon completion. 

$realmd = array( 
'db_host'=> $host, 
'db_username' => $user, 
'db_password' => $pass, 
'db_name'=> $auth, 
);

function check_for_symbols($string){
	$len=strlen($string);
	$allowed_chars="abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ0123456789";
	for($i=0;$i<$len;$i++)if(!strstr($allowed_chars,$string[$i]))return TRUE;
	return FALSE;
}

function sha_password($username,$password){
	$username = strtoupper($username);
	$password = strtoupper($password);
	return SHA1($username.':'.$password);
}

if ($_POST['registration']){
	$realmd_bc_new_connect = mysql_connect($realmd['db_host'],$realmd['db_username'],$realmd['db_password']);
	$selectdb = mysql_select_db($realmd['db_name'],$realmd_bc_new_connect);
	if (!$realmd_bc_new_connect || !$selectdb){ die("<p align='center'>Error:<br><br>Something went wrong while connecting to the database.<br><br>Please make sure the config.php file is correct.</p>"); }

	$username = $_POST['username'];
	$password = $_POST['password'];
	$confirm  = $_POST['confirm'];
	$username1 = $username;
	$password1 = sha_password($username1,$_POST['password']);
	$email1 = $_POST['email'];
	$email = $email1;

	if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ die("<p align='center'>Error:<br><br>Your e-mail is not valid!<br><br>It has to be in *@*.* format to be valid.<br><br>Please go back and try again.</p>"); }

	if($password != $confirm){ die("<p align='center'>Error:<br><br>It appears your passwords didn&#146t match!<br><br>Please go back and try again.</p>"); }

//You can change all the '3' to your specific minimal username length.
	if(strlen($_POST['username']) < 3){
		$chars = strlen($username);
		die("<p align='center'>Error:<br><br>Your username is too short!<br><br>You entered ".$chars." character(s).<br><br>The minimum length is 3 characters and the maximum length is 15.<br><br>Please go back and try again.</p>");
	}
//You can change all the '5' to your specific minimal password length.
	if(strlen($_POST['password']) < 5){
		$chars = strlen($password);
		die("<p align='center'>Error:<br><br>Your password is too short!<br><br>You entered ".$chars." character(s).<br><br>The minimum length is 5 characters and the maximum length is 15.<br><br>Please go back and try again.</p>");
	}

	if (check_for_symbols($_POST['password']) == TRUE || check_for_symbols($username1) == TRUE) { die("<p align='center'><br><br>You are using characters not allowed in your username or password!<br><br>Please go back and try again.</p>"); }

	$qry_check_username = mysql_query("SELECT username FROM account WHERE username='$username'");
	$qry_check_email = mysql_query("SELECT email FROM account WHERE email='$email'");

	if (mysql_num_rows($qry_check_username) != 0){ die("<p align='center'>Error:<br><br>Your username is already in use!<br><br>Please go back and try again.</p>"); }
	if (mysql_num_rows($qry_check_email) != 0){ die("<p align='center'>Error:<br><br>Your e-mail is already in use!<br><br>Please go back and try again.</p>"); }

	else{
		mysql_query("INSERT INTO account (username,sha_pass_hash,email,expansion) VALUES ('$username1','$password1','$email1','3')");
		die("<p align='center'>Your account <b>".$username1."</b> has been successfully added to the database!<br><br>Make sure you change your realmlist.wtf file to:<br><br><b>set realmlist ".$realmlist."</b><br><br>Please contact one of the staff members if you're having difficulties loggin in after 5-10 minutes.</p>");
	}
}
else{
?>

<html>
<head>
<title>WoW - Account Creator</title>
</head>
<body>
<center><h1><u><b>Account Creator</b></u></h1><br>

INSERT TERMS OF AGREEMENT AND RULES HERE

<form autocomplete="off" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
Username:<br><input type="text" name="username"><br><small>(3 or more characters)</small><br><br>
Password:<br><input type="password" name="password"><br><small>(5 or more characters)</small><br><br>
Confirm Password:<br><input type="password" name="confirm"><br><br>
E-mail Address:<br><input type="text" name="email"><br><br>
<input value="By clicking this you accept the Terms of Agreement and to abide by all rules stated above." class="submit" type="submit" name="registration">
</form></center>
</body>
</html>

<?php
}
?>
Link to comment
Share on other sites

  • 2 weeks later...

Not to mention it's not good for your server.. Every time a user visits the homepage it does at least 12 queries to your character database just to get info on the amount of race-specific characters.. The error is because of the usage of constants in an array. This script is also viable to sql-injection, so i wouldn't use it..

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.