Hello all,
OK, I have been working on this script for a while now and keep bumping into walls....It is just a simple script that is supposed to check a mysql database to verify a user name and password before allowing them to proceed to the next page. I am having difficulty determing if the script is even connecting to the database properly or for that matter if it even sees the database. I have been to several sites and looked at a lot of code,still no luck. I think I am missing some basic steps here. Please look at code and if possible point me in the right direction...using php 4.3.3 & mysql 4.0.15 thanks all
The form script (seems to be working)
<html>
<head><title>Contractor Login Form</title>
<body bgcolor = "009999" text = "white">
<br><br><br><br><br><br><br><br><br><br>
<H1><p align = center>Contractor Login Form</H1>
<FORM METHOD="POST" ACTION="C:\Program Files\Apache Group\Apache2\htdocs\contractorlogin.php">
<P><STRONG><p align = center>Username:</STRONG><BR>
<INPUT TYPE="text" NAME="username"></p>
<P><STRONG><p align = center>Password:</STRONG><BR>
<INPUT TYPE="password" NAME="password"></p>
<P><p align = center><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Login"></P>
</FORM>
<?php
?>
</body>
</html>
The login script(do not know if this is working or not)
<HTML>
<HEAD>
<TITLE>Contractor Login</TITLE>
</HEAD>
<BODY>
<?php
// Define variables to be used in program
define("HOST", "localhost");
define("USER", "root");
define("PASS", "mypassword");
define("DB", "contractorlogin");
//connect to the database
$db = mysql_connect("HOST","USER","PASS");
mysql_select_db($db);
$result=mysql_query("select count(*) as numfound from contractorlogin where
user='{$HTTP_POST_VARS['user']}' AND pass='{$HTTP_POST_VARS['password']}'");
//decide what we are going to allow
$result_ar=mysql_fetch_array($result);
if $result_ar['numfound'] < 1) //**login failed**
{
header('Location: contractorloginerror.php');
}
else
{
echo "Login Succeeded!";
}
?>
</BODY>
</HTML>
The login script(do not know if this is working or not) The form script (seems to be working)