 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
martygmiller
Joined: 08 Dec 2009 Posts: 1
|
Posted: Tue Dec 08, 2009 5:05 am Post subject: My auth code works! :) ... but only once. Aarrggh! |
|
|
Hi folks,
I'm a total newbie, so my apologies in advance.
I have auth code (see below) that works... once. Aarrggh. On the first trip to the page, the user sees a username and password box. If the user inputs a valid uid and pwd and submits, checkAuth() returns true and the user is presented with a input text box for a wishlist. So that tells me I am successfully connecting to my db and validating the user.
So everything is going great, until the user enters the wishlist and submits it. At that point, I had wanted the form to process such that checkAuth() would again return true, but it doesn't. Instead, the checkAuth() returns false and presents the user with the username and password boxes.
Hmmm. Any thoughts? Any help greatly appreciated! Thanks in advance.
The code that works... once.
// ----------------------------------
<html>
<head>
<?php
require_once('db_login.php');
require_once('Auth.php');
function loginFunction()
{ echo '<form method="post">
Enter username: <input type="text" name="username"><br>
Enter password: <input type="password" name="password"><br>
<input type="submit">
</form>';
}
$AuthOpts = array(
'dsn' => "mysql://$db_username:$db_password@$db_host/$db_database",
'table' => "users",
'usernamecol' => "username",
'passwordcol' => "password",
'cryptType' => "md5"
);
$a = new Auth("DB", $AuthOpts, "loginFunction");
$a->start();
?>
</head>
<form>
<?php
if ($a->checkAuth()) {
echo 'All I want for Christmas:
<INPUT TYPE=TEXT NAME="wishlist">
<P><INPUT TYPE=SUBMIT VALUE="submit">';
}
?>
</form>
</html> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|