i have been tryin to get this working and and 9/10 of the way there but i have 1 small problem
ok, first im trying to make a login script with is bit of code
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
//get form data
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
//open DB
$db_connection = new COM("ADODB.Connection");
$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("../usr/DB/data.mdb") . " ;DefaultDir=" . realpath("../usr/DB");
$db_connection->open($db_connstr);
//check for username AND password
$rs = $db_connection->execute("SELECT * FROM Customers WHERE username='$username' AND password='$password'");
//get Vars.
$rs_home = $rs->Fields(Home);
$rs_user = $rs->Fields(Username);
$rs_pass = $rs->Fields(Password);
$rs_fname = $rs->Fields(First);
$rs_lname = $rs->Fields(Last);
$rs_address = $rs->Fields(Address);
$rs_email = $rs->Fields(Email);
$rs_phone = $rs->Fields(Phone);
// If fail tell and stop
if ($rs_user->Value == NULL){
die("sorry you #*@! something up?? Dunno what but maby you should re-try.");
}
else{
//start the session and asign the Vars.
session_start();
$_SESSION["home"] = "$rs_home->Value";
$_SESSION["user"] = "$rs_user->Value";
$_SESSION["pass"] = "$rs_pass->value";
$_SESSION["fname"] = "$rs_fname->Value";
$_SESSION["lname"] = "$rs_lname->Value";
$_SESSION["address"] = "$rs_address->Value";
$_SESSION["email"] = "$rs_email->Value";
$_SESSION["phone"] = "$rs_phone->Value";
//close DB
$rs->Close();
$db_connection->Close();
//send them off to a new world
header("location: new111.php");
}
?>
ok if you login right its cool and works but if you try to loging with a rong username or password it is suposed to show the error above and it dose but also i get a PHP error about there not being a record that matches this is the error
Warning: PropGet() failed: Exception occurred. Source: ADODB.Field Description: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. in C:\home\New2.php on line 25
sorry you #*@! something up?? Dunno what but maby you should re-try.
line 25 is the if statment
Any ideas
Thanks 🙂