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 php

Newbie Spellweaver
Joined
Aug 13, 2012
Messages
12
Reaction score
0
Hi all, could someone explain me how to create a registration page and especially how to connect it to my MSSQL, please?
 
Last edited:
Newbie Spellweaver
Joined
Dec 17, 2012
Messages
7
Reaction score
0


i dunno what is database name
i never tried to make a website for pangya

so, gimme the
table names and columns
then i will help you :D



 
Upvote 0
Experienced Elementalist
Joined
Apr 1, 2010
Messages
267
Reaction score
135
You need use Odbc not mssql :D

Better way ...

BUT if you want mssql ...

I make for you a GENERIC tamplate custom for your table

<?php
/*Configuration MSSQL*/
$myServer = "SD-\SQLEXPRESS"; //Par Defaut :: Nom du pc\SQLEXPRESS
$myUser = "sa"; //Par Defaut :: sa
$myPass = "Kiku"; //Par Defaut :: YOUR passord
$AccountDB = "Pangya_Login"; //Par Defaut :: Your database
/*Fin de config mssql*/

/* connection a mssql*/
mssql_connect($myServer,$myUser,$myPass) or die("Error.");
mssql_select_db($AccountDB);

/* Fonction PHP */
function Anti_Injection($str)
{
trim($str);
if(!preg_match("/^[a-z0-9]+$/i",$str))
{
$return = false;
}
else
{
$return = true;
}
return $return;
}

function Email_Valide($email)
{
if(mb_eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
{
$return = true;
} else
{
$return = false;
}
return $return;
}




if(!isset($_POST['submit']))
{
?>
<div class="cbox-ui cbox-title"><center><h2>Inscription</h2></center></div>
<div class="cbox-ui cbox-content">
<div class="clearfix"></div>
<p><center>
<form class="cmxform" id="regForm" action="http://forum.ragezone.com/?p=register" method="post">
<p><label><span>Pseudo</span><input type="text" id="username" name="username" class="required" maxlength="15" value="" /></label> <span style="color: green;">* pseudo.</span></p>

<div class="sep"></div>

<p><label><span>Mot de passe</span><input type="password" id="password" name="password" class="required password" maxlength="15" /></label> <span style="color: green;">*pass.</span></p>

<div class="sep"></div>

<p><label><span>Confirmation</span> <input type="password" id="password2" name="password2" class="required password" maxlength="15" /></label> <span style="color: green;">* same pass.</span></p>

<div class="sep"></div>

<p><label><span>E-mail</span> <input type="text" id="email" name="email" class="required email" value="" /></label> <span style="color: green;">* True email please</span></p>
<br/>
<br/>
<p><input type="submit" name="submit" value="Inscription"/></p>
</form>
</center>
</p>
<div class="clearfix"></div>
</div>
<div class="cbox-ui cbox-end"></div>
<?php
}
else
{
$username = ($_POST['username']);
$password = ($_POST['password']);
$password2 = ($_POST['password2']);
$email = ($_POST['email']);

if ((Anti_Injection($username) == FALSE) and (!empty($username)))
{
echo "<center>Try to hack ?</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
if ((Anti_Injection($password) == FALSE) and (!empty($password)))
{
echo "<center>Try to hack ?</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
elseif ((Anti_Injection($password2) == FALSE) and (!empty($password2)))
{
echo "<center>Try to hack ?</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
elseif(Email_Valide($email) == false)
{
echo "<center>This is not a email!</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
else
{
$accountquery = mssql_query("SELECT * FROM MYTABLE WHERE account='".$username."'");
$accountnum = mssql_num_rows($accountquery);
$emailquery = mssql_query("SELECT * FROM MYTABLE WHERE email='".$email."'");
$emailnum = mssql_num_rows($emailquery);

if(empty($password) || empty($password2))
{
echo "<center>You Forget the password!</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
elseif($password != $password2 && $password2 != $password)
{
echo "<center>Pass 1 ansd pass 2 are not same !</center>";
}
elseif($accountnum != 0)
{
echo "<center>This name Exist.</center>";
echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
}
else
{
$sql=("INSERT INTO YOURTABLE(account,password) VALUES ('".$username."','".$pswd.");
mssql_query($sql) or die ("<center><strong>Error.</strong></center>");

print('<center>New user :<b> ' . $username . '</b>! <br /> Welcome !</center>');
}
}
}
?>
 
Upvote 0
Back
Top