PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
My auth code works! :) ... but only once. Aarrggh!

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Authentication
View previous topic :: View next topic  
Author Message
martygmiller



Joined: 08 Dec 2009
Posts: 1

PostPosted: Tue Dec 08, 2009 5:05 am    Post subject: My auth code works! :) ... but only once. Aarrggh! Reply with quote

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. Smile

The code that works... once. Sad

// ----------------------------------

<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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Authentication All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software