Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-13-2004, 11:10 PM   PM User | #1
sagat
New Coder

 
Join Date: Jan 2004
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
sagat is an unknown quantity at this point
PHP and Access

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 is offline   Reply With Quote
Old 01-14-2004, 03:30 PM   PM User | #2
sagat
New Coder

 
Join Date: Jan 2004
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
sagat is an unknown quantity at this point
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 is offline   Reply With Quote
Old 01-14-2004, 05:53 PM   PM User | #3
sagat
New Coder

 
Join Date: Jan 2004
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
sagat is an unknown quantity at this point
<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 is offline   Reply With Quote
Old 01-15-2004, 08:44 AM   PM User | #4
sagat
New Coder

 
Join Date: Jan 2004
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
sagat is an unknown quantity at this point
ahh forget it u all. no thanks n i have worked it out myself
sagat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:33 AM.


Advertisement
Log in to turn off these ads.