- 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.
<?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
}
?>
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="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>
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
// Your PHP code
?>
<!-- HTML 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>
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
<?php
//MSSQL Connection
$con = mssql_connect("*******\SQLEXPRESS","*****","******");
if (!$con)
{
die('Couldnt not connect: ' . mssql_error());
}
mssql_select_db("GunzDB");
?>
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![]()
$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 !");