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!

Another register page for official files

Newbie Spellweaver
Joined
May 12, 2008
Messages
25
Reaction score
7
Code:
<?php
	$MD5Code = "kikugalanet"; // Your Neuz MD5 Code
	$dbAddr = "127.0.0.1"; // Your MSSQL Host IP
	$dbName = "ACCOUNT_DBF"; // Your Account Database
	$dbUser = "sa"; // Your Database user
	$dbPass = ""; // Your Database User password

	if(!extension_loaded("mssql")) {
		echo "The MSSQL extension is not enabled on your PHP. Enable it on your php.ini and try again.";
		exit();
	}
?>
<!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" dir="ltr" lang="en">
<head>
<title>Fly For Fun :: Official Files Simple Register Page</title>
</head>
<body>
	<?php
		function cleanFormData($data) {
			$data = @strtolower($data);
			$data = @trim($data);
			$data = @htmlentities($data);
			$data = @strip_tags($data);
			return $data;
		}
		if(isset($_POST['regacc'])) {
			// Form Data
			$usrLogin = cleanFormData($_POST['user']); // Username
			$usrPassNoMD5 = cleanFormData($_POST['pass']); // Password non-encrypted
			
			if($usrLogin = "" || empty($usrLogin) || $usrPassNoMD5 = "" || empty($usrPassNoMD5)) {
				echo "You left blank fields!";
				exit();
			}
			$dbLink = @mssql_connect($dbAddr, $dbUser, $dbPass);
			if(!$dbLink) {
				echo "Failed on processing your register form.<br />Reason: Cannot connect to SQL Server<br />Try to refresh the page or try again later.<br />We apologize for any inconvenience.";
				@mssql_close($dbLink);			
				exit();
			}
			@mssql_select_db($dbName, $dbLink);
			$checkUsrQ = @mssql_query("SELECT account FROM ACCOUNT_TBL WHERE account='".$usrLogin."'");
			$checkUsr = @mssql_num_rows($checkUsrQ);
			if($checkUsr > 0) {
				echo "This username is already been used by another player.";
				@mssql_free_result($checkUsrQ);
				@mssql_close($dbLink);
				exit();
			} else {
				@mssql_free_result($checkUsrQ);
				@mssql_close($dbLink);
				$usrPass = md5($MD5Code . $usrPassNoMD5);
				$storedProc = @mssql_init("createaccount", $dbLink);
				$usrAccParameter = @mssql_bind($storedProc, '@account', $usrLogin, SQLVARCHAR, false, false, 15);
				$usrPwdParameter = @mssql_bind($storedProc, '@password', $usrPass, SQLVARCHAR, false, false, 32);
				$addNewUsr = @mssql_execute($storedProc);
 				if(!$addNewUsr) {
					echo "Failed on processing your register form.<br />Try to refresh the page or try again later.<br />We apologize for any inconvenience.";
				} else {
					echo "Your account has been created sucessfully!<br />Your login: <b>".$usrLogin."</b> - Your Pass: ****<br />Enjoy playing on our servers!";
				}
				@mssql_free_statement($addNewUsr);
				@mssql_close($dbLink);
			}
			
		}
	?>
	<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
		Username: <input type="text" name="user" size="15" maxlenght="15" /><br />
		Password: <input type="password" name="pass" size="15" /><br />
		Name: <input type
		<input type="submit" name="regacc" />
	</form>
</body>
</html>

Please report any errors or security issues.
Modify as your wish.
Thanks in advance.

-------------- UPDATE

Should be fixed now
 
Last edited:
Newbie Spellweaver
Joined
Dec 11, 2008
Messages
12
Reaction score
0
Which webhost I need for this? Can anyone link me one?
 
Newbie Spellweaver
Joined
Jun 24, 2007
Messages
70
Reaction score
0
I'm using WAMP and it tells me i don't have enabled support for MSSQL extension, which i did enable.
 
Not working on UnitedFlyf
Loyal Member
Joined
Apr 21, 2009
Messages
1,385
Reaction score
934
Code:
<?php
	$MD5Code = "kikugalanet"; // Your Neuz MD5 Code
	$dbAddr = "127.0.0.1"; // Your MSSQL Host IP
	$dbName = "ACCOUNT_DBF"; // Your Account Database
	$dbUser = "sa"; // Your Database user
	$dbPass = ""; // Your Database User password

	if(!extension_loaded("mssql")) {
		echo "The MSSQL extension is not enabled on your PHP. Enable it on your php.ini and try again.";
		exit();
	}
