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!

Connect reg pag to DB

Newbie Spellweaver
Joined
May 28, 2013
Messages
80
Reaction score
0
What language is your registration page in?

If you are trying to register, you can open sql server management studio and execute the query directly from there.
 
Newbie Spellweaver
Joined
Aug 15, 2012
Messages
41
Reaction score
1
What language is your registration page in?

If you are trying to register, you can open sql server management studio and execute the query directly from there.

He wants to enable a wan registration, not for himself.
 
Newbie Spellweaver
Joined
May 28, 2013
Messages
80
Reaction score
0
If you are looking for a ready made php page, I guess someone has already uploaded that before along with the tutorial.

Once you have that ready running on local, just search how to deploy website on server(like WAMP server for php).
 
Newbie Spellweaver
Joined
May 28, 2013
Messages
80
Reaction score
0
I am not sure of PHP so I cannot give you more information but if you want I can help you making a new registration page in Java and may be you can use apache tomcat server.

Moreover, if you are not worried about security as it is for your friends you can share the same tool with your friends and let them connect to DB directly for registration. You will have to open 1433 port for allowing connection to DB directly which I am expecting you must be already having it.

-- Additional info for xamp --

If you are trying to use port 80 for your website then please disable SQL Server reporting services as it uses port 80. And if you are using any other default port like 8080 just check it if is already in use.

Sorry for the late reply.
 
Banned
Banned
Joined
Feb 19, 2013
Messages
83
Reaction score
7
Install AppServ , add DLL for MSSQL in php (can find how just litle google) and you can connect to mssql same like on mysql.
<?php

$myServer = "IP Windows";
$myUser = "sa";
$myPass = "PASSWORD";
$myDB = "PassportBOI";

$conn = mssql_connect($myServer,$myUser,$myPass);
if (!$conn)
{
die('Not connected : ' . mssql_get_last_message());
}
$db_selected = mssql_select_db($myDB, $conn);
if (!$db_selected)
{
die ('Can\'t use db : ' . mssql_get_last_message());
}


This is just connection on DB rest you need make add script like this :

$name = (isset($_POST['name'])) ? $_POST['name'] : '';
$passwd = (isset($_POST['passwd'])) ? $_POST['passwd'] : '';

$sql = "SELECT * FROM account WHERE name = '".$name."'";
$result = mssql_query($sql) or die(mysql_error());
if(mssql_num_rows($result)>=1)
{
echo '<script type="text/javascript">alert("Name already exists!");</script>';
echo "\n<script type="text/javascript">window.location.replace('index?page_id=22');</script>\n";
exit();
}
else

// hardcoded (change them to post variables if you want)
$prompt = 'prompt';
$answer = 'answer';
$truename = 'truename';
$idNumber = '123123';
$email = (isset($_POST['emailAddr'])) ? $_POST['emailAddr'] : '';
$mobileNumber = '123123';
$province = 'province';
$city = 'city';
$phoneNumber = '123123';
$address = 'address';
$postalCode = '12345678';
$gender = 0; // guessing: 0 -> male & 1 -> female *doesn't really matter
$y=(isset($_POST['y'])) ? $_POST['y'] : '';
$m=(isset($_POST['m'])) ? $_POST['m'] : '';
$d=(isset($_POST['d'])) ? $_POST['d'] : '';
$birthday = "$y/$m/$d";
$qq = 'qq';
//$ip_addr = $_SERVER['REMOTE_ADDR'];

if ( strlen($name) > 0 && strlen($passwd) ) {

// password hashing you need change stored procedure in mssql to convert asci to binary
$stmt = mssql_init('adduser');

mssql_bind($stmt, name', $name, SQLVARCHAR, false, false, 64);
mssql_bind($stmt, passwd', $passwd, SQLVARCHAR , false, false, 64);
mssql_bind($stmt, Prompt', $prompt, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, '@answer', $answer, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, Truename', $truename, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, idnumber', $idNumber, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, email', $email, SQLVARCHAR, false, false, 64);
mssql_bind($stmt, mobilenumber', $mobileNumber, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, Province', $province, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, '@city', $city, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, phonenumber', $phoneNumber, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, '@address', $address, SQLVARCHAR, false, false, 64);
mssql_bind($stmt, Postalcode', $postalCode, SQLVARCHAR, false, false, 8);
mssql_bind($stmt, gender', $gender, SQLINT1, false, false, 3);
mssql_bind($stmt, Birthday', $birthday, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, '@qq', $qq, SQLVARCHAR, false, false, 32);
mssql_bind($stmt, passwd2', $passwd, SQLVARCHAR , false, false, 64);

mssql_execute($stmt);

echo mssql_get_last_message();

mssql_free_statement($stmt);

// mssql_close($connection);
echo "\n<script type="text/javascript">window.location.replace('index.php');</script>\n";
exit();


}
else {
// echo '<script type="text/javascript">alert("Something went wrong please try again");</script>';
//echo "\n<script type="text/javascript">window.location.replace('index.php');</script>\n";
}

?>

Stored procedure in MSSQL ( just open already existing dbo.adduser procedure and replace with this)

USE [PassportBOI]
GO
/****** Object: StoredProcedure [dbo].[adduser] Script Date: 20.3.2017 0:14:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROC [dbo].[adduser] name varchar(64), passwd varchar(64), Prompt varchar(32),
@answer varchar(32), Truename varchar(32), idnumber varchar(32), email varchar(64), mobilenumber varchar(32), Province varchar(32),
@city varchar(32), phonenumber varchar(32),
@address varchar(64), Postalcode varchar(8), gender integer, Birthday varchar(32),
@qq varchar(32), passwd2 varchar(64)
AS
BEGIN

BEGIN TRAN
DECLARE id integer
DECLARE password binary(16)
DECLARE password2 binary(16)
DECLARE @now datetime
SELECT password = CONVERT( BINARY(16), HASHBYTES( 'MD5', name + passwd ) );
SELECT password2 = CONVERT( BINARY(16), HASHBYTES( 'MD5', name + passwd2 ) );
SELECT @now = getdate()
INSERT INTO account SELECT ISNULL(max(id), 16) + 16, name, password, @now, 1 FROM account
SELECT id = id FROM account WHERE name = name
INSERT INTO users VALUES id, Prompt, @answer, Truename, idnumber, email, mobilenumber, Province, @city, phonenumber, @address, Postalcode, gender, Birthday, @qq, password2)
EXEC [dbo].[adduserpoint] id, 9, 10
COMMIT TRAN

END


Thats all
 
Last edited:
Back
Top