Can anyone post a tutorial on how to make a Log in for Gunz in php??? i would appreciate it very much.
Can anyone post a tutorial on how to make a Log in for Gunz in php??? i would appreciate it very much.
Use an existing one and learn from it.
is there any other way becuse i cant figure out it 100 percent
Through mysql / mssql database or just 1 username and password to login ?
PHP Code:<?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 Code:<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 by Forgiven; 17-01-10 at 05:39 PM.
SO just to clarify that would be it? And then all I have to do is make a config then include it?PHP Code:<?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>
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 by Forgiven; 18-01-10 at 10:54 PM.
You have to connect to database before.
I did. As a test Im putting this in my index file where to login is. It should work. here it is.
Ye i stared it out :)PHP Code:<?php
//MSSQL Connection
$con = mssql_connect("*******\SQLEXPRESS","*****","******");
if (!$con)
{
die('Couldnt not connect: ' . mssql_error());
}
mssql_select_db("GunzDB");
?>
Last edited by Forgiven; 18-01-10 at 11:39 PM.
Your config is for mssql.
Add this one :
PHP Code:$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 by Trilest; 22-01-10 at 08:27 AM.