1
tayling
Using $_SESSION variables
  • 2003/10/4 22:07

  • tayling

  • Just popping in

  • Posts: 86

  • Since: 2002/1/3 7


G'day
I would like to create some session variables on login to my site. I cant seem to do this in XOOPS - is there a reason?

What I am trying to do is to allow XOOPS to display information depending on the url - I am allowing a membership number to be added to the url i.e. www.mysite.com/10078 and then using error404 page to get the member number and call the main site back up passing it the id and display the users name automatically on the site.
I am using a separate MySQL table and search for the id - then set a session up with the user info. I have this working in my non XOOPS site but am having trouble replicating it within xoops.

Any great ideas guys?

Thanks
Tony Ayling

2
mvandam
Re: Using $_SESSION variables
  • 2003/10/5 0:23

  • mvandam

  • Quite a regular

  • Posts: 253

  • Since: 2003/2/7 2


Can you provide a little more detail about what you are trying to do?

I doesn't look like you need $_SESSION or $HTTP_SESSION_VARS to do what you are describing since you are using your own database tables and your own id number.

Also, why not use mod_rewrite (if you're using apache) or www.mysite.com?memid=11078 instead of the 404 trick?

3
tayling
Re: Using $_SESSION variables
  • 2003/10/5 4:03

  • tayling

  • Just popping in

  • Posts: 86

  • Since: 2002/1/3 7


Hi
thanks for your reply.
I am using the 404 trick as I am dealing with a club membership system and mostly computer illiterate people - I have designed it so that they just have to add their membership no on the end of the url instead of trying to explain the ?memb_id=10078 etc. It actually works pretty neatly.

I am now combining the membership system with XOOPS and want a person to have a personalised page by simply typing in the /10078. In my error404.php page i have extracted the member id and looked them up in the database and if existing assigned a few variables such as name level address etc which i wnat to make session variables that i can use in the main XOOPS template and page.

Its looking good but i cant seem to get the $_SESSION working - it works intermittently but not all the time.

It will be very neat if I can get it going. I think maybe there is a problem with $REQUEST_URI when using index.php??

To test if you create an error404.php page i.e

$urlsite=$REQUEST_URI;
$user=explode("/",$urlsite);
$memb_id=$user[2];
$_SESSION['memb_id'] = $memb_id;
header("location: index.php");

then www.yoursite.com/10078

Hope that explains things

Thanks for any suggestions (polie though please!!)

Regards

Tony

4
mvandam
Re: Using $_SESSION variables
  • 2003/10/5 9:12

  • mvandam

  • Quite a regular

  • Posts: 253

  • Since: 2003/2/7 2


OK, I see now what you're doing with the 404. Perhaps all you need to add to the error404.php page is the statement

session_start();

??

Also you may have problems if you defined a 'custom' session name in the XOOPS preferences. If so, you will need to account for that in the 404 php page as well.

That's all I can think of right now...

Good luck

5
fatman
Re: Using $_SESSION variables
  • 2004/1/21 4:42

  • fatman

  • Friend of XOOPS

  • Posts: 176

  • Since: 2003/12/13


I was having similar problems. I'm using mod_rewrite and I need to store some session variables to remember view state for some administration functions.

I was having intermitten success. Some sessions would work, some wouldn't. Some would work for a while then stop.

I never thought to add session_start(); as I had selected to use sessions and some sessions were working with no issue.

I added session_start(); and now all of them are working. I'm not sure its the right answer but it has seemed to make my sessions more reliable. :)

Login

Who's Online

201 user(s) are online (89 user(s) are browsing Support Forums)


Members: 0


Guests: 201


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits