Just another rainy day
Posts: 1
10 credits Members referred : 0
« on: Dec 31, 2007, 05:10:14 pm »
Using php 5.14, phpuser v 0.91
Stuff that works: registration email activation
I can't get the cookies to save, and the $_SESSION var is not being set.
If the user logs in with appropriate user/password, I redirect to another page, but the phpuser class constructor does not pickup the session var ("userSessionValue") nor an appropriate cookie on the user's machine.
What should I look for?
Essentially, I'm doing this:
in all php files on the site, I have
Code:
require "mytemplatefile.php";
Inside "mytemplatefile.php", I have this:
Code:
require "access.class.php";
Inside "access.class.php", I have the following:
Code:
class flexibleAccess { ... the class code }
$userX = new flexibleAccess();
The act of logging in is handled like so:
Code:
if (isset($_POST['username'])) { trim(strip_tags(stripslashes($_POST['username']))); } if (isset($_POST['password'])) { trim(strip_tags(stripslashes($_POST['password']))); } if ((!empty($_POST['username'])) && (!empty($_POST['password']))) { if ($userX->login($_POST['username'], $_POST['password'], true, true)) { // redirect to the home page header("Location: http://blahblah/index.php"); } else { $htmlStr .= "Invalid login attempt."; } } else { $htmlStr .= "You must specify a user ID and password."; }
The problem is that when I get to the redirected page, the expected session var and cookie don't appear to exist.
« Last Edit: Dec 31, 2007, 06:47:22 pm by jsimmons »
I crack Photoshop!
Gender:
Posts: 3
22 credits Members referred : 0
« Reply #1 on: Jun 04, 2008, 11:51:40 pm »
Hi, I'm having this same problem. When I login and am redirected to my test page, the output is simply NULL NULL (simple var_dumps, see the code below).
Any idea why this isn't working? I love the idea of this nice lightweight & flexible user class. I'll love the class itself as soon as i get this working!
cheers, Kris
PHPUserClass v0.93 PHP 5.2.5 (OS X Leopard default install)
Here is my login page (only slightly modified from example1.php)
Code:
<?php <? /* Basic login example with php user class http://phpUserClass.com */ require_once 'access.config.php'; require_once 'access.class.php';
$user = new flexibleAccess('', $settings);
if ( $_GET['logout'] == 1 ) { $user->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); }
I crack Photoshop!
Gender:
Posts: 3
22 credits Members referred : 0
« Reply #2 on: Jun 06, 2008, 05:51:21 am »
Well, it turned my issue was not just one problem. It was a bit of a comedy of errors in there on my part. In my troubleshooting though, I do believe I've come across a couple of legitimate bugs in v0.93. I'll put these & my suggestions in a separate post to make sure they get noticed. Hopefully they'll help someone else out, too.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7491