|
Posted by jerryyang_la1 on 09/28/21 11:58
Trying to get this working..
But I'm getting it wrong !
Any Ideas ?
Thanks
<?php
// grab form variables
$user = $_POST["username"];
$pass = $_POST["password"];
$hostName = "127.0.0.1";
$userName = "xxxx";
$password = "xxxx";
$dbName = "xxxx";
// make connection to database
mysql_connect($hostName, $userName, $password) or die("Unable to
connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
// select fields for drop down list
$query = "select *
from users WHERE Username = '$user'";
$result = mysql_query($query);
// determine the number of companies
$number = mysql_num_rows($result);
//results from sql query
for ($i=0; $i<$number; $i++) {
$username = mysql_result($result,$i,"Username");
$password = mysql_result($result,$i,"Password");
if ($user == $username) {
if ($pass == $password) {
//if user and password are OK, redirect to here
header("location:" . $_SERVER['SERVER_URL'] . "search.php");
}
}
//end of if results
}
header("location:" . $_SERVER['SERVER_URL'] . "unauthorised.html");
?>
Navigation:
[Reply to this message]
|