You are here: Password Access, what have I got wrong ! « All PHP « IT news, forums, messages
Password Access, what have I got wrong !

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация