Website Login

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
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
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
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
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
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