Bluehost.com Web Hosting $6.95

trying to access variable on different pages with reigster_globals = Off

This is a discussion on trying to access variable on different pages with reigster_globals = Off within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am taking over an exisitng app. I have the following function on page1: function check($v) { global $user; return $...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-05-2007
Paul
 
Posts: n/a
Default trying to access variable on different pages with reigster_globals = Off

I am taking over an exisitng app. I have the following function on page1:
function check($v) {
global $user;
return $user->validate($v[1], $v[0]);
}
It is in this validate function of that class (which is referenced from
another file) that the $user object is set. $user is referenced on page2
like:

session_register('user');
$user=$_SESSION['user'];

since the ini setting register_globals is Off so the above code fails -
$user is empty.

Any ideas to how to make sure $user is accessible on the second page?


Reply With Quote
  #2 (permalink)  
Old 04-06-2007
Steve
 
Posts: n/a
Default Re: trying to access variable on different pages with reigster_globals = Off


"Paul" <lof@invalid.com> wrote in message news:2sbRh.25668$B7.8237@bigfe9...
|I am taking over an exisitng app. I have the following function on page1:
| function check($v) {
| global $user;
| return $user->validate($v[1], $v[0]);
| }
| It is in this validate function of that class (which is referenced from
| another file) that the $user object is set. $user is referenced on page2
| like:
|
| session_register('user');
| $user=$_SESSION['user'];
|
| since the ini setting register_globals is Off so the above code fails -
| $user is empty.
|
| Any ideas to how to make sure $user is accessible on the second page?

paul,

search for this post by phil buchman:

'Re: Need a simple database for name and email only'

i posted several scripts that work together to provide the basics for site
configuration, user verification, automated emails...and of course, the
relative path thing. ;^)

from all of that, you should see your question answered.

btw, AT ALL COSTS, DO NOT USE global $variable conventions in functions!!!
functions get fed PARAMETERS...all else is MAGIC one has to guess at in a
less than structured environment where more often than not, your eye will
not surpass the hand in speed.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:36 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0