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!

Website Login

Junior Spellweaver
Joined
Aug 22, 2007
Messages
146
Reaction score
1
Can anyone post a tutorial on how to make a Log in for Gunz in php??? i would appreciate it very much.
 
Master Summoner
Joined
Apr 30, 2009
Messages
539
Reaction score
22
Through mysql / mssql database or just 1 username and password to login ?
 
Upvote 0
Praise the Sun!
Loyal Member
Joined
Dec 4, 2007
Messages
2,502
Reaction score
986
PHP:
<?php
//catch the post variables
$sUsername = //cleaned $_POST
$sPassword = //cleaned $_POST
$rQuery = odbc_exec($rDBConnect, "SELECT AID FROM Login WHERE UserID = '" . $sUsername . "' AND Password = '" . $sPassword . "'");
$iAID = (int)odbc_result($rQuery, 1);
if ($iAID == 0) {
    //Login failed
}
else {
    //welcome
}
?>
 
Upvote 0
Junior Spellweaver
Joined
Jul 5, 2008
Messages
107
Reaction score
0
PHP:
<?php
//catch the post variables
$sUsername = //cleaned $_POST
$sPassword = //cleaned $_POST
$rQuery = odbc_exec($rDBConnect, "SELECT AID FROM Login WHERE UserID = '" . $sUsername . "' AND Password = '" . $sPassword . "'");
$iAID = (int)odbc_result($rQuery, 1);
if ($iAID == 0) {
    //Login failed
}
else {
    //welcome
}
?>

Hmm 0_0, so would where you exactly put that. My login goes like this.

PHP:
<form action="" method="POST"> 
Username :<br/> 
<tr><td class=list align=left></td><td class=list><input name="login" type="text" /></td></tr><br/> 
Password :<br/> 
<tr><td class=list align=left></td><td class=list><input name="pass" type="password" /></td></tr><br/> 
<tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center> 
</form> 
</center>
 
Last edited:
Upvote 0
Joined
Jan 4, 2007
Messages
1,600
Reaction score
217
Hmm 0_0, so would where you exactly put that. My login goes like this.

PHP:
<form action="" method="POST"> 
Username :<br/> 
<tr><td class=list align=left></td><td class=list><input name="login" type="text" /></td></tr><br/> 
Password :<br/> 
<tr><td class=list align=left></td><td class=list><input name="pass" type="password" /></td></tr><br/> 
<tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center> 
</form> 
</center>

PHP:
<?php
// Your PHP code
?>
<!-- HTML Code -->
 
Upvote 0
Junior Spellweaver
Joined
Jul 5, 2008
Messages
107
Reaction score
0
PHP:
<?php
//catch the post variables
$sUsername = //cleaned $_POST
$sPassword = //cleaned $_POST
$rQuery = odbc_exec($rDBConnect, "SELECT AID FROM Login WHERE UserID = '" . $sUsername . "' AND Password = '" . $sPassword . "'");
$iAID = (int)odbc_result($rQuery, 1);
if ($iAID == 0) {
    //Login failed
}
else {
    //welcome
}
?>
<form action="" method="POST"> 
Username :<br/> 
<tr><td class=list align=left></td><td class=list><input name="Username" type="Username" /></td></tr><br/> 
Password :<br/> 
<tr><td class=list align=left></td><td class=list><input name="Password" type="Password" /></td></tr><br/> 
<tr><td class=listtitle align=right colspan=2><center><input type="submit" value="Continue"/></td></tr></center> 
</form> 
</center>

SO just to clarify that would be it? And then all I have to do is make a config then include it?

Ok so I get this error

Code:
Warning: odbc_exec() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index1.php on line 58

Warning: odbc_result() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index1.php on line 59
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Jul 5, 2008
Messages
107
Reaction score
0
I did. As a test Im putting this in my index file where to login is. It should work. here it is.
PHP:
<?php
//MSSQL Connection
$con = mssql_connect("*******\SQLEXPRESS","*****","******");
if (!$con)
    {
    die('Couldnt not connect: ' . mssql_error());
    }
   
mssql_select_db("GunzDB");
?>

Ye i stared it out :)
 
Last edited:
Upvote 0
Master Summoner
Joined
Apr 30, 2009
Messages
539
Reaction score
22
I did. As a test Im putting this in my index file where to login is. It should work. here it is.
PHP:
<?php
//MSSQL Connection
$con = mssql_connect("*******\SQLEXPRESS","*****","******");
if (!$con)
    {
    die('Couldnt not connect: ' . mssql_error());
    }
   
mssql_select_db("GunzDB");
?>

Ye i stared it out :)

Your config is for mssql.

Add this one :

PHP:
$host = ""; //host
$user = "sa";
$pass = ""; //pw
$dbname = "GunzDB";
$connect = odbc_connect("Driver={SQL Server}; Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect to the Server. Please contact the webmaster !");
 
Last edited:
Upvote 0
Back
Top