?>
<!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" dir="ltr" lang="en">
<head>
<title>Fly For Fun :: Official Files Simple Register Page</title>
</head>
<body>
	<?php
		function cleanFormData($data) {
			$data = @strtolower($data);
			$data = @trim($data);
			$data = @htmlentities($data);
			$data = @strip_tags($data);
			return $data;
		}
		if(isset($_POST['regacc'])) {
			// Form Data
			$usrLogin = cleanFormData($_POST['user']); // Username
			$usrPassNoMD5 = cleanFormData($_POST['pass']); // Password non-encrypted
			
			if($usrLogin = "" || empty($usrLogin) || $usrPassNoMD5 = "" || empty($usrPassNoMD5)) {
				echo "You left blank fields!";
				exit();
			}
			$dbLink = @mssql_connect($dbAddr, $dbUser, $dbPass);
			if(!$dbLink) {
				echo "Failed on processing your register form.<br />Reason: Cannot connect to SQL Server<br />Try to refresh the page or try again later.<br />We apologize for any inconvenience.";
				@mssql_close($dbLink);			
				exit();
			}
			@mssql_select_db($dbName, $dbLink);
			$checkUsrQ = @mssql_query("SELECT account FROM ACCOUNT_TBL WHERE account='".$usrLogin."'");
			$checkUsr = @mssql_num_rows($checkUsrQ);
			if($checkUsr > 0) {
				echo "This username is already been used by another player.";
				@mssql_free_result($checkUsrQ);
				@mssql_close($dbLink);
				exit();
			} else {
				@mssql_free_result($checkUsrQ);
				@mssql_close($dbLink);
				$usrPass = md5($MD5Code . $usrPassNoMD5);
				$storedProc = @mssql_init("createaccount", $dbLink);
				$usrAccParameter = @mssql_bind($storedProc, '@account', $usrLogin, SQLVARCHAR, false, false, 15);
				$usrPwdParameter = @mssql_bind($storedProc, '@password', $usrPass, SQLVARCHAR, false, false, 32);
				$addNewUsr = @mssql_execute($storedProc);
 				if(!$addNewUsr) {
					echo "Failed on processing your register form.<br />Try to refresh the page or try again later.<br />We apologize for any inconvenience.";
				} else {
					echo "Your account has been created sucessfully!<br />Your login: <b>".$usrLogin."</b> - Your Pass: ****<br />Enjoy playing on our servers!";
				}
				@mssql_free_statement($addNewUsr);
				@mssql_close($dbLink);
			}
			
		}
	?>
	<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
		Username: <input type="text" name="user" size="15" maxlenght="15" /><br />
		Password: <input type="password" name="pass" size="15" /><br />
		Name: <input type
		<input type="submit" name="regacc" />
	</form>
</body>
</html>

Please report any errors or security issues.
Modify as your wish.
Thanks in advance.

-------------- UPDATE

Should be fixed now

Looks nice, good job. :>
@Eponix, try 127.0.0.1\SQLEXPRESS,1433
 
Newbie Spellweaver
Joined
May 12, 2008
Messages
25
Reaction score
7
Which webhost I need for this? Can anyone link me one?

I recommend install AppServ or install Apache and PHP separately.

You can download AppServ (But do not install MySQL and phpMyAdmin).
 
Newbie Spellweaver
Joined
May 12, 2008
Messages
25
Reaction score
7
@Eponix
Try to use: "your computer name\SQLEXPRESS"(whithout quotes)

On WinXP:
You can find the computer name in Control Panel->System
In the computer name tab will have the computer complete name.
 
Newbie Spellweaver
Joined
Dec 1, 2008
Messages
68
Reaction score
1
@Eponix
Try to use: "your computer name\SQLEXPRESS"(whithout quotes)

On WinXP:
You can find the computer name in Control Panel->System
In the computer name tab will have the computer complete name.

Eponix usually your computer name is your login name like mine is "User" and then -PC like "User-PC\SQLEXPRESS"

Worked with connecting to MSSQL but now
Code:
Failed on processing your register form.
Try to refresh the page or try again later.
We apologize for any inconvenience.
 
Newbie Spellweaver
Joined
Nov 6, 2008
Messages
23
Reaction score
0
The MSSQL extension is not enabled on your PHP. Enable it on your php.ini and try again. wtf???
 
Newbie Spellweaver
Joined
Dec 1, 2008
Messages
68
Reaction score
1
Use xampp then open php.ini in the C:/xampp/php and search for
Code:
mssql
then you will find something starting with a ;
get rid of ONLY the ";" then save the file and restart xampp then it should work.
 
Back
Top