...

View Full Version : PHP and Access



sagat
01-13-2004, 11:10 PM
Hi all. i have a dilemna question here. i have created an access database with the username and password tables. I have the ODBC connection which linked PHP to Access. I have created a PHP login form using Dreamweaver:

<form method="post" action="process.php">
Username
<input type="text" name="user" />
<br />
Password
<input type="password" name="pass" />
<br />
<input type="submit" name="submit" value="Login" />
</form>

Now i want to be able to login using from via getting the details from the access database. Somebody said to me to use process.php:
<?
//get variables from form
$user = $_GET['user'];
$pass = $_GET['pass'];

How do i use this?

After logging in, the user should be redirected to a website (this should be done using javascript client side checking). Also the login should be able to cope with users forgetting thier passwords and should be able to perform server side checking. Does anyone know i to go about this? Thanks in advance

sagat
01-14-2004, 03:30 PM
ignore the earlier question this is where i am at: i have connected PHP to Access and created a login screen

<?
$odbc = odbc_connect ('PHP Login', 'root', '') or die( "Could Not Connect to ODBC Database!" );
?>
<?
//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM login screen WHERE username_column = '" . $_POST['username'] . "' AND password_column = '" . $_POST['password'] . "'"

also do u know how i can do a process.php script as i dont know if what i am doing is a process.php? Also how can i verify users and redirect them to a website? thanx

sagat
01-14-2004, 05:53 PM
<form method="post" action="process.php">
Username
<input type="text" name="user" />
<br />
Password
<input type="password" name="pass" />
<br />
<input type="submit" name="submit" value="Login" />
</form>
<?
//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];

if (odbc_num_rows($query)) {
header("Location: process.php");
exit();
} else {
echo "you can't log in.";
}
?>

I have done the process PHP but how can i validate users? When i run the code it comes up with the following errors:

Warning: odbc_num_rows(): supplied argument is not a valid ODBC result resource in c:\phpdev5\www\tmpa3fcbrhqz1.php on line 15
you can't log in.

Can someone help me please

sagat
01-15-2004, 08:44 AM
ahh forget it u all. no thanks n i have worked it out myself



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum