[PHP] Re: session variable problem

2011-04-01 Thread markb

On 3/25/2011 12:09 PM, markb wrote:

Very rusty with PHP.
We moved our web site to a new hosting service (godaddy). PHP changed
from 4x to 5.2.17.
I can no longer change $_SESSION variables after the first use.
First call to form - start session create variables
Second call - can read variables, change existing ones (but they do not
persist to next call) - cannot create new variable without an error

Using $_SESSION['varname'] always
session.auto_start off
register_globals off
session.use_only_cookies off

I assume this is setting difference but I can't seem to find it.





Also had another issue in converting to PHP 5.  I had been passing 
$_SESSION variable to functions.  For some reason this was wiping out 
the values after each call.


--
Mark B

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session variable problem

2011-03-31 Thread markb

On 3/25/2011 12:09 PM, markb wrote:

Very rusty with PHP.
We moved our web site to a new hosting service (godaddy). PHP changed
from 4x to 5.2.17.
I can no longer change $_SESSION variables after the first use.
First call to form - start session create variables
Second call - can read variables, change existing ones (but they do not
persist to next call) - cannot create new variable without an error

Using $_SESSION['varname'] always
session.auto_start off
register_globals off
session.use_only_cookies off

I assume this is setting difference but I can't seem to find it.





OK. found the issue.

ini_set('session.cookie_secure',true);

Causes the issue IF I don't use https.  Make sense I suppose.


--
Mark B

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session variable problem

2011-03-29 Thread markb

On 3/25/2011 12:09 PM, markb wrote:

Very rusty with PHP.
We moved our web site to a new hosting service (godaddy). PHP changed
from 4x to 5.2.17.
I can no longer change $_SESSION variables after the first use.
First call to form - start session create variables
Second call - can read variables, change existing ones (but they do not
persist to next call) - cannot create new variable without an error

Using $_SESSION['varname'] always
session.auto_start off
register_globals off
session.use_only_cookies off

I assume this is setting difference but I can't seem to find it.





OK, here's is what is happening.  I think my web hosting service is just 
really slow.  I am storing the cookies in a unique directory.  I create 
the directory when I start the session.  It appears to take a long time 
for the directory creation to occur.  The code is posted below.  You can 
test it at this link:  http://www.injection-moldings.com/upload%20test1.php


1.  First time you call,
the session starts,
variables assigned to $_SESSION  -
 but no session ID ([PHPSESSID]) yet
2. Reload the page,
 previous $_SESSION data lost
	 but markdir value appears in cookie which is the hash value for the 
session path.

Still no session ID
3. Reload  -
session ID appears [PHPSESSID]
session data starts saving  $_SESSION['test'] will increment



Code:

?php
ob_start(); //start output buffering



// 10-2007 added java download text to first page



if(!isset($_COOKIE['makedir']) ) {


$unhashdir = startNewSession(); 
cfinitsession($_SESSION) ;  
$_SESSION['mystep'] = 0;
$_SESSION['SUBMIT'] == 'auto';
$_POST = array();   
setCookie('pagereload','0',0,'/');
$_COOKIE['pagereload'] = 0;
$_SESSION['pagereload']=0;
echo 'pstarting new session';
} else {

$unhashdir = '';
if (!setupSession1($_COOKIE['makedir'],$unhashdir)) {
die ('Could not start upload session');

exit;
}

$sess = session_start(); //
echo 'psession running='.$sess;

}


/// hideme
echo 'pre';
echo 'prequest uri'.$_SERVER['REQUEST_URI'];
if ($_SERVER['REQUEST_METHOD']==POST) {
$v = print_r($_POST,true);
echo 'ppost:br'.$v;
}

$v = print_r($_COOKIE,true);
echo 'pCookie:br'.$v;

$v = print_r($_SESSION,true);
echo 'pSession:br'.$v;
echo '/pre';
/// end hideme


if(isset($_COOKIE[PHPSESSID]))
  {
echo 'p/psession started';
if (isset( $_SESSION['test'])  ) {
   $_SESSION['test'] ++;
} else {
$_SESSION['test'] =0;
}
  }
  else
  {
echo pno session id;
  }

exit;

// **//
 // Functions AND Sub-routines 
///

 // **//



function setupSession1($mydir,$plaindir) {

// change the session save directory to our new folder
// $ mydir is encrypted
// $plaindir is unencrypted if available
$rt = false;
if ($plaindir != '' ) {
$mydir = $plaindir;
} else {
$plaindir = 'upload/'.cfFindHashDir($mydir) ;
$mydir = $plaindir;
}
if ($mydir == '') {
$rt = false;
} else {
			$tempdir = 
$_SERVER['DOCUMENT_ROOT']./.$mydir.'/tmpZrtg/fe234/dafsksfe' ;


if( !is_dir($tempdir) ) {
Rmkdir($tempdir);   
}
  if( is_dir($tempdir) ){
ini_set( 'session.save_path',$tempdir );

ini_set('session.gc_maxlifetime',(60*3600*5.0));  //5.0 hours keep 
session alive X hours

ini_set('session.gc_probability',1); //never 
empty the garbage???
ini_set('session.gc_divisor',1);


}
$rt = is_dir($tempdir);
}
return $rt;
}   

function startNewSession() {
$unhashdir = makeSaveDir(); 
// save SaveDir encrypted
//log_error('New directory ='.$unhashdir);
$newdir =cfSha256($unhashdir); //*^

//echo 'pNew session started!!:'.$sess. id:.session_id(); //

$_SESSION['SaveDir'] = $newdir;
ini_set(session.use_only_cookies, 0);  //do not use cookies 
only
ini_set('session.cookie_secure',true);
ini_set('session.use_cookies',0);

setupSession1('',$unhashdir);  

[PHP] Re: Session problem

2010-12-21 Thread Walter Caielli
I've fixed the problem.
I don't know why, but suddenly windows prevents PHP from writing into 
C:\windows\temp directory.
Moving the session and log files to another directory solved the problem.
Until few days ago it worked. I've now to discovered what was changed in 
windows configuration.



Walter Caielli walter.caie...@ars21.net ha scritto nel messaggio 
news:bd.40.31041.b7a60...@pb1.pair.com...
 I'm facing the following basic problem:

 I have made two simple sample files to explain it:

 1st file:
 ?php
   session_start();
$_SESSION['SS_user'] = user000;
   echo $_SESSION['SS_user'];
   echo SID;
   echo br.session_id();
   echo 'br /a href=home.phppage 1/a';
 ?

 2nd file
 ?php
   session_start();
   echo file Homebr;
   echo session_name().'+'.session_id();
   echo $_SESSION['SS_user'];
 ?

 $_SESSION seems to be empty. Nothing is print. Session Name and session ID 
 are the same but it seems that $_SESSION is not shared across the two 
 files. No HTML is made before sessioni_start().
 Why?
 I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from 
 another PC inside a LAN.

 Many thanks
 Walter


 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session problem

2010-12-21 Thread Ravi Gehlot
Walter,

Session variables may be using cookies which in turn create temp files for
storing such cookies.

Ravi.


On Tue, Dec 21, 2010 at 11:32 AM, Walter Caielli
walter.caie...@ars21.netwrote:

 I've fixed the problem.
 I don't know why, but suddenly windows prevents PHP from writing into
 C:\windows\temp directory.
 Moving the session and log files to another directory solved the problem.
 Until few days ago it worked. I've now to discovered what was changed in
 windows configuration.



 Walter Caielli walter.caie...@ars21.net ha scritto nel messaggio
 news:bd.40.31041.b7a60...@pb1.pair.com...
  I'm facing the following basic problem:
 
  I have made two simple sample files to explain it:
 
  1st file:
  ?php
session_start();
 $_SESSION['SS_user'] = user000;
echo $_SESSION['SS_user'];
echo SID;
echo br.session_id();
echo 'br /a href=home.phppage 1/a';
  ?
 
  2nd file
  ?php
session_start();
echo file Homebr;
echo session_name().'+'.session_id();
echo $_SESSION['SS_user'];
  ?
 
  $_SESSION seems to be empty. Nothing is print. Session Name and session
 ID
  are the same but it seems that $_SESSION is not shared across the two
  files. No HTML is made before sessioni_start().
  Why?
  I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from
  another PC inside a LAN.
 
  Many thanks
  Walter
 
 
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: SESSION variables: How much is too much?

2009-07-10 Thread kranthi
I prefer to reduce SESSION usage as much as possible. but I dont hesitate to
use them if need arises.
Points to note

   - Execution time: Only session_id is stored on the client's computer, and
   the actual data is stored on the server. so it will take nearly same time to
   process 100 session vars and 1 session var.
   - Security: While passing data trough hidden form fields, it is easy for
   the user to be change it. but its impossible (the user can change the
   session_id though) for the user to change the data stored in a session.
   - register_globals: i always set this off. but my host turned this on.
   had to spend 2 full days to find out what the problem was.

coming back to you issue: IMHO storing stuff like MaxDisplayRecords,
DefaultDisplayRecords, etc., in a SESSION var is the best solution.
alternatives being

   - Hidden fields: this will add to unnecessary network traffic.
   - Use separate file: Why use a separate file if PHP does the job for you?
   - Use the database: If you have an existing connection this is OK. But
   this will become a bottle neck if u dont have an existing connection


[PHP] Re: SESSION variables: How much is too much?

2009-07-09 Thread tedd

At 7:30 PM -0400 7/8/09, D.M.Jackson wrote:

Thanks guys.  I was just wondering if it was common practice to pass all
those variables in the SESSION object or if I was following a bad example
because it was the first time that I had seen so many variables passed this
way.  If this is the typical way of handling this in php then I don't have a
problem with it, I just wanted to make sure that I wasn't getting off to a
bad start and picking up bad habits while learning php.

Thanks,
Mark



Mark:

As a personal choice, I try to reduce the number of variables I carry 
in sessions as much as possible. To me sessions are similar to 
Globals and Globals create an environment that is generally not 
conducive to writing self-contained and reusable code.


Typically when I'm dealing with many variables, the variables are 
usually contained in a database. If this is the case, then I only 
pass the id of the record in a session and allow the page to open the 
database to retrieve the variables it needs. I have found that the 
more session variables you pass, the more complicated the code.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION variables: How much is too much?

2009-07-09 Thread D.M.Jackson
Hi,

OK, I did a count on the session.inc file and there appears to be 37 
variables accessed through the $_SESSION object.  By and large they all 
appear to be scalar variables that contain a counter or a path or a boolean. 
Nothing that looks like a big object.  Mostly stuff like MaxDisplayRecords, 
DefaultDisplayRecords, Theme, DefaultTheme, CustomerId, RealName, 
CustomerBranch, Module, UserStockLocation, PageSize, AccessLevel, 
AttemptsCounter, Language, PageSecurityToken, DatabaseName...etc.
Initially, when you hit the index page the session.inc file is included. 
From there, depending on what choices you make from the options displayed it 
assembles a page by calling the a php file that calls the database if 
needed, includes a header.inc file and a footer.inc file and builds the 
appropriate html for the body and of course, includes the session.inc file.
My question is, assuming 37 variables of this type in the 
session.inc file, at what level of concurrent user access do you consider 
changing the way you do business here.  Bare in mind that I don't comprehend 
a whole lot about server and database clustering and big enterprise big iron 
stuff like that.  I'm just a guy trying to learn how to write decent php 
code that I don't have to be embarassed of when I shift gears in a new 
direction to add a marketable skill in my career development path.

Thanks,
Mark






Paul M Foster pa...@quillandmouse.com wrote in message 
news:20090709010528.gx14...@quillandmouse.com...
 On Wed, Jul 08, 2009 at 06:55:24PM -0500, Shawn McKenzie wrote:

 D.M.Jackson wrote:
  Thanks guys.  I was just wondering if it was common practice to pass 
  all
  those variables in the SESSION object or if I was following a bad 
  example
  because it was the first time that I had seen so many variables passed 
  this
  way.  If this is the typical way of handling this in php then I don't
 have a
  problem with it, I just wanted to make sure that I wasn't getting off 
  to a
  bad start and picking up bad habits while learning php.
 
  Thanks,
  Mark

 Again, it depends upon whether you need those variables in the next
 page for example.  Think of a wizard, where you fill some values in a
 form, click next, fill more values, click next, etc and then click
 finish.  You may want to pass the values from each page to the next via
 the session and ultimately have them all available in the last page.
 There are others ways to do this, such as adding them as hidden inputs
 in the next pages, but I personally would use sessions.

 One other example might be user info, id, username, firstname, lastname,
 current access role etc.  You may use these on every page, so once you
 retrieve them from the db, you can store them in the session.  Any other
 info like email, age, register date whatever, you can retrieve only when
 needed.

 Just to provide a counterpoint to this, I would discourage using
 $_SESSION for more than absolutely necessary. If I have a situation such
 as Shawn mentions above, I pass values via hidden fields in the form.
 Most of the forms I create are backed by a database, so mostly I capture
 data from there. In addition, you can serialize data you wish to save
 and store it in a database or hidden field, and then unserialize it upon
 painting the next page.

 If I'm not mistaken, there's a limit to the data which can be stored in
 a session variable. I don't want to mistakenly hit that limit and wonder
 what happened. And besides, I just think $_SESSION should be reserved
 for *special* cases.

 And, as mentioned before, it's worthwhile asking yourself if you
 *really* need to remember a bunch of information from page to page. The
 need to do so may well be a result of lazy programming habits.

 Paul

 -- 
 Paul M. Foster 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION variables: How much is too much?

2009-07-08 Thread Shawn McKenzie
D.M.Jackson wrote:
 Hi,
 
 I'm trying to learn php mostly by reading the docs and pulling through 
 other peoples projects for reference examples.  One particular application 
 I'm looking at has a ton of variables being handled through the SESSION 
 global variable, probably about 25 or so variables.  That just seems like 
 alot.

 Since I'm pretty new to php I was wondering if this was typical and 
 acceptable or if there was another best practice for maintaining large 
 amounts of information throughout a session, like maybe persisting a 
 temporary object in the database and passing a connection...or something. 
 Or is just passing around a pile of variables directly in the SESSION object 
 better?
 
 Thanks,
 Mark 

There is no difference between using session vars and storing vars in a
file/db and retrieving them every page load yourself.  It's really the
same thing except sessions are more automagic.  The main differences are
that you of course reduce some overhead if you only need certain vars on
certain pages or if you need them infrequently then you can
store/retrieve them yourself.

As far as a large amount of large objects, if you don't need them every
page load then you may want to look at stuffing them in a db and only
retrieving then when needed.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION variables: How much is too much?

2009-07-08 Thread Al



Shawn McKenzie wrote:

D.M.Jackson wrote:

Hi,

I'm trying to learn php mostly by reading the docs and pulling through 
other peoples projects for reference examples.  One particular application 
I'm looking at has a ton of variables being handled through the SESSION 
global variable, probably about 25 or so variables.  That just seems like 
alot.


Since I'm pretty new to php I was wondering if this was typical and 
acceptable or if there was another best practice for maintaining large 
amounts of information throughout a session, like maybe persisting a 
temporary object in the database and passing a connection...or something. 
Or is just passing around a pile of variables directly in the SESSION object 
better?


Thanks,
Mark 


There is no difference between using session vars and storing vars in a
file/db and retrieving them every page load yourself.  It's really the
same thing except sessions are more automagic.  The main differences are
that you of course reduce some overhead if you only need certain vars on
certain pages or if you need them infrequently then you can
store/retrieve them yourself.

As far as a large amount of large objects, if you don't need them every
page load then you may want to look at stuffing them in a db and only
retrieving then when needed.




Shawn's right, just start using them. I was reluctant when I first started using 
PHP just because they seemed so special. Now, I use them for just about every 
page in an application.


In fact, I'd like to session constants.

Al.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION variables: How much is too much?

2009-07-08 Thread D.M.Jackson
Thanks guys.  I was just wondering if it was common practice to pass all 
those variables in the SESSION object or if I was following a bad example 
because it was the first time that I had seen so many variables passed this 
way.  If this is the typical way of handling this in php then I don't have a 
problem with it, I just wanted to make sure that I wasn't getting off to a 
bad start and picking up bad habits while learning php.

Thanks,
Mark


D.M.Jackson cnoe...@catt.com wrote in message 
news:90.23.10517.08e14...@pb1.pair.com...
 Hi,

I'm trying to learn php mostly by reading the docs and pulling through 
 other peoples projects for reference examples.  One particular application 
 I'm looking at has a ton of variables being handled through the SESSION 
 global variable, probably about 25 or so variables.  That just seems like 
 alot.

Since I'm pretty new to php I was wondering if this was typical and 
 acceptable or if there was another best practice for maintaining large 
 amounts of information throughout a session, like maybe persisting a 
 temporary object in the database and passing a connection...or something. 
 Or is just passing around a pile of variables directly in the SESSION 
 object better?

 Thanks,
 Mark
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION variables: How much is too much?

2009-07-08 Thread Shawn McKenzie
D.M.Jackson wrote:
 Thanks guys.  I was just wondering if it was common practice to pass all 
 those variables in the SESSION object or if I was following a bad example 
 because it was the first time that I had seen so many variables passed this 
 way.  If this is the typical way of handling this in php then I don't have a 
 problem with it, I just wanted to make sure that I wasn't getting off to a 
 bad start and picking up bad habits while learning php.
 
 Thanks,
 Mark

Again, it depends upon whether you need those variables in the next
page for example.  Think of a wizard, where you fill some values in a
form, click next, fill more values, click next, etc and then click
finish.  You may want to pass the values from each page to the next via
the session and ultimately have them all available in the last page.
There are others ways to do this, such as adding them as hidden inputs
in the next pages, but I personally would use sessions.

One other example might be user info, id, username, firstname, lastname,
current access role etc.  You may use these on every page, so once you
retrieve them from the db, you can store them in the session.  Any other
info like email, age, register date whatever, you can retrieve only when
needed.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION variables: How much is too much?

2009-07-08 Thread Paul M Foster
On Wed, Jul 08, 2009 at 06:55:24PM -0500, Shawn McKenzie wrote:

 D.M.Jackson wrote:
  Thanks guys.  I was just wondering if it was common practice to pass all
  those variables in the SESSION object or if I was following a bad example
  because it was the first time that I had seen so many variables passed this
  way.  If this is the typical way of handling this in php then I don't
 have a
  problem with it, I just wanted to make sure that I wasn't getting off to a
  bad start and picking up bad habits while learning php.
 
  Thanks,
  Mark
 
 Again, it depends upon whether you need those variables in the next
 page for example.  Think of a wizard, where you fill some values in a
 form, click next, fill more values, click next, etc and then click
 finish.  You may want to pass the values from each page to the next via
 the session and ultimately have them all available in the last page.
 There are others ways to do this, such as adding them as hidden inputs
 in the next pages, but I personally would use sessions.
 
 One other example might be user info, id, username, firstname, lastname,
 current access role etc.  You may use these on every page, so once you
 retrieve them from the db, you can store them in the session.  Any other
 info like email, age, register date whatever, you can retrieve only when
 needed.

Just to provide a counterpoint to this, I would discourage using
$_SESSION for more than absolutely necessary. If I have a situation such
as Shawn mentions above, I pass values via hidden fields in the form.
Most of the forms I create are backed by a database, so mostly I capture
data from there. In addition, you can serialize data you wish to save
and store it in a database or hidden field, and then unserialize it upon
painting the next page.

If I'm not mistaken, there's a limit to the data which can be stored in
a session variable. I don't want to mistakenly hit that limit and wonder
what happened. And besides, I just think $_SESSION should be reserved
for *special* cases.

And, as mentioned before, it's worthwhile asking yourself if you
*really* need to remember a bunch of information from page to page. The
need to do so may well be a result of lazy programming habits.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables

2009-02-07 Thread Nathan Rixham

Paul M Foster wrote:

I'm not too clear on HTTP headers, cookies, and such. So here are
questions related to that. Let's say I generate a random number that I
want the user to enter in a form. When I generate the number, I store it
in a session variable ($_SESSION). When the user submits the form, I
check the number they enter with what I've stored in the session
variable.

Since this session variable survives across page loads (assuming
session_start() is appropriately called), how is it stored and recalled?

Is it automatically stored as a cookie on the user's system? 

Or is it stored on the server? 

And how does a server get a cookie? 

Is it a separate request made by the server to the client? 


If the value I've asked the user for is *not* stored as a cookie, then
is it passed as part of the HTTP submission or what?

Thanks for any enlightenment on this.

Paul



seeing as you're a voomer here's a very mini explanation

session has an id

a:
session id is passed to a user in the http headers
users client gets sessionid and stores it in a cookie
users client sends cookie with sessionid in it back to website every 
page load



b:
on the server a small file is stored in a temp directory containing all 
the stuff you've stored in session

the file is named with the session id
when php recieves a request, with a cookie, with a session id in it, 
then it grabs the related server side session files, pulls the variables 
from it an makes them available to you in $_SESSION.


v simple :p

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session won't pick up one variable

2009-01-31 Thread Terion Miller
On Fri, Jan 30, 2009 at 5:44 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Terion Miller wrote:
  Well I changed it because it's not a post since its not coming from a
 form
  is this closer?
 
  if (!empty($UserName)) {
 

 Why are you doing this?  Only to see if  0 rows are returned?  You can
 use the results you know.
  $sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
  `UserName`='$UserName' and`Password`='$Password';
  $result = mysql_query ($sql);
  $row = mysql_fetch_object ($result);

 Do you maybe mean $row['AdminID']?  Well you're using objects now so
 $row-AdminID?
  $AdminId = $_SESSION['AdminID'];
 

 What in the hell are you doing here?  If it's set then set it again to
 equal itself?
 if(isset($_SESSION['AdminID']))
  $_SESSION['AdminID'] = $_SESSION['AdminID'];
  else
  $_SESSION['AdminID'] = $AdminID;
 
  If (mysql_num_rows($result)  0) {
  $_SESSION['AdminLogin'] = true;
  $_SESSION['user']=$UserName;
  $_SESSION['AdminID']=$AdminID;
 
  header ('Location: Main.php');
  exit;
  } else {

 You either need to get a good PHP book or pay much closer attention to
 what you're doing.  Many more problems, but those seem to cause your
 issue.  This is not complete but seems to be the structure you need:

 session_start();
 include(inc/dbconn_open.php);

 if (!empty($_POST['UserName'])  !empty($_POST['Password'])) {
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
 `UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);

 If (mysql_num_rows($result)  0) {
$_SESSION['AdminLogin'] = true;
$_SESSION['user'] = $UserName;
 $_SESSION['AdminID'] = $row-AdminID;

header ('Location: Main.php');
exit;
} else {


 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 yep I had actually tried your way my first try because it seemed to be what
exactly it should do, but I get a blank pageno errors just a blank page,
so I was suggested by someone else it was that the AdminID is not set, so
that is why I was attempting to set it
And for the record I have two O'reilly books on php...programming php, and
web database applications with php, and the sessions section pretty much
includes:
session_start()
and the oh so helpful $_SESSION($BLAH) = 'BLAH'
I couldn't find anything about how to pull a result from the db and then use
it to set a session, well anything past what seem to be common sense, to
just put it after the query...and it does not pick up the adminID, and I've
also tried another suggestion and also get a blank page, should I be setting
the AdminID session on the page after the login?
Here was the other way I tried :
$UserName = (isset($_POST['UserName'])) ? mysql_real_escape_string($_POST[
'UserName']) : '';
$Password = (isset($_POST['Password'])) ? mysql_real_escape_string($_POST[
'Password']) : '';

if (!empty($UserName)) {
$sql = SELECT `AdminID`,`UserName`,`Password` FROM `admin` WHERE
`UserName`='$UserName';
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

   //If hashed passwords match proceed login
if (sha1($Password) == $row['Password']) { //granted the password was
sha1() before insertion into db
$_SESSION['AdminID'] = (isset($_SESSION['AdminID'])) ? $_SESSION[
'AdminID'] : $row['id'];
$_SESSION['AdminLogin'] = true;
$_SESSION['user'] = $UserName;
header ('Location: Main.php');
}
}


Re: [PHP] Re: Session won't pick up one variable (SOLVED)

2009-01-31 Thread Terion Miller
thanks got it fixed:
if (!empty($_POST['UserName'])  !empty($_POST['Password'])) {
   $UserName = $_POST['UserName'];
   $Password = $_POST['Password'];
}  *---was missing a curly bracket..oi syntax*


$msg = '';

if (!empty($UserName)) {

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
`UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);




 If (mysql_num_rows($result)  0) {
   $_SESSION['AdminLogin'] = true;
   $_SESSION['user'] = $UserName;
   $_SESSION['AdminID'] = $row-AdminID;


header ('Location: Main.php');
exit;


[PHP] Re: Session won't pick up one variable

2009-01-30 Thread Terion Miller
Well I changed it because it's not a post since its not coming from a form
is this closer?

?php
//start session
session_start();
//db connection include
include(inc/dbconn_open.php) ;
//errors on
error_reporting(E_ALL);
ini_set('display_errors', '1');

if (isset($_POST['UserName'])) {$UserName = $_POST['UserName'];} else
{$UserName = '';}
if (isset($_POST['Password'])) {$Password = $_POST['Password'];} else
{$Password = '';}

$msg = '';

if (!empty($UserName)) {

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
`UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);
$AdminId = $_SESSION['AdminID'];

   if(isset($_SESSION['AdminID']))
$_SESSION['AdminID'] = $_SESSION['AdminID'];
else
$_SESSION['AdminID'] = $AdminID;

If (mysql_num_rows($result)  0) {
$_SESSION['AdminLogin'] = true;
$_SESSION['user']=$UserName;
$_SESSION['AdminID']=$AdminID;

header ('Location: Main.php');
exit;
} else {

On Fri, Jan 30, 2009 at 4:20 PM, Terion Miller webdev.ter...@gmail.comwrote:

 Think I'm setting this in the wrong place...someone help ...where do I set
 the AdminID session

 if (isset($_POST['UserName'])) {$UserName = $_POST['UserName'];} else
 {$UserName = '';}
 if (isset($_POST['Password'])) {$Password = $_POST['Password'];} else
 {$Password = '';}

 $msg = '';

 if (!empty($UserName)) {

 $sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
 `UserName`='$UserName' and`Password`='$Password';
 $result = mysql_query ($sql);
 $row = mysql_fetch_object ($result);

 if (isset($_POST['AdminID'])) {$AdminID = $_POST['AdminID'];} else
 {$AdminID= '';}

 If (mysql_num_rows($result)  0) {
 $_SESSION['AdminLogin'] = true;
 $_SESSION['user']=$UserName;
 $_SESSION['AdminID']=$AdminID;

 header ('Location: Main.php');
 exit;
 } else {



[PHP] Re: Session won't pick up one variable

2009-01-30 Thread Shawn McKenzie
Terion Miller wrote:
 Well I changed it because it's not a post since its not coming from a form
 is this closer?
 
 if (!empty($UserName)) {
 

Why are you doing this?  Only to see if  0 rows are returned?  You can
use the results you know.
 $sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
 `UserName`='$UserName' and`Password`='$Password';
 $result = mysql_query ($sql);
 $row = mysql_fetch_object ($result);

Do you maybe mean $row['AdminID']?  Well you're using objects now so
$row-AdminID?
 $AdminId = $_SESSION['AdminID'];
 

What in the hell are you doing here?  If it's set then set it again to
equal itself?
if(isset($_SESSION['AdminID']))
 $_SESSION['AdminID'] = $_SESSION['AdminID'];
 else
 $_SESSION['AdminID'] = $AdminID;
 
 If (mysql_num_rows($result)  0) {
 $_SESSION['AdminLogin'] = true;
 $_SESSION['user']=$UserName;
 $_SESSION['AdminID']=$AdminID;
 
 header ('Location: Main.php');
 exit;
 } else {

You either need to get a good PHP book or pay much closer attention to
what you're doing.  Many more problems, but those seem to cause your
issue.  This is not complete but seems to be the structure you need:

session_start();
include(inc/dbconn_open.php);

if (!empty($_POST['UserName'])  !empty($_POST['Password'])) {
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
`UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);

If (mysql_num_rows($result)  0) {
$_SESSION['AdminLogin'] = true;
$_SESSION['user'] = $UserName;
$_SESSION['AdminID'] = $row-AdminID;

header ('Location: Main.php');
exit;
} else {


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-03 Thread Nathan Rixham

Micah Gersten wrote:
  You really should get up to speed on PHP 5.

Micah Gersten wrote:

I was referring to Nathan's examples which you cut out of the post.

function save_to_session( ) {
 global $userids , $first , $last;
 $_SESSION['user_id'] = $userids;
 $_SESSION['first_name'] = $first;
 $_SESSION['last_name']= $last;
}




ahh I thought that but didn't want to assume; I am actually strictly 
PHP5.2+/OO and flat out refuse to use globals (preference to static 
class variables), and keep session usage to a minimum.


However the example I gave tedd was the only way in which I could create 
code to replicate his error (explaining the passing a variable by 
reference to session, the redefining of that referenced array as a 
string within the for loop and so on).


This actually turned out to be register globals turned on; however it's 
been so dang long since I used them, (and indeed anything pre-php5), 
that I forget register globals even existed; thus replicated it's 
functionality. [lol]


Regards!

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread tedd

At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:

[tested - works]
-snip-
?
regards! nathan :)


I need to re-address this.. tedd your original code works fine over 
here; as does the code I sent you, and the code jay submitted first..


do us a favour, copy and paste exactly what I just handed through 
and run it; are the results correct?


To all:

The code provided by nathan works for me as well. However, the 
problem is not easily explained, but I can demonstrate it -- try this:


http://www.webbytedd.com/zzz/index.php

* A complete listing of the code follows the demo.

When the code is first loaded, the session variables are defined and 
populated. Proof of this is shown in the top left corner of the page, 
which reports:


Cable Diane
Ron Big
Dirt Joe

Now click the Continue button and you will be presented with the 
next step which shows a list of the SESSION variables in both the top 
left corner AND immediately below Step 2. Everything is righteous 
to there.


However, the next portion of the code is the foreach loop where the 
first SESSION pair is output correctly, but the rest aren't.


This is followed by another listing of the SESSION variables and this 
time is shows that they have completely disappeared.


Okay gang -- what's up with that?

Cut and paste the code and see for yourself.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Andrew Ballard
On Thu, Oct 2, 2008 at 10:37 AM, tedd [EMAIL PROTECTED] wrote:
 To all:

 The code provided by nathan works for me as well. However, the problem is
 not easily explained, but I can demonstrate it -- try this:

 http://www.webbytedd.com/zzz/index.php

 * A complete listing of the code follows the demo.

 When the code is first loaded, the session variables are defined and
 populated. Proof of this is shown in the top left corner of the page, which
 reports:

 Cable Diane
 Ron Big
 Dirt Joe

 Now click the Continue button and you will be presented with the next step
 which shows a list of the SESSION variables in both the top left corner AND
 immediately below Step 2. Everything is righteous to there.

 However, the next portion of the code is the foreach loop where the first
 SESSION pair is output correctly, but the rest aren't.

 This is followed by another listing of the SESSION variables and this time
 is shows that they have completely disappeared.

 Okay gang -- what's up with that?

 Cut and paste the code and see for yourself.

 Cheers,

 tedd

tedd,

Is there any chance that session variables are getting auto
registered? The fact that the second time through the loop is
outputting the second letter of each name looks like $first_name is
bound to $_SESSION['first_name'] and $last_name is bound to
$_SESSION['last_name'].

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Jay Moore

tedd wrote:

At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:

[tested - works]
-snip-
?
regards! nathan :)


I need to re-address this.. tedd your original code works fine over 
here; as does the code I sent you, and the code jay submitted first..


do us a favour, copy and paste exactly what I just handed through and 
run it; are the results correct?


To all:

The code provided by nathan works for me as well. However, the problem 
is not easily explained, but I can demonstrate it -- try this:


http://www.webbytedd.com/zzz/index.php

* A complete listing of the code follows the demo.

When the code is first loaded, the session variables are defined and 
populated. Proof of this is shown in the top left corner of the page, 
which reports:


Cable Diane
Ron Big
Dirt Joe

Now click the Continue button and you will be presented with the next 
step which shows a list of the SESSION variables in both the top left 
corner AND immediately below Step 2. Everything is righteous to there.


However, the next portion of the code is the foreach loop where the 
first SESSION pair is output correctly, but the rest aren't.


This is followed by another listing of the SESSION variables and this 
time is shows that they have completely disappeared.


Okay gang -- what's up with that?

Cut and paste the code and see for yourself.

Cheers,

tedd



Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do you?

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Jay Moore

Jay Moore wrote:

tedd wrote:

At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:

[tested - works]
-snip-
?
regards! nathan :)


I need to re-address this.. tedd your original code works fine over 
here; as does the code I sent you, and the code jay submitted first..


do us a favour, copy and paste exactly what I just handed through and 
run it; are the results correct?


To all:

The code provided by nathan works for me as well. However, the problem 
is not easily explained, but I can demonstrate it -- try this:


http://www.webbytedd.com/zzz/index.php

* A complete listing of the code follows the demo.

When the code is first loaded, the session variables are defined and 
populated. Proof of this is shown in the top left corner of the page, 
which reports:


Cable Diane
Ron Big
Dirt Joe

Now click the Continue button and you will be presented with the 
next step which shows a list of the SESSION variables in both the top 
left corner AND immediately below Step 2. Everything is righteous to 
there.


However, the next portion of the code is the foreach loop where the 
first SESSION pair is output correctly, but the rest aren't.


This is followed by another listing of the SESSION variables and this 
time is shows that they have completely disappeared.


Okay gang -- what's up with that?

Cut and paste the code and see for yourself.

Cheers,

tedd



Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do 
you?


Jay


Try these options (separately):

1) Change your first and third entries (so Joe Dirt is 0 and Cable Diane 
is 2).  See if your 2nd output is now '1 o i'.


2) Change your storage variables ($first_name and $last_name) to 
something other than the key values of your session array (ex:  $fname 
and $lname).  See if that works.


Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Thiago H. Pojda



 Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do you?

 Jay

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 It must be. I just ran tedd's example in both scenarios.

 With register_globals = Off it works like a charm.
 With register_globals = On I get the same output tedd does.

 register_globals = on:

 Problem

 Step 2 --

 Cable Diane
 Ron Big
 Dirt Joe

 0 Cable Diane

 1 a i

 2

 register_globals = Off:

 Step 2 --

 Cable Diane
 Ron Big
 Dirt Joe

 0 Cable Diane

 1 Ron Big

 2 Dirt Joe

 Cable Diane
 Ron Big
 Dirt Joe


 --
 Thiago Henrique Pojda


 Forgot my blog url, php list doesn't like it :)

 --
 Thiago Henrique Pojda


Okay, gmail must be playing with me... 3rd email rejected by spammy url

--
Thiago Henrique Pojda

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Afan Pasalic


Andrew Ballard wrote:
 On Thu, Oct 2, 2008 at 10:37 AM, tedd [EMAIL PROTECTED] wrote:
   
 To all:

 The code provided by nathan works for me as well. However, the problem is
 not easily explained, but I can demonstrate it -- try this:

 http://www.webbytedd.com/zzz/index.php

 * A complete listing of the code follows the demo.

 When the code is first loaded, the session variables are defined and
 populated. Proof of this is shown in the top left corner of the page, which
 reports:

 Cable Diane
 Ron Big
 Dirt Joe

 Now click the Continue button and you will be presented with the next step
 which shows a list of the SESSION variables in both the top left corner AND
 immediately below Step 2. Everything is righteous to there.

 However, the next portion of the code is the foreach loop where the first
 SESSION pair is output correctly, but the rest aren't.

 This is followed by another listing of the SESSION variables and this time
 is shows that they have completely disappeared.

 Okay gang -- what's up with that?

 Cut and paste the code and see for yourself.

 Cheers,

 tedd
 
tedd,

could you please in foreach loop (on your website) add one echo line:
  
  foreach( $_SESSION['user_id'] as $index = $value )
  {
echo '- '.$index.': '.$value.'br';
$last_name = $_SESSION['last_name'][$index];
$first_name = $_SESSION['first_name'][$index];
echo(p$index $last_name $first_name/p);
  }


thanks

-afan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Jim Lucas
tedd wrote:
 At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:
 [tested - works]
 -snip-
 ?
 regards! nathan :)

 I need to re-address this.. tedd your original code works fine over
 here; as does the code I sent you, and the code jay submitted first..

 do us a favour, copy and paste exactly what I just handed through and
 run it; are the results correct?
 
 To all:
 
 The code provided by nathan works for me as well. However, the problem
 is not easily explained, but I can demonstrate it -- try this:
 
 http://www.webbytedd.com/zzz/index.php
 
 * A complete listing of the code follows the demo.
 
 When the code is first loaded, the session variables are defined and
 populated. Proof of this is shown in the top left corner of the page,
 which reports:
 
 Cable Diane
 Ron Big
 Dirt Joe
 
 Now click the Continue button and you will be presented with the next
 step which shows a list of the SESSION variables in both the top left
 corner AND immediately below Step 2. Everything is righteous to there.
 
 However, the next portion of the code is the foreach loop where the
 first SESSION pair is output correctly, but the rest aren't.
 
 This is followed by another listing of the SESSION variables and this
 time is shows that they have completely disappeared.
 
 Okay gang -- what's up with that?
 
 Cut and paste the code and see for yourself.
 
 Cheers,
 
 tedd
 

Well, I would have to say it is a configuration issue on your server.

Here is the results for my test with your code.  Works fine.

http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/002.php

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Jim Lucas
Jim Lucas wrote:
 tedd wrote:
 At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:
 [tested - works]
 -snip-
 ?
 regards! nathan :)
 I need to re-address this.. tedd your original code works fine over
 here; as does the code I sent you, and the code jay submitted first..

 do us a favour, copy and paste exactly what I just handed through and
 run it; are the results correct?
 To all:

 The code provided by nathan works for me as well. However, the problem
 is not easily explained, but I can demonstrate it -- try this:

 http://www.webbytedd.com/zzz/index.php

 * A complete listing of the code follows the demo.

 When the code is first loaded, the session variables are defined and
 populated. Proof of this is shown in the top left corner of the page,
 which reports:

 Cable Diane
 Ron Big
 Dirt Joe

 Now click the Continue button and you will be presented with the next
 step which shows a list of the SESSION variables in both the top left
 corner AND immediately below Step 2. Everything is righteous to there.

 However, the next portion of the code is the foreach loop where the
 first SESSION pair is output correctly, but the rest aren't.

 This is followed by another listing of the SESSION variables and this
 time is shows that they have completely disappeared.

 Okay gang -- what's up with that?

 Cut and paste the code and see for yourself.

 Cheers,

 tedd

 
 Well, I would have to say it is a configuration issue on your server.
 
 Here is the results for my test with your code.  Works fine.
 
 http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/002.php
 

With RG off, it works as expected.  But, with RG on it gives the results he
was seeing.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems UPDATE

2008-10-02 Thread Nathan Rixham

Jim Lucas wrote:

Jim Lucas wrote:

tedd wrote:

At 11:10 PM +0100 10/1/08, Nathan Rixham wrote:

[tested - works]
-snip-
?
regards! nathan :)

I need to re-address this.. tedd your original code works fine over
here; as does the code I sent you, and the code jay submitted first..

do us a favour, copy and paste exactly what I just handed through and
run it; are the results correct?

To all:

The code provided by nathan works for me as well. However, the problem
is not easily explained, but I can demonstrate it -- try this:

http://www.webbytedd.com/zzz/index.php

* A complete listing of the code follows the demo.

When the code is first loaded, the session variables are defined and
populated. Proof of this is shown in the top left corner of the page,
which reports:

Cable Diane
Ron Big
Dirt Joe

Now click the Continue button and you will be presented with the next
step which shows a list of the SESSION variables in both the top left
corner AND immediately below Step 2. Everything is righteous to there.

However, the next portion of the code is the foreach loop where the
first SESSION pair is output correctly, but the rest aren't.

This is followed by another listing of the SESSION variables and this
time is shows that they have completely disappeared.

Okay gang -- what's up with that?

Cut and paste the code and see for yourself.

Cheers,

tedd


Well, I would have to say it is a configuration issue on your server.

Here is the results for my test with your code.  Works fine.

http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/002.php



With RG off, it works as expected.  But, with RG on it gives the results he
was seeing.



that explains my earlier post on the matter:

in this case.. what's happened is:
$_SESSION['first_name'] is a reference to a variable $first (or whatever 
is in your for loop)
$_SESSION['last_name'] is a reference to a variable $last (or whatever 
is in your for loop)


when you've set $last and $first to string's in the for loop it's passed 
the variable by reference back to $_SESSION['first_name'] and 
$_SESSION['last_name'] as strings;


when it hit's the second iteration on the for loop it now has strings to 
deal with so uses the $key (holding integer 1 at this stage) as a string 
offset thus giving you the second character (offset [1]) of the string 
variables $last/$first. now set to 'cable'/'diane' thus giving you the 
'a'/'i'. when it does pass three there is no offset [2] so gives you 
nothing.


*phew*

reproduce code!

?php

$userids = array('6156','1234','8867');
$first = array('Diane','Big','Joe');
$last = array('Cable','Ron','Dirt');

function save_to_session( ) {
 global $userids , $first , $last;
 $_SESSION['user_id'] = $userids;
 $_SESSION['first_name'] = $first;
 $_SESSION['last_name']= $last;
}

save_to_session( );

print_r( $_SESSION );

$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++) {
$first = $_SESSION['first_name'][$i];
$last = $_SESSION['last_name'][$i];
echo $last, $first\n;
}
?

lol to think ti was just register globals - thats why i don't use globals!

ps: tedd; you could have got to the bottom of this earlier by having 
error reporting set to include notices :)


--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-02 Thread Micah Gersten


Nathan Rixham wrote:
 tedd wrote:
 At 3:41 PM -0400 10/1/08, tedd wrote:
 What about:

 foreach ($_SESSION['user_id'] as $key = $value)
 {
 $last = $_SESSION['last_name'][$key];
 $first = $_SESSION['first_name'][$key];
 echo $last, $first;
 }

 Jay:

 Close, it produced:

 Array, Array
 Array, Array
 Array, Array

 Cheers,

 tedd


 My error, if produced.


 Cable, Diane
 a, i

 While print_r($_SESSION); JUST BEFORE IT produced:

 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )

 [first_name] = Array
 (
 [0] = Diane
 [1] = first name
 [2] = Helen
 )

 [last_name] = Array
 (
 [0] = Cable
 [1] = CagoEsogs-temp (forum)
 [2] = Cahalane
 )

 Now, what wrong with this picture?

 Cheers,

 tedd

 tedd wrote:
  At 3:41 PM -0400 10/1/08, tedd wrote:
  What about:
 
  foreach ($_SESSION['user_id'] as $key = $value)
  {
  $last = $_SESSION['last_name'][$key];
  $first = $_SESSION['first_name'][$key];
  echo $last, $first;
  }
 
  Jay:
 
  Close, it produced:
 
  Array, Array
  Array, Array
  Array, Array
 
  Cheers,
 
  tedd
 
 
  My error, if produced.
 
 
  Cable, Diane
  a, i
 
  While print_r($_SESSION); JUST BEFORE IT produced:
 
  [user_id] = Array
  (
  [0] = 6156
  [1] = 7030
  [2] = 656
  )
 
  [first_name] = Array
  (
  [0] = Diane
  [1] = first name
  [2] = Helen
  )
 
  [last_name] = Array
  (
  [0] = Cable
  [1] = CagoEsogs-temp (forum)
  [2] = Cahalane
  )
 
  Now, what wrong with this picture?
 
  Cheers,
 
  tedd

 in this case.. what's happened is:
 $_SESSION['first_name'] is a reference to a variable $first (or
 whatever is in your for loop)
 $_SESSION['last_name'] is a reference to a variable $last (or whatever
 is in your for loop)

 when you've set $last and $first to string's in the for loop it's
 passed the variable by reference back to $_SESSION['first_name'] and
 $_SESSION['last_name'] as strings;

 when it hit's the second iteration on the for loop it now has strings
 to deal with so uses the $key (holding integer 1 at this stage) as a
 string offset thus giving you the second character (offset [1]) of the
 string variables $last/$first. now set to 'cable'/'diane' thus giving
 you the 'a'/'i'. when it does pass three there is no offset [2] so
 gives you nothing.

 *phew*

 reproduce code!

 ?php

 $userids = array('6156','1234','8867');
 $first = array('Diane','Big','Joe');
 $last = array('Cable','Ron','Dirt');

 function save_to_session( ) {
  global $userids , $first , $last;
  $_SESSION['user_id'] = $userids;
  $_SESSION['first_name'] = $first;
  $_SESSION['last_name']= $last;
 }

 save_to_session( );

 print_r( $_SESSION );

 $num_users = count($_SESSION['user_id']);

 for ($i = 0; $i  $num_users; $i++) {
 $first = $_SESSION['first_name'][$i];
 $last = $_SESSION['last_name'][$i];
 echo $last, $first\n;
 }
 ?

 Regards!


This looks like a bug.  If you are not modifying a variable with the
same name as the session variable, it should not change the session
variable.  Also, why are you assigning references to arrays?  What
version of PHP are you using?  You really should get up to speed on PHP 5.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-02 Thread tedd

At 11:14 AM -0500 10/2/08, Micah Gersten wrote:

 You really should get up to speed on PHP 5.


Yeah, I'll be sure to tell me clients that.

Sometimes you don't have a choice -- you have to work with what they got.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-02 Thread Micah Gersten
I was referring to Nathan's examples which you cut out of the post.
 function save_to_session( ) {
  global $userids , $first , $last;
  $_SESSION['user_id'] = $userids;
  $_SESSION['first_name'] = $first;
  $_SESSION['last_name']= $last;
 }


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



tedd wrote:
 At 11:14 AM -0500 10/2/08, Micah Gersten wrote:
  You really should get up to speed on PHP 5.

 Yeah, I'll be sure to tell me clients that.

 Sometimes you don't have a choice -- you have to work with what they got.

 Cheers,

 tedd


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread Jay Moore

tedd wrote:

Hi gang:

Apparently, there's something going on here that I don't understand -- 
this happens far too often these days.


Here's a print_r($_SESSION); of the session arrays I'm using:

[user_id] = Array
(
[0] = 6156
[1] = 7030
[2] = 656
)

[first_name] = Array
(
[0] = Diane
[1] = Fred
[2] = Helen
)

[last_name] = Array
(
[0] = Cable
[1] = Cago
[2] = Cahalan


The following is how I tried to access the data contained in the 
$_SESSION arrays:


$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++)
{
$last_name = $_SESSION['last_name'][$i];
$first_name = $_SESSION['first_name'][$i];
echo(p$last_name, $first_name/p);
}

The only thing that came out correct was the first echo. The remaining 
echos had no values for $first_name or $last_name.


What's happening here?

Cheers,

tedd


PS: I'm open to other suggestions as to how to do this.


What about:

foreach ($_SESSION['user_id'] as $key = $value)
{
$last = $_SESSION['last_name'][$key];
$first = $_SESSION['first_name'][$key];
echo $last, $first;
}


Disclaimer:  have not tested this, but it seemed logical in my head.

Disclaimer Disclaimer:  logic must fight with random other thoughts and 
often loses.


Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread tedd

What about:

foreach ($_SESSION['user_id'] as $key = $value)
{
$last = $_SESSION['last_name'][$key];
$first = $_SESSION['first_name'][$key];
echo $last, $first;
}


Jay:

Close, it produced:

Array, Array
Array, Array
Array, Array

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread Shawn McKenzie
tedd wrote:
 Hi gang:
 
 Apparently, there's something going on here that I don't understand --
 this happens far too often these days.
 
 Here's a print_r($_SESSION); of the session arrays I'm using:
 
 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )
 
 [first_name] = Array
 (
 [0] = Diane
 [1] = Fred
 [2] = Helen
 )
 
 [last_name] = Array
 (
 [0] = Cable
 [1] = Cago
 [2] = Cahalan
 
 
 The following is how I tried to access the data contained in the
 $_SESSION arrays:
 
 $num_users = count($_SESSION['user_id']);
 
 for ($i = 0; $i  $num_users; $i++)
 {
 $last_name = $_SESSION['last_name'][$i];
 $first_name = $_SESSION['first_name'][$i];
 echo(p$last_name, $first_name/p);
 }
 
 The only thing that came out correct was the first echo. The remaining
 echos had no values for $first_name or $last_name.
 
 What's happening here?
 
 Cheers,
 
 tedd
 
 
 PS: I'm open to other suggestions as to how to do this.

What do you get if you do a print_r($_SESSION) just before this loop?

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-01 Thread Ashley Sheridan
On Wed, 2008-10-01 at 15:41 -0400, tedd wrote:
 What about:
 
 foreach ($_SESSION['user_id'] as $key = $value)
 {
  $last = $_SESSION['last_name'][$key];
  $first = $_SESSION['first_name'][$key];
  echo $last, $first;
 }
 
 Jay:
 
 Close, it produced:
 
 Array, Array
 Array, Array
 Array, Array
 
 Cheers,
 
 tedd
 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 
That would suggest there's another level to the $_SESSION array. Are you
sure the data output from the print_r is right and nothing is acting on
it before your loop?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-01 Thread Afan Pasalic
tedd wrote:
 What about:

 foreach ($_SESSION['user_id'] as $key = $value)
 {
 $last = $_SESSION['last_name'][$key];
 $first = $_SESSION['first_name'][$key];
 echo $last, $first;
 }

 Jay:

 Close, it produced:

 Array, Array
 Array, Array
 Array, Array

 Cheers,

 tedd
then your $_SESSION is not what you think it is and print_r() output is
not correct.
:-)

-afan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread Shawn McKenzie
Shawn McKenzie wrote:
 tedd wrote:
 Hi gang:

 Apparently, there's something going on here that I don't understand --
 this happens far too often these days.

 Here's a print_r($_SESSION); of the session arrays I'm using:

 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )

 [first_name] = Array
 (
 [0] = Diane
 [1] = Fred
 [2] = Helen
 )

 [last_name] = Array
 (
 [0] = Cable
 [1] = Cago
 [2] = Cahalan


 The following is how I tried to access the data contained in the
 $_SESSION arrays:

 $num_users = count($_SESSION['user_id']);

 for ($i = 0; $i  $num_users; $i++)
 {
 $last_name = $_SESSION['last_name'][$i];
 $first_name = $_SESSION['first_name'][$i];
 echo(p$last_name, $first_name/p);
 }

 The only thing that came out correct was the first echo. The remaining
 echos had no values for $first_name or $last_name.

 What's happening here?

 Cheers,

 tedd


 PS: I'm open to other suggestions as to how to do this.
 
 What do you get if you do a print_r($_SESSION) just before this loop?
 
 -Shawn

Also, echo $num_users;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread tedd

At 2:40 PM -0500 10/1/08, Shawn McKenzie wrote:

tedd wrote:

 Hi gang:

 Apparently, there's something going on here that I don't understand --
 this happens far too often these days.

 Here's a print_r($_SESSION); of the session arrays I'm using:

 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )

 [first_name] = Array
 (
 [0] = Diane
 [1] = Fred
 [2] = Helen
 )

 [last_name] = Array
 (
 [0] = Cable
 [1] = Cago
 [2] = Cahalan


 The following is how I tried to access the data contained in the
 $_SESSION arrays:

 $num_users = count($_SESSION['user_id']);

 for ($i = 0; $i  $num_users; $i++)
 {
 $last_name = $_SESSION['last_name'][$i];
 $first_name = $_SESSION['first_name'][$i];
 echo(p$last_name, $first_name/p);
 }

 The only thing that came out correct was the first echo. The remaining
 echos had no values for $first_name or $last_name.

 What's happening here?

 Cheers,

 tedd


 PS: I'm open to other suggestions as to how to do this.


What do you get if you do a print_r($_SESSION) just before this loop?

-Shawn



I get the dump as shown above -- it's all there, I just can't get to 
it and thus my confusion.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread tedd

At 3:41 PM -0400 10/1/08, tedd wrote:

What about:

foreach ($_SESSION['user_id'] as $key = $value)
{
$last = $_SESSION['last_name'][$key];
$first = $_SESSION['first_name'][$key];
echo $last, $first;
}


Jay:

Close, it produced:

Array, Array
Array, Array
Array, Array

Cheers,

tedd



My error, if produced.


Cable, Diane
a, i

While print_r($_SESSION); JUST BEFORE IT produced:

[user_id] = Array
(
[0] = 6156
[1] = 7030
[2] = 656
)

[first_name] = Array
(
[0] = Diane
[1] = first name
[2] = Helen
)

[last_name] = Array
(
[0] = Cable
[1] = CagoEsogs-temp (forum)
[2] = Cahalane
)

Now, what wrong with this picture?

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

[PHP] Re: SESSION array problems

2008-10-01 Thread Nathan Rixham

tedd wrote:

Hi gang:

Apparently, there's something going on here that I don't understand -- 
this happens far too often these days.


Here's a print_r($_SESSION); of the session arrays I'm using:

[user_id] = Array
(
[0] = 6156
[1] = 7030
[2] = 656
)

[first_name] = Array
(
[0] = Diane
[1] = Fred
[2] = Helen
)

[last_name] = Array
(
[0] = Cable
[1] = Cago
[2] = Cahalan


The following is how I tried to access the data contained in the 
$_SESSION arrays:


$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++)
{
$last_name = $_SESSION['last_name'][$i];
$first_name = $_SESSION['first_name'][$i];
echo(p$last_name, $first_name/p);
}

The only thing that came out correct was the first echo. The remaining 
echos had no values for $first_name or $last_name.


What's happening here?

Cheers,

tedd


PS: I'm open to other suggestions as to how to do this.


ehh? i think everybody's looking too hard at this..

[tested - works]
?php

 $_SESSION['user_id'][] = '6156';
 $_SESSION['first_name'][]  = 'Diane';
 $_SESSION['last_name'][]= 'Cable';

 $_SESSION['user_id'][] = '1234';
 $_SESSION['first_name'][]  = 'Big';
 $_SESSION['last_name'][]= 'Ron';

 $_SESSION['user_id'][] = '8867';
 $_SESSION['first_name'][]  = 'Joe';
 $_SESSION['last_name'][]= 'Dirt';

 print_r( $_SESSION );

 foreach( $_SESSION['user_id'] as $index = $value ) {
   $last_name = $_SESSION['last_name'][$index];
   $first_name = $_SESSION['first_name'][$index];
   echo $last_name . ',' . $first_name . PHP_EOL;
 }
?

regards! nathan :)

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION array problems

2008-10-01 Thread Nathan Rixham

Nathan Rixham wrote:

tedd wrote:

Hi gang:

Apparently, there's something going on here that I don't understand -- 
this happens far too often these days.


Here's a print_r($_SESSION); of the session arrays I'm using:

[user_id] = Array
(
[0] = 6156
[1] = 7030
[2] = 656
)

[first_name] = Array
(
[0] = Diane
[1] = Fred
[2] = Helen
)

[last_name] = Array
(
[0] = Cable
[1] = Cago
[2] = Cahalan


The following is how I tried to access the data contained in the 
$_SESSION arrays:


$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++)
{
$last_name = $_SESSION['last_name'][$i];
$first_name = $_SESSION['first_name'][$i];
echo(p$last_name, $first_name/p);
}

The only thing that came out correct was the first echo. The remaining 
echos had no values for $first_name or $last_name.


What's happening here?

Cheers,

tedd


PS: I'm open to other suggestions as to how to do this.


ehh? i think everybody's looking too hard at this..

[tested - works]
?php

 $_SESSION['user_id'][] = '6156';
 $_SESSION['first_name'][]  = 'Diane';
 $_SESSION['last_name'][]= 'Cable';

 $_SESSION['user_id'][] = '1234';
 $_SESSION['first_name'][]  = 'Big';
 $_SESSION['last_name'][]= 'Ron';

 $_SESSION['user_id'][] = '8867';
 $_SESSION['first_name'][]  = 'Joe';
 $_SESSION['last_name'][]= 'Dirt';

 print_r( $_SESSION );

 foreach( $_SESSION['user_id'] as $index = $value ) {
   $last_name = $_SESSION['last_name'][$index];
   $first_name = $_SESSION['first_name'][$index];
   echo $last_name . ',' . $first_name . PHP_EOL;
 }
?

regards! nathan :)



I need to re-address this.. tedd your original code works fine over 
here; as does the code I sent you, and the code jay submitted first..


do us a favour, copy and paste exactly what I just handed through and 
run it; are the results correct?


next up, is you're real code somewhat bulkier and more too it? if so 
then something runs in my head that you should check if you already have 
a $last_name / $first_name somewhere earlier, and if you do where they 
passed by reference to the function that produced the array in session? 
of so then you could be redefining the session data at the same time as 
retrieving it or something completely crazy.


actually I think your php install is bustikated!

Nath

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SESSION array problems

2008-10-01 Thread Nathan Rixham

tedd wrote:

At 3:41 PM -0400 10/1/08, tedd wrote:

What about:

foreach ($_SESSION['user_id'] as $key = $value)
{
$last = $_SESSION['last_name'][$key];
$first = $_SESSION['first_name'][$key];
echo $last, $first;
}


Jay:

Close, it produced:

Array, Array
Array, Array
Array, Array

Cheers,

tedd



My error, if produced.


Cable, Diane
a, i

While print_r($_SESSION); JUST BEFORE IT produced:

[user_id] = Array
(
[0] = 6156
[1] = 7030
[2] = 656
)

[first_name] = Array
(
[0] = Diane
[1] = first name
[2] = Helen
)

[last_name] = Array
(
[0] = Cable
[1] = CagoEsogs-temp (forum)
[2] = Cahalane
)

Now, what wrong with this picture?

Cheers,

tedd


tedd wrote:
 At 3:41 PM -0400 10/1/08, tedd wrote:
 What about:

 foreach ($_SESSION['user_id'] as $key = $value)
 {
 $last = $_SESSION['last_name'][$key];
 $first = $_SESSION['first_name'][$key];
 echo $last, $first;
 }

 Jay:

 Close, it produced:

 Array, Array
 Array, Array
 Array, Array

 Cheers,

 tedd


 My error, if produced.


 Cable, Diane
 a, i

 While print_r($_SESSION); JUST BEFORE IT produced:

 [user_id] = Array
 (
 [0] = 6156
 [1] = 7030
 [2] = 656
 )

 [first_name] = Array
 (
 [0] = Diane
 [1] = first name
 [2] = Helen
 )

 [last_name] = Array
 (
 [0] = Cable
 [1] = CagoEsogs-temp (forum)
 [2] = Cahalane
 )

 Now, what wrong with this picture?

 Cheers,

 tedd

in this case.. what's happened is:
$_SESSION['first_name'] is a reference to a variable $first (or whatever 
is in your for loop)
$_SESSION['last_name'] is a reference to a variable $last (or whatever 
is in your for loop)


when you've set $last and $first to string's in the for loop it's passed 
the variable by reference back to $_SESSION['first_name'] and 
$_SESSION['last_name'] as strings;


when it hit's the second iteration on the for loop it now has strings to 
deal with so uses the $key (holding integer 1 at this stage) as a string 
offset thus giving you the second character (offset [1]) of the string 
variables $last/$first. now set to 'cable'/'diane' thus giving you the 
'a'/'i'. when it does pass three there is no offset [2] so gives you 
nothing.


*phew*

reproduce code!

?php

$userids = array('6156','1234','8867');
$first = array('Diane','Big','Joe');
$last = array('Cable','Ron','Dirt');

function save_to_session( ) {
 global $userids , $first , $last;
 $_SESSION['user_id'] = $userids;
 $_SESSION['first_name'] = $first;
 $_SESSION['last_name']= $last;
}

save_to_session( );

print_r( $_SESSION );

$num_users = count($_SESSION['user_id']);

for ($i = 0; $i  $num_users; $i++) {
$first = $_SESSION['first_name'][$i];
$last = $_SESSION['last_name'][$i];
echo $last, $first\n;
}
?

Regards!

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-08 Thread karma


You're absolutely right, but the problem is not about how the SID is passed between the scripts, it is more about why some 
variables are written in the session file while others are not, even when these variables are created within the same script at 
the same time. If the SID was not correctly passed, it wouldn't find any other variables. I also wonder why this randomly 
happens ...


I agree about the HTML/1.1 specs, I'm just a bit lazy ;)

K.


Shawn McKenzie a écrit :


http://us.php.net/manual/en/function.header.php

Note: Session ID is not passed with Location header even if 
session.use_trans_sid is enabled. It must by passed manually using SID 
constant.


-Shawn



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-07 Thread karma


Hi,

Ted  Fabrice, thanks for your answers.

Sessions variables are only stored in a local file. The dir permissions are ok, and I've tried to store these files in another 
dir (/var/tmp/php) just to check.


The session id is transmitted via cookies only :

session.use_cookies = 1
session.use_only_cookies = 1== I've tried with 0 and 1
session.auto_start = 0
session.cookie_lifetime = 0

I guess the Session ID is correctly transmitted because the errors doesn't occur on the first 2 scripts. First, the login page 
requires cookies to be enabled, and this step is ok. Then the user has to choose something in a menu, this step is fine too : 
some variables are set according to the user choice and the user is redirected to the 3rd script. The errors occur on this one.


Between the 2nd and 3rd scripts, variables are created from a database query : it _can't_ fail and the results are cheched : no 
possible mistake here. I use this kind of method :


- the user chooses some $id (type and value tested, ok), then :

$res=pg_query($dbr, select a, b, c, ..., from table where table_id='$id');

if(pg_num_rows($res))
{
   list($_SESSION[a], $_SESSION[b], $_SESSION[c], ...)=pg_fetch_row($res, 
0);

  pg_free_result($res);
  header(Location:my_third_script.php);
  exit();
}

Then the errors sometimes occur in my apache2/ssl_error_log (undefined index in $_SESSION variable). When I check the 
sess_12345789... file, some of the variables are missing : $_SESSION[a] and [b] are there, but not $_SESSION[c], even an 
empty one, it is just gone. That's all I know.


I would like to try to store my sessions variables in the main database, but it is quite difficult since the application is 
currently used by many people. I'll also have to upgrade a lot of scripts (a bit time consuming) to test this solution...



Regards,

C.


Fabrice VIGNALS a écrit :

Difficult to help you because there are many method of session :
- where do you store the sessions_variables : in local file, db or cookie ?
- how you transmit the session id, beetween pages(runtimes)  : cookie, 
$GET link, database ?



Did you check the availability of user cookie if you use it ?
Because if in each page of your application you define a session 
variable it's sure it will be every time here.
But the problem of session it's to transmit its ID between different 
pages, or session will be reset.
If a user don't authorised cookie you must transmit the session id by db 
storage or $Get link.


Also I don't see, a php modification during the last upgrades to explain 
that's kind of session problem.





karma [EMAIL PROTECTED] a écrit dans le message de 
news:[EMAIL PROTECTED]


Hi !

I have a very weird issue since the last Apache upgrade (- 2.2.8-r3, 
a month ago), but I'm not sure it is related (well, I'm pretty sure 
it's not).


Like many people, I've written an application that use PHP session 
variables, like $_SESSION[my_variable].


Sometimes (it doesn't happen all the time), _some_ of these variables 
are not written in the session file and they are lost after a simple 
header(Location:...); (same domain). The session file is in the right 
directory (permissions are fine), but some of my variables are missing.


The facts :
- Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date)
- all my scripts begin with session_start(). I've tried to add 
session_write_close() before every header(Location:...) call, it 
doesn't help.
- I didn't change anything in my program (it has been running just 
fine for 2 years), it just began to fail from time to time (I would 
say 10 times a day). There is no hidden unset() function : it would 
fail for everyone.
- these variables are all set correctly, and they don't have reserved 
names.
- only a few variables disappear, but they are always the same ones 
(could it depend on their position in the session file ?!?)

- the session files are very small (max 100ko)
- it seems that it doesn't depend on the browser, but IE6 and IE7 seem 
to be the most affected ones (it may be because my users mostly use 
these browsers).
- I can't reproduce this issue from my local network (any OS/browser - 
it would be too easy :)
- reverting to the previous stable Apache and/or PHP versions doesn't 
help.

- I didn't change any php.ini directive.

Any idea ?

Thanks !


PS: if you need more details, just ask. The only thing I can't do is 
pasting the code : the scripts are quite huge. 





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session variables disappear (some of them only)

2008-07-07 Thread Chris
 Then the errors sometimes occur in my apache2/ssl_error_log (undefined
 index in $_SESSION variable). When I check the sess_12345789... file,
 some of the variables are missing : $_SESSION[a] and [b] are there,
 but not $_SESSION[c], even an empty one, it is just gone. That's all I
 know.

Sounds like for those situations, the user doesn't have one of the
options set (the database is returning a null value).

Check that by matching up whatever 'a' and 'b' are with what's in the
database.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-07 Thread Shawn McKenzie

karma wrote:


Hi,

Ted  Fabrice, thanks for your answers.

Sessions variables are only stored in a local file. The dir permissions 
are ok, and I've tried to store these files in another dir 
(/var/tmp/php) just to check.


The session id is transmitted via cookies only :

session.use_cookies = 1
session.use_only_cookies = 1== I've tried with 0 and 1
session.auto_start = 0
session.cookie_lifetime = 0

I guess the Session ID is correctly transmitted because the errors 
doesn't occur on the first 2 scripts. First, the login page requires 
cookies to be enabled, and this step is ok. Then the user has to choose 
something in a menu, this step is fine too : some variables are set 
according to the user choice and the user is redirected to the 3rd 
script. The errors occur on this one.


Between the 2nd and 3rd scripts, variables are created from a database 
query : it _can't_ fail and the results are cheched : no possible 
mistake here. I use this kind of method :


- the user chooses some $id (type and value tested, ok), then :

$res=pg_query($dbr, select a, b, c, ..., from table where 
table_id='$id');


if(pg_num_rows($res))
{
   list($_SESSION[a], $_SESSION[b], $_SESSION[c], 
...)=pg_fetch_row($res, 0);


  pg_free_result($res);
  header(Location:my_third_script.php);
  exit();
}

Then the errors sometimes occur in my apache2/ssl_error_log (undefined 
index in $_SESSION variable). When I check the sess_12345789... file, 
some of the variables are missing : $_SESSION[a] and [b] are there, 
but not $_SESSION[c], even an empty one, it is just gone. That's all I 
know.


I would like to try to store my sessions variables in the main database, 
but it is quite difficult since the application is currently used by 
many people. I'll also have to upgrade a lot of scripts (a bit time 
consuming) to test this solution...



Regards,

C.


Fabrice VIGNALS a écrit :

Difficult to help you because there are many method of session :
- where do you store the sessions_variables : in local file, db or 
cookie ?
- how you transmit the session id, beetween pages(runtimes)  : cookie, 
$GET link, database ?



Did you check the availability of user cookie if you use it ?
Because if in each page of your application you define a session 
variable it's sure it will be every time here.
But the problem of session it's to transmit its ID between different 
pages, or session will be reset.
If a user don't authorised cookie you must transmit the session id by 
db storage or $Get link.


Also I don't see, a php modification during the last upgrades to 
explain that's kind of session problem.





karma [EMAIL PROTECTED] a écrit dans le message de 
news:[EMAIL PROTECTED]


Hi !

I have a very weird issue since the last Apache upgrade (- 2.2.8-r3, 
a month ago), but I'm not sure it is related (well, I'm pretty sure 
it's not).


Like many people, I've written an application that use PHP session 
variables, like $_SESSION[my_variable].


Sometimes (it doesn't happen all the time), _some_ of these variables 
are not written in the session file and they are lost after a simple 
header(Location:...); (same domain). The session file is in the 
right directory (permissions are fine), but some of my variables are 
missing.


The facts :
- Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date)
- all my scripts begin with session_start(). I've tried to add 
session_write_close() before every header(Location:...) call, it 
doesn't help.
- I didn't change anything in my program (it has been running just 
fine for 2 years), it just began to fail from time to time (I would 
say 10 times a day). There is no hidden unset() function : it would 
fail for everyone.
- these variables are all set correctly, and they don't have reserved 
names.
- only a few variables disappear, but they are always the same ones 
(could it depend on their position in the session file ?!?)

- the session files are very small (max 100ko)
- it seems that it doesn't depend on the browser, but IE6 and IE7 
seem to be the most affected ones (it may be because my users mostly 
use these browsers).
- I can't reproduce this issue from my local network (any OS/browser 
- it would be too easy :)
- reverting to the previous stable Apache and/or PHP versions doesn't 
help.

- I didn't change any php.ini directive.

Any idea ?

Thanks !


PS: if you need more details, just ask. The only thing I can't do is 
pasting the code : the scripts are quite huge. 





http://us.php.net/manual/en/function.header.php

Note: Session ID is not passed with Location header even if 
session.use_trans_sid is enabled. It must by passed manually using SID 
constant.


-Shawn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-07 Thread Shawn McKenzie

karma wrote:


Hi,

Ted  Fabrice, thanks for your answers.

Sessions variables are only stored in a local file. The dir permissions 
are ok, and I've tried to store these files in another dir 
(/var/tmp/php) just to check.


The session id is transmitted via cookies only :

session.use_cookies = 1
session.use_only_cookies = 1== I've tried with 0 and 1
session.auto_start = 0
session.cookie_lifetime = 0

I guess the Session ID is correctly transmitted because the errors 
doesn't occur on the first 2 scripts. First, the login page requires 
cookies to be enabled, and this step is ok. Then the user has to choose 
something in a menu, this step is fine too : some variables are set 
according to the user choice and the user is redirected to the 3rd 
script. The errors occur on this one.


Between the 2nd and 3rd scripts, variables are created from a database 
query : it _can't_ fail and the results are cheched : no possible 
mistake here. I use this kind of method :


- the user chooses some $id (type and value tested, ok), then :

$res=pg_query($dbr, select a, b, c, ..., from table where 
table_id='$id');


if(pg_num_rows($res))
{
   list($_SESSION[a], $_SESSION[b], $_SESSION[c], 
...)=pg_fetch_row($res, 0);


  pg_free_result($res);
  header(Location:my_third_script.php);
  exit();
}

Then the errors sometimes occur in my apache2/ssl_error_log (undefined 
index in $_SESSION variable). When I check the sess_12345789... file, 
some of the variables are missing : $_SESSION[a] and [b] are there, 
but not $_SESSION[c], even an empty one, it is just gone. That's all I 
know.


I would like to try to store my sessions variables in the main database, 
but it is quite difficult since the application is currently used by 
many people. I'll also have to upgrade a lot of scripts (a bit time 
consuming) to test this solution...



Regards,

C.


Fabrice VIGNALS a écrit :

Difficult to help you because there are many method of session :
- where do you store the sessions_variables : in local file, db or 
cookie ?
- how you transmit the session id, beetween pages(runtimes)  : cookie, 
$GET link, database ?



Did you check the availability of user cookie if you use it ?
Because if in each page of your application you define a session 
variable it's sure it will be every time here.
But the problem of session it's to transmit its ID between different 
pages, or session will be reset.
If a user don't authorised cookie you must transmit the session id by 
db storage or $Get link.


Also I don't see, a php modification during the last upgrades to 
explain that's kind of session problem.





karma [EMAIL PROTECTED] a écrit dans le message de 
news:[EMAIL PROTECTED]


Hi !

I have a very weird issue since the last Apache upgrade (- 2.2.8-r3, 
a month ago), but I'm not sure it is related (well, I'm pretty sure 
it's not).


Like many people, I've written an application that use PHP session 
variables, like $_SESSION[my_variable].


Sometimes (it doesn't happen all the time), _some_ of these variables 
are not written in the session file and they are lost after a simple 
header(Location:...); (same domain). The session file is in the 
right directory (permissions are fine), but some of my variables are 
missing.


The facts :
- Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date)
- all my scripts begin with session_start(). I've tried to add 
session_write_close() before every header(Location:...) call, it 
doesn't help.
- I didn't change anything in my program (it has been running just 
fine for 2 years), it just began to fail from time to time (I would 
say 10 times a day). There is no hidden unset() function : it would 
fail for everyone.
- these variables are all set correctly, and they don't have reserved 
names.
- only a few variables disappear, but they are always the same ones 
(could it depend on their position in the session file ?!?)

- the session files are very small (max 100ko)
- it seems that it doesn't depend on the browser, but IE6 and IE7 
seem to be the most affected ones (it may be because my users mostly 
use these browsers).
- I can't reproduce this issue from my local network (any OS/browser 
- it would be too easy :)
- reverting to the previous stable Apache and/or PHP versions doesn't 
help.

- I didn't change any php.ini directive.

Any idea ?

Thanks !


PS: if you need more details, just ask. The only thing I can't do is 
pasting the code : the scripts are quite huge. 






Also:

Note: HTTP/1.1 requires an absolute URI as argument to » Location: 
including the scheme, hostname and absolute path.


-Shawn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-06 Thread Fabrice VIGNALS

Difficult to help you because there are many method of session :
- where do you store the sessions_variables : in local file, db or cookie ?
- how you transmit the session id, beetween pages(runtimes)  : cookie, $GET 
link, database ?



Did you check the availability of user cookie if you use it ?
Because if in each page of your application you define a session variable 
it's sure it will be every time here.
But the problem of session it's to transmit its ID between different pages, 
or session will be reset.
If a user don't authorised cookie you must transmit the session id by db 
storage or $Get link.


Also I don't see, a php modification during the last upgrades to explain 
that's kind of session problem.





karma [EMAIL PROTECTED] a écrit dans le message de 
news:[EMAIL PROTECTED]


Hi !

I have a very weird issue since the last Apache upgrade (- 2.2.8-r3, a 
month ago), but I'm not sure it is related (well, I'm pretty sure it's 
not).


Like many people, I've written an application that use PHP session 
variables, like $_SESSION[my_variable].


Sometimes (it doesn't happen all the time), _some_ of these variables are 
not written in the session file and they are lost after a simple 
header(Location:...); (same domain). The session file is in the right 
directory (permissions are fine), but some of my variables are missing.


The facts :
- Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date)
- all my scripts begin with session_start(). I've tried to add 
session_write_close() before every header(Location:...) call, it doesn't 
help.
- I didn't change anything in my program (it has been running just fine 
for 2 years), it just began to fail from time to time (I would say 10 
times a day). There is no hidden unset() function : it would fail for 
everyone.
- these variables are all set correctly, and they don't have reserved 
names.
- only a few variables disappear, but they are always the same ones (could 
it depend on their position in the session file ?!?)

- the session files are very small (max 100ko)
- it seems that it doesn't depend on the browser, but IE6 and IE7 seem to 
be the most affected ones (it may be because my users mostly use these 
browsers).
- I can't reproduce this issue from my local network (any OS/browser - it 
would be too easy :)
- reverting to the previous stable Apache and/or PHP versions doesn't 
help.

- I didn't change any php.ini directive.

Any idea ?

Thanks !


PS: if you need more details, just ask. The only thing I can't do is 
pasting the code : the scripts are quite huge. 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables disappear (some of them only)

2008-07-06 Thread tedd

At 1:48 PM +0200 7/6/08, Fabrice VIGNALS wrote:

Difficult to help you because there are many method of session :
- where do you store the sessions_variables : in local file, db or cookie ?
- how you transmit the session id, beetween 
pages(runtimes)  : cookie, $GET link, database ?



Did you check the availability of user cookie if you use it ?
Because if in each page of your application you 
define a session variable it's sure it will be 
every time here.
But the problem of session it's to transmit its 
ID between different pages, or session will be 
reset.
If a user don't authorised cookie you must 
transmit the session id by db storage or $Get 
link.


Also I don't see, a php modification during the 
last upgrades to explain that's kind of session 
problem.





karma [EMAIL PROTECTED] a écrit dans 
le message de 
news:[EMAIL PROTECTED]


Hi !

I have a very weird issue since the last Apache 
upgrade (- 2.2.8-r3, a month ago), but I'm not 
sure it is related (well, I'm pretty sure it's 
not).


Like many people, I've written an application 
that use PHP session variables, like 
$_SESSION[my_variable].


Sometimes (it doesn't happen all the time), 
_some_ of these variables are not written in 
the session file and they are lost after a 
simple header(Location:...); (same domain). 
The session file is in the right directory 
(permissions are fine), but some of my 
variables are missing.


The facts :
- Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date)
- all my scripts begin with session_start(). 
I've tried to add session_write_close() before 
every header(Location:...) call, it doesn't 
help.
- I didn't change anything in my program (it 
has been running just fine for 2 years), it 
just began to fail from time to time (I would 
say 10 times a day). There is no hidden unset() 
function : it would fail for everyone.

- these variables are all set correctly, and they don't have reserved names.
- only a few variables disappear, but they are 
always the same ones (could it depend on their 
position in the session file ?!?)

- the session files are very small (max 100ko)
- it seems that it doesn't depend on the 
browser, but IE6 and IE7 seem to be the most 
affected ones (it may be because my users 
mostly use these browsers).
- I can't reproduce this issue from my local 
network (any OS/browser - it would be too easy 
:)

- reverting to the previous stable Apache and/or PHP versions doesn't help.
- I didn't change any php.ini directive.

Any idea ?

Thanks !


If it's any comfort, I had a similar problem 
sending session variables from a script in a 
httpdocs directory to a script in a httpsdocs. 
Some of the variables made it and some didn't. It 
was very confusing. The client had php 4.3.1 
installed, if that's any help.


I never did find out what the problem was and I 
finally passed everything via a POST.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: SESSION Array problem - possibly different PHP versions?

2008-03-11 Thread Angelo Zanetti


-Original Message-
From: Al [mailto:[EMAIL PROTECTED] 
Sent: 10 March 2008 18:23
To: php-general@lists.php.net
Subject: [PHP] Re: SESSION Array problem - possibly different PHP versions?

Put a print_r($_SESSION) at the top and bottom of your page code so you can
see 
what's happening.

Also check your code that updates the session assignment by the GET value.
It 
appears your code maybe unset()ing the session assignments.

Are you using Cookies?  If so, check this code carefully as it can cause non

obvious things depending on whether the client machine has cookies enabled
or 
disabled.


-

Thanks will do so going to check the unset() as well as the print_r at top
and bottom, also I am not using cookies hope to get this sucker working.

Will keep you posted.

Angelo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SESSION Array problem - possibly different PHP versions?

2008-03-10 Thread Al
Put a print_r($_SESSION) at the top and bottom of your page code so you can see 
what's happening.


Also check your code that updates the session assignment by the GET value. It 
appears your code maybe unset()ing the session assignments.


Are you using Cookies?  If so, check this code carefully as it can cause non 
obvious things depending on whether the client machine has cookies enabled or 
disabled.


Angelo Zanetti wrote:
Hi All, 


I have a problem that only occurs on our live server and not our local
server.

It works fine locally.

Basically I am using a session array to store values of product colours. A
user can add colours to the session array.

The session is defined as follows:

$_SESSION['color'][$counter] = $color;

Obviously the first time we validate and the $counter is set to 0.

When more colours are added the $counter variable increments and should
increment the value of the array.

The colours are added through a popup window. Before I open the popup window
I print_r($_SESSION['color']) to view the contents of the array and make
sure that they are valid and it is an array.

Output is as follows: 


[color] = Array ( [0] = #339933 [1] = #00 ) etc...



Then once the popup opens I do the same print_r 

And it now shows: [color] = #339933 


There fore it isn't an array of colors within the session array. How can PHP
change this? Also the strange thing is that locally it works fine but not
live. So I am guessing that there is a problem with a certain version of
PHP?

Also Im not sure what else could be causing this problem?

Any ideas or hints would be appreciated.

Thanks




Kind regards, 
Angelo Zanetti 
Application Developer 	




Web: http://www.elemental.co.za 





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session destruction problem

2008-02-17 Thread Shawn McKenzie
Adil Drissi wrote:
 Hi everybody,
 
 I need help with sessions.
 I have a simple authentification relying only on
 sessions (i don't use cookies). After the user submits
 his username and password, the script checks if that
 corresponds to a record in a mysql table. If this is
 the case $_SESSION['sessioname'] = $_POST['login'];.
 the $_SESSION['sessioname'] is checked in subsequent
 pages to see if the user is connected or not.
 The problem is after the user logs out, and after that
 uses the previous button of the browser he becomes
 connected. How can i prevent this please.
 
 Here is my logout.php:
 
 ?php
 session_start();
 unset($_SESSION[sessioname]);
 session_destroy();
 header(location: index.php);
 ?
 
 Thank you for advance
 
 
   
 
 Looking for last minute shopping deals?  
 Find them fast with Yahoo! Search.  
 http://tools.search.yahoo.com/newsearch/category.php?category=shopping

I don't think they are reconnected.  What happens if they logout, then
hit back, then hit refresh?  Are they loggedin?  Probably not.  It may
just appear that way because the back bottom brings up a cache of the
previous page.  But once the user tries to do anything that requires
that they be loggedin, I doubt they can.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session destruction problem

2008-02-17 Thread Adil Drissi
Well, i'm doing all that. Maybe something is wrong in
my code. I'll arrange my code in a way that it will be
easy to run and i'll post it. I think like that,
you'll see by yourself and you gonna help to fix that
for sure.

Thank you
--- Shawn McKenzie [EMAIL PROTECTED] wrote:

 Adil Drissi wrote:
  Hi everybody,
  
  I need help with sessions.
  I have a simple authentification relying only on
  sessions (i don't use cookies). After the user
 submits
  his username and password, the script checks if
 that
  corresponds to a record in a mysql table. If this
 is
  the case $_SESSION['sessioname'] =
 $_POST['login'];.
  the $_SESSION['sessioname'] is checked in
 subsequent
  pages to see if the user is connected or not.
  The problem is after the user logs out, and after
 that
  uses the previous button of the browser he becomes
  connected. How can i prevent this please.
  
  Here is my logout.php:
  
  ?php
  session_start();
  unset($_SESSION[sessioname]);
  session_destroy();
  header(location: index.php);
  ?
  
  Thank you for advance
  
  
   


  Looking for last minute shopping deals?  
  Find them fast with Yahoo! Search. 

http://tools.search.yahoo.com/newsearch/category.php?category=shopping
 
 I don't think they are reconnected.  What happens
 if they logout, then
 hit back, then hit refresh?  Are they loggedin? 
 Probably not.  It may
 just appear that way because the back bottom brings
 up a cache of the
 previous page.  But once the user tries to do
 anything that requires
 that they be loggedin, I doubt they can.
 
 -Shawn
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session destruction problem

2008-02-17 Thread Shawn McKenzie
Adil Drissi wrote:
 Well, i'm doing all that. Maybe something is wrong in
 my code. I'll arrange my code in a way that it will be
 easy to run and i'll post it. I think like that,
 you'll see by yourself and you gonna help to fix that
 for sure.
 
 Thank you
 --- Shawn McKenzie [EMAIL PROTECTED] wrote:
 
 Adil Drissi wrote:
 Hi everybody,

 I need help with sessions.
 I have a simple authentification relying only on
 sessions (i don't use cookies). After the user
 submits
 his username and password, the script checks if
 that
 corresponds to a record in a mysql table. If this
 is
 the case $_SESSION['sessioname'] =
 $_POST['login'];.
 the $_SESSION['sessioname'] is checked in
 subsequent
 pages to see if the user is connected or not.
 The problem is after the user logs out, and after
 that
 uses the previous button of the browser he becomes
 connected. How can i prevent this please.

 Here is my logout.php:

 ?php
 session_start();
 unset($_SESSION[sessioname]);
 session_destroy();
 header(location: index.php);
 ?

 Thank you for advance


  
 
 Looking for last minute shopping deals?  
 Find them fast with Yahoo! Search. 
 http://tools.search.yahoo.com/newsearch/category.php?category=shopping
 I don't think they are reconnected.  What happens
 if they logout, then
 hit back, then hit refresh?  Are they loggedin? 
 Probably not.  It may
 just appear that way because the back bottom brings
 up a cache of the
 previous page.  But once the user tries to do
 anything that requires
 that they be loggedin, I doubt they can.

 -Shawn

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 
 
 
   
 
 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs

From the code you've shown it should work fine, but you might do
unset($_SESSION); or $_SESSION = array(); instead of
unset($_SESSION[sessioname]);.  Regardless, the fact is that the page
you see is cached and I can't believe that after logout you can go back
and then click a link to another page and still be loggedin.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] re: session question

2007-10-30 Thread Nathan Hawks
Nevermind... I don't know what the problem is yet but it's not the
folder.  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session cookies enabled?

2007-05-10 Thread Ford, Mike
On 09 May 2007 16:36, [EMAIL PROTECTED] wrote:

 Ford, Mike writes:
 
You can also set up php.ini and use the built-in sessions with
http://php.net/session_start so that PHP will take care of this
for you.
   
   That is what I was intending to do.  How do I find out if
   whether or not the session cookie was accepted using the
   built-in sessions? I found no function for such a test.
  
  Check the SID constant after you've done session_start(). If it has
  an empty value, the session is using cookies; otherwise, it'll have
  a value of the form 'sessionname=sessionid', which is what is
  appended to the URL (or inserted in forms as a hidden value) to
  propagate the session-id.
 
 Interesting idea.
 
 This brings up a question.  In order to decide whether to use cookies
 or SID the built-in sessions must be testing to see if the user's
 browser will accept the session cookies.  How do they do that?

By sending it out and checking to see whether it comes back on the next page.

Assuming your setup is:

session.use_cookies = On
session.use_only_cookies = Off
session.use_trans_sid = On

Then the sequence is this:

1. The first page involving a session will *both* send the cookie *and* append 
the SID to URLs in the page.

2. So the next page request will return the SID, and if cookies are enabled 
also the cookie.

3. On starting the session for this page, PHP will first look for the cookie: 
if it's present, its value will be used and SID defined as empty; if not, the 
browser must not be accepting cookies, so the value from the URL query string 
is used and SID is defined with the matching string.

4. PHP now knows whether cookies are in use *for this request*, and *either* 
sends the cookie *or* appends the SID to URLs in the page.

5. Requests from this page will thus *either* return the cookie *or* include 
the SID as a URL get parameter.

6. Go back to 3.

Note that with this setup, you will *always* get at least one request with the 
SID in the URL.  Any site that doesn't do this has use_only_cookies turned on 
or/and use_trans_sid turned off.

 
 If they do it by the 2 page, send a cookie and see if it comes
 back to the second page method we have been talking about, then
 somehow, they are sureptiously inserting a forward to a non-
 existant page!  Right?  How do they do that?

No, see above: they simply wait for the next regular page request to come in 
and see if the cookie came with it. Nothing surreptitious or super-clever.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session cookies enabled?

2007-05-10 Thread ccspencer
Mike, 

Thanks for the super clear explanation. 

This brings up a question.  In order to decide whether to use 
cookies or SID the built-in sessions must be testing to see if 
the user's browser will accept the session cookies.  How do 
they do that?


By sending it out and checking to see whether it comes back on 
the next page.


... 


That being the case I can never find out (using the built-in
sessions) until the second page request and it will always
include the session cookie in the URL.  Which means the value
of the seesion cookie will be exposed, even if I am using SSL. 

:(  Back to the drawing board... 

Best, 

Craig 



--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-10 Thread Richard Davey

[EMAIL PROTECTED] wrote:


That being the case I can never find out (using the built-in
sessions) until the second page request and it will always
include the session cookie in the URL.  Which means the value
of the seesion cookie will be exposed, even if I am using SSL.
:(  Back to the drawing board...


While using TRANS IDs are ugly, they will show no more or less 
information to the user than a session cookie contains. Most browsers 
have built-in support for viewing cookie contents these days. Doing so 
will show your PHP Session ID clearly. Trans IDs are no different, just 
more 'obvious' being in the URL and all. The actual data displayed is 
the same however.


Cheers,

Rich


--
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-10 Thread Edward Vermillion


On May 10, 2007, at 11:40 AM, Richard Davey wrote:


[EMAIL PROTECTED] wrote:


That being the case I can never find out (using the built-in
sessions) until the second page request and it will always
include the session cookie in the URL.  Which means the value
of the seesion cookie will be exposed, even if I am using SSL.
:(  Back to the drawing board...


While using TRANS IDs are ugly, they will show no more or less  
information to the user than a session cookie contains. Most  
browsers have built-in support for viewing cookie contents these  
days. Doing so will show your PHP Session ID clearly. Trans IDs are  
no different, just more 'obvious' being in the URL and all. The  
actual data displayed is the same however.




And the session id is open to being stored in a bookmark or worse,  
sent to someone else through a cut and paste of the URL.


Depending on what information that id controls and how long the  
sessions are kept around id's in the URL could be a very bad thing  
indeed.


Ed

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-10 Thread Richard Davey

Edward Vermillion wrote:

And the session id is open to being stored in a bookmark or worse, sent 
to someone else through a cut and paste of the URL.


Depending on what information that id controls and how long the sessions 
are kept around id's in the URL could be a very bad thing indeed.


Agreed (depending entirely on how your app was written), my point was 
simply that a trans ID will never give away anything more than a cookie 
does. In that respect, they're identical.


Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session cookies enabled?

2007-05-09 Thread Ford, Mike
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: 08 May 2007 20:57

  You can also set up php.ini and use the built-in sessions with 
  http://php.net/session_start so that PHP will take care of this for 
  you.
 
 That is what I was intending to do.  How do I find out if 
 whether or not the session cookie was accepted using the 
 built-in sessions? I found no function for such a test. 

Check the SID constant after you've done session_start(). If it has an
empty value, the session is using cookies; otherwise, it'll have a value
of the form 'sessionname=sessionid', which is what is appended to the
URL (or inserted in forms as a hidden value) to propagate the
session-id.

Cheers!

Mike
 


Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library, James Graham Building,
Headingley Campus, Beckett Park, LEEDS, LS6 3QS
United Kingdom
Tel: +44 113 812 4730 Fax: +44 113 812 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session cookies enabled?

2007-05-09 Thread ccspencer
Ford, Mike writes: 

 You can also set up php.ini and use the built-in sessions with 
 http://php.net/session_start so that PHP will take care of this for 
 you. 

That is what I was intending to do.  How do I find out if 
whether or not the session cookie was accepted using the 
built-in sessions? I found no function for such a test. 


Check the SID constant after you've done session_start(). If it has an
empty value, the session is using cookies; otherwise, it'll have a value
of the form 'sessionname=sessionid', which is what is appended to the
URL (or inserted in forms as a hidden value) to propagate the
session-id.


Interesting idea. 


This brings up a question.  In order to decide whether to use cookies
or SID the built-in sessions must be testing to see if the user's
browser will accept the session cookies.  How do they do that? 


If they do it by the 2 page, send a cookie and see if it comes
back to the second page method we have been talking about, then
somehow, they are sureptiously inserting a forward to a non-
existant page!  Right?  How do they do that? 

Best, 

Craig 



--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-09 Thread Richard Lynch
On Wed, May 9, 2007 10:36 am, [EMAIL PROTECTED] wrote:
 This brings up a question.  In order to decide whether to use cookies
 or SID the built-in sessions must be testing to see if the user's
 browser will accept the session cookies.  How do they do that?

The same way you would do it.

Actually, they might have just used:

$cookie_name = session_name();
if (isset($_COOKIE[$cookie_name])){
  $session_id = $_COOKIE[$cookie_name];
}
elseif (isset($_REQUEST[$cookie_name])){
  $session_id = $_REQUEST[$cookie_name];
}
else{
  $session_id = uniquid();
}

 If they do it by the 2 page, send a cookie and see if it comes
 back to the second page method we have been talking about, then
 somehow, they are sureptiously inserting a forward to a non-
 existant page!  Right?  How do they do that?


No, that's not how it works.

JUST send the dang cookie on every page.

And check if it's there on every page.

And whatever first page the user gets to, with no cookie, be sure you
send them suitable content for having no cookie.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session cookies enabled?

2007-05-08 Thread ccspencer
Richard Lynch writes: 


How does one check to see if the user's browser accepts
session cookies?


Apparently I should have said cookie and left off the 's' as
that is what I had in mind. 

Send one cookie, see if it comes back, and if it does, tie 
everything to that cookie.


OK.  So how do I see if it comes back? 


I send the user a page that tries to set a session cookie.  That
page would then have to forward him to a second page which would
check for the cookie being sent.  Right? 

So I there is nothing I can check so I can do it with a single page? 


You can also set up php.ini and use the built-in sessions with
http://php.net/session_start so that PHP will take care of this 
for you.


That is what I was intending to do.  How do I find out if whether
or not the session cookie was accepted using the built-in sessions?
I found no function for such a test. 

Best, 

Craig 




--
- Virtual Phonecards - Instant Pin by Email  -
-   Large Selection - Great Rates-
- http://speedypin.com/?aff=743co_branded=1 -
-- 



**
**
*  Craig Spencer *
*  [EMAIL PROTECTED]*
**
** 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session cookies enabled?

2007-05-08 Thread itoctopus
setcookie(cookie_name, value);
//redirect to another page using header
header(location:.$your_url);

//check in $your_url for the presence for the cookie
if ($_COOKIE[cookie_name] == value){
//cookies are enabled - add your code
}
else{
//cookies are disabled - add your code
}

Hope that helps!


-- 
itoctopus - http://www.itoctopus.com
[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Richard Lynch writes:
 How does one check to see if the user's browser accepts
 session cookies?

 Apparently I should have said cookie and left off the 's' as
 that is what I had in mind.
 Send one cookie, see if it comes back, and if it does, tie everything to 
 that cookie.

 OK.  So how do I see if it comes back?
 I send the user a page that tries to set a session cookie.  That
 page would then have to forward him to a second page which would
 check for the cookie being sent.  Right?
 So I there is nothing I can check so I can do it with a single page?
 You can also set up php.ini and use the built-in sessions with
 http://php.net/session_start so that PHP will take care of this for you.

 That is what I was intending to do.  How do I find out if whether
 or not the session cookie was accepted using the built-in sessions?
 I found no function for such a test.
 Best,
 Craig


 --
 - Virtual Phonecards - Instant Pin by Email  -
 -   Large Selection - Great Rates-
 - http://speedypin.com/?aff=743co_branded=1 -
 -- 


 **
 **
 *  Craig Spencer *
 *  [EMAIL PROTECTED]*
 **
 ** 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 2:56 pm, [EMAIL PROTECTED] wrote:
 Richard Lynch writes:
 Send one cookie, see if it comes back, and if it does, tie
 everything to that cookie.

 OK.  So how do I see if it comes back?

if (isset($_COOKIE['foo'])){
  //cookie came back
}
else{
  //cookie did NOT come back
}

 I send the user a page that tries to set a session cookie.  That
 page would then have to forward him to a second page which would
 check for the cookie being sent.  Right?

Yes.

Send the cookie with the homepage, login page, or whatever they are
first going to see.

Don't show them anything they shouldn't see without the cookie.

Check if they have a cookie.

It's probably best to just do all this in an include file that you
pull in on any page that needs cookies.

You can even make the include file abort the rest of the page output
if you want to require them to login with a valid session before going
any further.

 So I there is nothing I can check so I can do it with a single page?

Oh.

No.

It does seem like that would be a Nifty thing for the browser to have
sent with the first request, but that's just not the way it works.

It's an inherent 2-request process.

HTTP Request - Reply with Cookie - HTTP Request with Cookie (or not)

You'd have to duke it out with Mozilla and Microsoft to get that to
change, and they probably aren't gonna want to send a
pre-acceptane-of-cookie letter of intent with every HTTP requrest...

Especially not when the vast majority of HTTP requests don't need
cookies anyway...  Well, I never did a statistical analysis of that,
but across the 'net as  whole?  Yeah, I think it's a pretty safe
statement...

 You can also set up php.ini and use the built-in sessions with
 http://php.net/session_start so that PHP will take care of this
 for you.

 That is what I was intending to do.  How do I find out if whether
 or not the session cookie was accepted using the built-in sessions?

You don't.

You turn on the Cookies and the trans_sid in php.ini, and let PHP
worry about whether it was cookies or not and re-write your URLs if it
wasn't.

Or maybe it just re-writes them no matter what anyway, but prefers the
Cookie if it's there?

Whatever.

If, after doing that, you still feel the need to know if they used a
cookie or not, then you can use http://php.net/set_session_params and
choose a cookie/session name, and then you can test with:
if (isset($_COOKIE['whatever_you_chose_in_set_session_params'])){
}
and then you'll know if they used Cookies or Trans SID in URL...

But you won't really care, as all the info you need is in $_SESSION
either way, so it doesn't matter if they used a cookie or the ID in
the URL or sent a little squirrel along the wire with an engraved
acorn.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session cookies enabled?

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 5:50 pm, itoctopus wrote:
 setcookie(cookie_name, value);
 //redirect to another page using header
 header(location:.$your_url);

This will fail on some legacy browsers, if you need legacy browser
support.

In *MOST* architectures, your visitor can be given the cookie on a
page before the cookie-needing page, or they can be given alternate
content (i.e., a login) until you are happy with whatever cookie (and
its implied state of existence) are presented.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session in forum

2007-04-08 Thread itoctopus
http://www.sitepoint.com/article/users-php-sessions-mysql

--
itoctopus - http://www.itoctopus.com
uni uni [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 im trying to make a forum for my school assignment, its done and work
well, but i want to make session where it is readonly for un-registered
user, and the registered user can automaticly post new  topics or comment
the other topics without filling up name and email form cuz their name and
email will be taken from the database as they have logged in.

 anyone can help me please?


 -
 Don't pick lemons.
 See all the new 2007 cars at Yahoo! Autos.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session/login issue

2007-03-13 Thread Mark
Gunter Sammet wrote:

 Hi all:
 I inherited an application using PHP 5.1.4 with MySQL 4.1.20,
 Apache/2.0.46 (Red Hat) on a VPS server with Plesk 7.5. The authentication
 used to work just fine till yesterday. Now it doesn't authenticate
 anymore. My debugging so far hasn't revelaed much. It seems like the
 sessions are not started or started and destroyed right away again.
  Session handling is done via session class with session data stored in
  the
 database. The database doesn't contain any data but debugging revealed
 that session data is written to the DB and then immediately deleted.
 
 None application of the code has changed. Haven't had a chance yet to find
 out if the hosting company changed/updated anything. I suspect it has
 something to do with the environment but at the moment I am spinning
 wheels. Any pointers would be appreciated!
 Thanks,

Check the time on the server. The DST patch may not have been applied and
that elapsed time for a session could be a negative number.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session question

2007-03-05 Thread Fahad Pervaiz

 ORIGINAL #
I have an index.php page which does not user session_start(); command.
However in this index.php page, there are some $_SESSION['...']; variables
stored.

How is it possible that $_SESSION['...']; works even if no session has been
created before ?
moreover, if i use a print Session ID : .session_id(); after those lines,
session_id() is empty (which is logical) as no session_start(); command has
been used before.

So, how is it possible that $_SESSION['..'] works ?

Do i have a session created or not ?
 END ORIGINAL 


If you treat $_SESSION['username'] as a variable and set its value and
then print it or check it. It will display the value but value will
not be maintained for the next pages

e.g. for index.php you dont use session_start() but you do the follow

$_SESSION['username']=some value;
echo $_SESSION['username'];
//this will print some value

So, in your case it is possible that some page is being included that
is starting a session or setting up variable.


--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart Applications, Framework
for Multilingual Web Sites, Web Designs)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session Problem

2007-02-16 Thread datsclark
Also, make sure the session's are being saved properly.  I had this same 
problem when PHP wasn't able to write to the temp directory.  You can set up 
your own sessions dir with
session.save_path
in php.ini

LoneWolf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am having a problem where it appears that the session is not being saved 
properly.

 While on a page, I can start a session and set variables to it. however, 
 when I go to the next page.. the session variables appear to have been 
 cleared out.

 first page:
 session_start();

 $_SESSION[user_level] = test;



 second page:

 session_start();

 echo $_SESSION[user_level] ;



 We just installed php on the 2003 server.  Is there maybe a problem with 
 the php.ini file that I need to fix? 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session issues

2006-08-18 Thread Al

Dave Goodchild wrote:

Hi all, I am currently writing a web application that has a 3-stage form
process as part of its functionality. The values passed in are placed in 
the

session array after validation and once the user has completed and supplied
all required values the relevant session values are inserted into the
database. I have tested it on three different machines in FF, IE and Opera
and all expected values were entered ok.

However, a remote user has started testing and all values are blank,
suggesting the session is not being populated. I noticed it at their office
last week when data values were not showing up when the user went back one
page (ie fields are pre-populated with existing session values).

Anyone had this problem before?



$i= 0; first time.  Then $i++; so you can see the increment.  Or instead of $i, include something unique in your code 
for each pass.


Try putting a var_dump($_SESSION, $i) at the top of your page. That will show 
you what is happening.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session issues

2006-08-18 Thread Richard Lynch
On Thu, August 17, 2006 12:56 pm, Dave Goodchild wrote:
 How does the user go back one page?  If it by using the browser's
 back-button, the php script has no way of knowing it.

 Yes, but the session variables have already been set, and are
 configured to
 display in the form fields.

Ah, but some browsers just don't work like that.

They assume that the user wants to re-use the values THEY entered, not
the ones that were the original default.

That's what an input type=reset / was designed for into the HTML
spec in the first place, after all.

You can get them to switch to a browser that behaves like they expect.

You can educate them to understand that their browser is supposed to
work that way.

You can give them a reset form button to put things back the way
they were.

But you can't change the browser to misbehave from the way that
particular browser manufacturer thinks browsers should work.  Sorry.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session issues

2006-08-18 Thread Dave Goodchild

Don't be sorry, that's not what I meant. The fields are completed by the
user, they submit and the cleaned and validated values are put into the
session. So when they go back their entered values are displayed. I made
sure of it by making sure these pages are never cached.

That issue is resolved. Now the only problem is that when the client
completes the cycle blank or default values are entered into the db, whereas
the other 4 remote testers have entered the data without issue.

On 18/08/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Thu, August 17, 2006 12:56 pm, Dave Goodchild wrote:
 How does the user go back one page?  If it by using the browser's
 back-button, the php script has no way of knowing it.

 Yes, but the session variables have already been set, and are
 configured to
 display in the form fields.

Ah, but some browsers just don't work like that.

They assume that the user wants to re-use the values THEY entered, not
the ones that were the original default.

That's what an input type=reset / was designed for into the HTML
spec in the first place, after all.

You can get them to switch to a browser that behaves like they expect.

You can educate them to understand that their browser is supposed to
work that way.

You can give them a reset form button to put things back the way
they were.

But you can't change the browser to misbehave from the way that
particular browser manufacturer thinks browsers should work.  Sorry.

--
Like Music?
http://l-i-e.com/artists.htm






--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


[PHP] Re: Session issues

2006-08-17 Thread Al

Dave Goodchild wrote:
Dave Goodchild wrote:

Hi all, I am currently writing a web application that has a 3-stage form
process as part of its functionality. The values passed in are placed in 
the

session array after validation and once the user has completed and supplied
all required values the relevant session values are inserted into the
database. I have tested it on three different machines in FF, IE and Opera
and all expected values were entered ok.

However, a remote user has started testing and all values are blank,
suggesting the session is not being populated. I noticed it at their office
last week when data values were not showing up when the user went back one
page (ie fields are pre-populated with existing session values).

Anyone had this problem before?




Hi all, I am currently writing a web application that has a 3-stage form
process as part of its functionality. The values passed in are placed in 
the

session array after validation and once the user has completed and supplied
all required values the relevant session values are inserted into the
database. I have tested it on three different machines in FF, IE and Opera
and all expected values were entered ok.

However, a remote user has started testing and all values are blank,
suggesting the session is not being populated. I noticed it at their office
last week when data values were not showing up when the user went back one
page (ie fields are pre-populated with existing session values).

Anyone had this problem before?




How does the user go back one page?  If it by using the browser's 
back-button, the php script has no way of knowing it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session issues

2006-08-17 Thread Dave Goodchild



How does the user go back one page?  If it by using the browser's
back-button, the php script has no way of knowing it.




Yes, but the session variables have already been set, and are configured to
display in the form fields.

--

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] Re: Session issues

2006-08-17 Thread Dave Goodchild

On 17/08/06, John Nichel [EMAIL PROTECTED] wrote:


Dave Goodchild wrote:


 How does the user go back one page?  If it by using the browser's
 back-button, the php script has no way of knowing it.



 Yes, but the session variables have already been set, and are configured
to
 display in the form fields.


All the session variables in the world aren't going to help when the
browser loads a cached page when the back button is pressed.





Granted, but that doesn't explain why the whole thing fails ie no session
variables at all are entered into the database at the end.


Re: [PHP] Re: Session issues

2006-08-17 Thread John Nichel

Dave Goodchild wrote:



How does the user go back one page?  If it by using the browser's
back-button, the php script has no way of knowing it.




Yes, but the session variables have already been set, and are configured to
display in the form fields.



All the session variables in the world aren't going to help when the 
browser loads a cached page when the back button is pressed.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session issues

2006-08-17 Thread John Nichel

Dave Goodchild wrote:

On 17/08/06, John Nichel [EMAIL PROTECTED] wrote:


Dave Goodchild wrote:


 How does the user go back one page?  If it by using the browser's
 back-button, the php script has no way of knowing it.



 Yes, but the session variables have already been set, and are 
configured

to
 display in the form fields.


All the session variables in the world aren't going to help when the
browser loads a cached page when the back button is pressed.





Granted, but that doesn't explain why the whole thing fails ie no session
variables at all are entered into the database at the end.



Explaining the problem is kind of difficult without seeing any code.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session issues

2006-08-17 Thread Dave Goodchild

Trust me, there is far too much code to include. The problem is simple. The
app contains a 3-page form cycle that reloads itself, progressing from stage
1-3 and populating the session array as values are validated and cleaned.
When the process is complete, the values held in the session array are
inserted into the database. In FF, IE and Opera in my test installation, I
can navigate back and forth through the pages and previously entered values
persist and at the end are entered. The user testing elsewhere on IE does
not see these persistent values and the data entered at the end is all
default or blank. I just wanted to know if anyone could spot the issue from
experience, otherwise I need a rethink!

On 17/08/06, John Nichel [EMAIL PROTECTED] wrote:


Dave Goodchild wrote:
 On 17/08/06, John Nichel [EMAIL PROTECTED] wrote:

 Dave Goodchild wrote:
 
 
  How does the user go back one page?  If it by using the browser's
  back-button, the php script has no way of knowing it.
 
 
 
  Yes, but the session variables have already been set, and are
 configured
 to
  display in the form fields.
 

 All the session variables in the world aren't going to help when the
 browser loads a cached page when the back button is pressed.




 Granted, but that doesn't explain why the whole thing fails ie no
session
 variables at all are entered into the database at the end.


Explaining the problem is kind of difficult without seeing any code.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] Re: Session issues

2006-08-17 Thread Robert Cummings
On Thu, 2006-08-17 at 19:19 +0100, Dave Goodchild wrote:
 Trust me, there is far too much code to include. The problem is simple. The
 app contains a 3-page form cycle that reloads itself, progressing from stage
 1-3 and populating the session array as values are validated and cleaned.
 When the process is complete, the values held in the session array are
 inserted into the database. In FF, IE and Opera in my test installation, I
 can navigate back and forth through the pages and previously entered values
 persist and at the end are entered. The user testing elsewhere on IE does
 not see these persistent values and the data entered at the end is all
 default or blank. I just wanted to know if anyone could spot the issue from
 experience, otherwise I need a rethink!

Usually a browser cache issue. If they set the cache to 0 then I do
believe it gets wiped.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session problem

2006-06-21 Thread Barry

weetat schrieb:

Hi all,

 I have 2 php page , whenever i click the submit in 1st page , the
 $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page.

 If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it 
displayed the data correctly.


Anybody have any ideas why php session behaviour is like that ?

Thanks - weetat

   below is the 1st page :

   ?php

   session_start();
   $arrayoffiles = listoffiles();

$params = array(
 'mode'  = 'Jumping',
'itemData'  = $arrayoffiles,
 'perPage' = 10,
'delta' = 8,
 'append' = true,
 'clearIfVoid' = true,
 'useSessions' = true,
  'closeSession' = true,
   );

   $pager =  Pager::factory($params);
   $data  = $pager-getPageData();
   $links = $pager-getLinks();
   $_SESSION['LIST_OF_DATA'] = $data;

   ?


   below is second page :

?php

session_start();

echo print_r($_SESSION['LIST_OF_DATA']);

?


Let me take a guess:
Your FORM action is action=http:// 

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session problem

2006-06-21 Thread weetat

yes i am
Thank for you help

Barry wrote:

weetat schrieb:

Hi all,

 I have 2 php page , whenever i click the submit in 1st page , the
 $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page.

 If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it 
displayed the data correctly.


Anybody have any ideas why php session behaviour is like that ?

Thanks - weetat

   below is the 1st page :

   ?php

   session_start();
   $arrayoffiles = listoffiles();

$params = array(
 'mode'  = 'Jumping',
'itemData'  = $arrayoffiles,
 'perPage' = 10,
'delta' = 8,
 'append' = true,
 'clearIfVoid' = true,
 'useSessions' = true,
  'closeSession' = true,
   );

   $pager =  Pager::factory($params);
   $data  = $pager-getPageData();
   $links = $pager-getLinks();
   $_SESSION['LIST_OF_DATA'] = $data;

   ?


   below is second page :

?php

session_start();

echo print_r($_SESSION['LIST_OF_DATA']);

?


Let me take a guess:
Your FORM action is action=http:// 

Barry


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session problem

2006-06-21 Thread Barry

weetat schrieb:

 Let me take a guess:
 Your FORM action is action=http:// 

 Barry

yes i am
Thank for you help



Ookay ... no problem ... probably .

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session variables on Windows

2006-06-06 Thread The Panister
Well Do you have folder called tmp in your root?

ThePanister!

Tom [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Does some well-known problem exist with the session variables in Windows
 servers?
 Because in a system that I have running on a Windows server, sometimes the
 session variables are null causing errors, then I close the browser and
open
 it and in the next intent everything works well... I can't understand
why...
 The same system in a Linux server runs well always ¿?

 Ahead of time, thank you very much,

 Tom.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session contamination?

2006-04-21 Thread Ben Liu

Hi Chuck,

Glad this discussion has been of use to you. I can't help much with  
where your /tmp directory might be. if you echo session_save_path()  
it should tell you where your session cookies are being saved to on  
your server.


I have read recommendations that you set a different path for the  
cookies using session_save_path(), and yes they recommend some place  
within your home directory structure. The problem this creates is in  
garbage collection. The standard *nix cron jobs will clear everything  
out of /tmp on a regular basis whereas some directory you create will  
not be subject to this regular housekeeping unless you write some  
script to do it or create a custom cron job.


My interpretation of managing this problem, at this point is:

If you are on a shared server and have an application or applications  
that have sensitive data and require an adequate level of security,  
you should move the session cookies somewhere away from /tmp and  
dealing with the garbage collection issues. Alternatively, perhaps  
you shouldn't be using shared hosting or you could encrypt the  
sessions cookies somehow.


If you are on a shared server and don't have sensitive data, changing  
the session name should be enough to prevent cross-contamination of  
session variables.


I'm still reading/learning so if I'm wrong, someone else please jump in.

- Ben

On Apr 21, 2006, at 12:05 AM, Chuck Anderson wrote:

This has been a very interesting discussion, as I have had the same  
problem, but never thought much about the fact that I could do  
anything about it.


As to session save path, when I run phpinfo (at my remote Linux  
server) it tells me that it is set to no value. This means it  
would default to /tmp. Where is this tmp directory? I have looked  
at the tmp directory that is one level above my site's www  
directory (outside of the web space), but I do not see any session  
data there. That's why I am asking if it is a system wide  
directory, or is it the one in my home directory.


If I set the path myself, what would be a good location? (I assume  
it should be outside the web space). Should I make up some random  
folder name (one time) and story my session data within that  
directory, within my own home directory?


Ben Liu wrote:


Hello All,

I'm using a single development server to host multiple client
projects, many of which require session management. I've noticed that
sometimes when I test these various web apps (which are simply in
separate sub directories) I get session leakage where logging in and
establishing a session on one app allows me access to (automatically
logs me in) to other app(s) on the same server. Or sometimes a  
session

variable will be set across all the apps, like $_SESSION['username'].

Is this due to the fact that sessions are established between client
browsers and servers, regardless of directory/sub directory?

What is the best way to avoid/prevent this problem? Should I be using
specific Session ID's or Session names?

Thanks for any help,

- Ben




--
*
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session contamination?

2006-04-21 Thread Richard Lynch
On Thu, April 20, 2006 11:05 pm, Chuck Anderson wrote:
 As to session save path, when I run phpinfo (at my remote Linux
 server)
 it tells me that it is set to no value. This means it would default
 to
 /tmp. Where is this tmp directory? I have looked at the tmp directory
 that is one level above my site's www directory (outside of the web
 space), but I do not see any session data there. That's why I am
 asking
 if it is a system wide directory, or is it the one in my home
 directory.

It is what you are calling a system wide directory

It is named /tmp and it is at the very tip-top of your directory
structure.

Actually, it doesn't HAVE to be called /tmp nor does it HAVE to be at
the tip-top directory. It doesn't even HAVE to be on the same hard
drive as your home directory.  Hell, it might even be on a RAM disk on
some souped-up machines.  In Windoze, it might be called C:/temp Or
not. But who cares about Windows anyway?  Still, it's usually /tmp at
the tip-top, and your post indicates that you probably have some
indicator that that is true.

From a shell (or php exec) you should be able to do:
ls /
and see '/tmp' in the output.

You may even be able to do:
ls /tmp
and see what is in there.

Or you might not, as you might not have permission to poke around in
there.  And that's a Good Thing.

Hopefully, whatever *IS* in there, you can't view all of it.

tmp directories are handled specially by the operating system.

The exact rules differ from OS to OS and configuration to
configuration, but for starters, you should generally assume that
anything in /tmp is subject to being wiped out when the machine
reboots.  It might not be set up that way, but it's safer to assume it
is, because it might be.

Access to tmp directories is often handled as a special case, to allow
users that normally have no access to the file system at all, to be
allowed to make/delete tmp files.

 If I set the path myself, what would be a good location? (I assume it
 should be outside the web space). Should I make up some random folder
 name (one time) and story my session data within that directory,
 within
 my own home directory?

Your best bet, if possible, is to use s sub-directory of /tmp for
yourself, or for each application, or for whatever you want to
separate from the rest of /tmp

This will keep your stuff separate, but you still enjoy all the
benefits of system tmp directory behaviour.

Unless, of course, you specifically WANT your sessions to survive a
re-boot for some reason, and you are willing to take care of lingering
sessions and the permissions gotchas of rolling your own...

Think long and hard before doing this, as there are subtle permissions
things involved (either way you go) that you don't want to overlook.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session

2006-04-20 Thread João Cândido de Souza Neto
João Cândido de Souza Neto wrote:

 Hi everyone.
 
 I hope someone here can help me.
 
 When i start a session in a php page, this session receives an unique id.
 
 If you think about this, if i call a session_destroy() in any page and in
 the other paga call a session_start() again, it'll receive other unique
 id. But it isn't working. Everything above has been executed but the
 session id's always the same.
 
 It can be any config var in php.ini?
 
 Thanks for tips.
 

I found a solution myself.

session_regenerate_id()

Thanks for all.

-- 
---
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session contamination?

2006-04-20 Thread Chuck Anderson
This has been a very interesting discussion, as I have had the same 
problem, but never thought much about the fact that I could do 
anything about it.


As to session save path, when I run phpinfo (at my remote Linux server) 
it tells me that it is set to no value. This means it would default to 
/tmp. Where is this tmp directory? I have looked at the tmp directory 
that is one level above my site's www directory (outside of the web 
space), but I do not see any session data there. That's why I am asking 
if it is a system wide directory, or is it the one in my home directory.


If I set the path myself, what would be a good location? (I assume it 
should be outside the web space). Should I make up some random folder 
name (one time) and story my session data within that directory, within 
my own home directory?


Ben Liu wrote:


Hello All,

I'm using a single development server to host multiple client
projects, many of which require session management. I've noticed that
sometimes when I test these various web apps (which are simply in
separate sub directories) I get session leakage where logging in and
establishing a session on one app allows me access to (automatically
logs me in) to other app(s) on the same server. Or sometimes a session
variable will be set across all the apps, like $_SESSION['username'].

Is this due to the fact that sessions are established between client
browsers and servers, regardless of directory/sub directory?

What is the best way to avoid/prevent this problem? Should I be using
specific Session ID's or Session names?

Thanks for any help,

- Ben
 




--
*
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session vars

2006-03-23 Thread John Wells
U, is your top.php code being printed AT ALL? Because in the code
you gave us, you're attempting to include topo.php.

HTH,
John

On 3/21/06, João Cândido de Souza Neto [EMAIL PROTECTED] wrote:
 tedd wrote:

  Hi:
 
  I hate this.
 
 Ok guy, don't fight with me. hehehe
 
 Follow's all code of files.
 
  Yeah ! Where's rodape.php ?
 
  If we're going to spend our time looking at your code, shouldn't you
  spend the time to provide all of it?
 
  tedd
 

 I'm sorry for do that.

 I'm stressed today. Forgive me.

 Follow's the rodape.php code:

 table width=780 height=61 border=0 cellpadding=0 cellspacing=0
 bgcolor=#FF align=center
 tr
 td height=61 bgcolor=#009EFF
 div align=center
 font color=#FF
 strong
 Buffet Online - 
 www.buffetonline.com.br
 /strong
 br
 Copyright (c) 2006 - Todos os 
 direitos reservados
 /font
 /div
 /td
 /tr
 /table

 --
 ---
 João Cândido de Souza Neto
 Web Developer

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: session vars

2006-03-21 Thread João Cândido de Souza Neto
João Cândido de Souza Neto wrote:

 Hipeople.
 
 I've a system where i use session and all is working fine. But has
 something that don't work and i can't to find the cause.
 
 When a use the include function, the file included don't see the session
 vars.
 
 Anyone knows why it's happen?
 
 Thanks.
 

I'll try to explain better my problem.

After start the session and setting all of session variables.

I have a file named top.php that has the follow code in:

a href=? echo $_SESSION[root]; ?/about.php
About system
/a

I've too a file named page.php that has the follow code in:

? session_start(); ?
... Some codes ...
? include(top.php); ?
... some codes ...

By this way, the file top.php ought to see the $_SESSION[root] variable,
but it isn't happening.

Just to remember, my register_global is defined to off.

Thanks for your tips.

-- 
---
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session vars

2006-03-21 Thread Shaunak Kashyap
Where and how is $_SESSION[root] being initialized?

Try outputting it's value right after it is initialized and see if that works 
successfully.

Then try and output it's value right before the include(top.php) statement 
and see if that works successfully.

Finally, try and output it inside top.php and see if that works.

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the attachments 
accompanying) it may contain confidential information belonging to the sender 
which is protected.  The information is intended only for the use of the 
intended recipient.  If you are not the intended recipient, you are hereby 
notified that any disclosure, copying, distribution or taking of any action in 
reliance on the contents of this information is prohibited. If you have 
received this transmission in error, please notify the sender by reply e-mail 
and destroy all copies of this transmission.


 -Original Message-
 From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 21, 2006 9:38 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: session vars
 
 João Cândido de Souza Neto wrote:
 
  Hipeople.
 
  I've a system where i use session and all is working fine. But has
  something that don't work and i can't to find the cause.
 
  When a use the include function, the file included don't see the session
  vars.
 
  Anyone knows why it's happen?
 
  Thanks.
 
 
 I'll try to explain better my problem.
 
 After start the session and setting all of session variables.
 
 I have a file named top.php that has the follow code in:
 
 a href=? echo $_SESSION[root]; ?/about.php
 About system
 /a
 
 I've too a file named page.php that has the follow code in:
 
 ? session_start(); ?
 ... Some codes ...
 ? include(top.php); ?
 ... some codes ...
 
 By this way, the file top.php ought to see the $_SESSION[root] variable,
 but it isn't happening.
 
 Just to remember, my register_global is defined to off.
 
 Thanks for your tips.
 
 --
 ---
 João Cândido de Souza Neto
 Web Developer
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session vars

2006-03-21 Thread João Cândido de Souza Neto
Shaunak Kashyap wrote:

 Where and how is $_SESSION[root] being initialized?
 
 Try outputting it's value right after it is initialized and see if that
 works successfully.
 
 Then try and output it's value right before the include(top.php)
 statement and see if that works successfully.
 
 Finally, try and output it inside top.php and see if that works.
 
 Shaunak Kashyap
  
 Senior Web Developer
 WPT Enterprises, Inc.
 5700 Wilshire Blvd., Suite 350
 Los Angeles, CA 90036
  
 Direct: 323.330.9870
 Main: 323.330.9900
  
 www.worldpokertour.com
  
 Confidentiality Notice:  This e-mail transmission (and/or the attachments
 accompanying) it may contain confidential information belonging to the
 sender which is protected.  The information is intended only for the use
 of the intended recipient.  If you are not the intended recipient, you are
 hereby notified that any disclosure, copying, distribution or taking of
 any action in reliance on the contents of this information is prohibited.
 If you have received this transmission in error, please notify the sender
 by reply e-mail and destroy all copies of this transmission.
 
 
 -Original Message-
 From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 21, 2006 9:38 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: session vars
 
 João Cândido de Souza Neto wrote:
 
  Hipeople.
 
  I've a system where i use session and all is working fine. But has
  something that don't work and i can't to find the cause.
 
  When a use the include function, the file included don't see the
  session vars.
 
  Anyone knows why it's happen?
 
  Thanks.
 
 
 I'll try to explain better my problem.
 
 After start the session and setting all of session variables.
 
 I have a file named top.php that has the follow code in:
 
 a href=? echo $_SESSION[root]; ?/about.php
 About system
 /a
 
 I've too a file named page.php that has the follow code in:
 
 ? session_start(); ?
 ... Some codes ...
 ? include(top.php); ?
 ... some codes ...
 
 By this way, the file top.php ought to see the $_SESSION[root]
 variable, but it isn't happening.
 
 Just to remember, my register_global is defined to off.
 
 Thanks for your tips.
 
 --
 ---
 João Cândido de Souza Neto
 Web Developer
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

I tried it yet, if a put a echo $_SESSION[root] before or after the
include, it works fine, it doesn't work in the file top.php.

-- 
---
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session vars

2006-03-21 Thread Chris Shiflett

João Cândido de Souza Neto wrote:

I tried it yet, if a put a echo $_SESSION[root] before or
after the include, it works fine, it doesn't work in the
file top.php.


Show us the code. What you're describing should not be possible.

Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session vars

2006-03-21 Thread João Cândido de Souza Neto
Chris Shiflett wrote:

 João Cândido de Souza Neto wrote:
 I tried it yet, if a put a echo $_SESSION[root] before or
 after the include, it works fine, it doesn't work in the
 file top.php.
 
 Show us the code. What you're describing should not be possible.
 
 Chris

Here's the original message:

After start the session and setting all of session variables.

I have a file named top.php that has the follow code in:

a href=? echo $_SESSION[root]; ?/about.php
About system
/a

I've too a file named page.php that has the follow code in:

? session_start(); ?
... Some codes ...
? include(top.php); ?
... some codes ...

By this way, the file top.php ought to see the $_SESSION[root] variable,
but it isn't happening.

Just to remember, my register_global is defined to off.

-- 
---
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session vars

2006-03-21 Thread Chris Shiflett

João Cândido de Souza Neto wrote:

 Show us the code.

... Some codes ...


That doesn't count. :-)

You're describing a situation that I seriously doubt is reflected in 
your code. Reduce the problem to the simplest example you possibly can, 
and then show us the code.


Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: session vars

2006-03-21 Thread João Cândido de Souza Neto
Chris Shiflett wrote:

 João Cândido de Souza Neto wrote:
  Show us the code.
 
 ... Some codes ...
 
 That doesn't count. :-)
 
 You're describing a situation that I seriously doubt is reflected in
 your code. Reduce the problem to the simplest example you possibly can,
 and then show us the code.
 
 Chris

This code's exactly the one that produce the error.

That is, in the line:

a href=? echo $_SESSION[root]; ?/about.php

ought to write a href=http://localhost/buffets/about.php;

Did you understand?

-- 
---
João Cândido de Souza Neto
Web Developer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session vars

2006-03-21 Thread Shaunak Kashyap
 -Original Message-
 From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 21, 2006 11:26 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Re: session vars
 
 This code's exactly the one that produce the error.
 
 That is, in the line:
 
 a href=? echo $_SESSION[root]; ?/about.php
 
 ought to write a href=http://localhost/buffets/about.php;
 
 Did you understand?
 
 --
 ---
 João Cândido de Souza Neto
 Web Developer
 

Can you please provide the simplest example starting from where 
$_SESSION[root] is initialized to where it is first unsuccessfully used, in 
the following format:

top.php:
(insert example code here)

page.php:
(insert example code here)

... and any other relevant files ...


Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the attachments 
accompanying) it may contain confidential information belonging to the sender 
which is protected.  The information is intended only for the use of the 
intended recipient.  If you are not the intended recipient, you are hereby 
notified that any disclosure, copying, distribution or taking of any action in 
reliance on the contents of this information is prohibited. If you have 
received this transmission in error, please notify the sender by reply e-mail 
and destroy all copies of this transmission.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: session vars

2006-03-21 Thread João Cândido de Souza Neto
Shaunak Kashyap wrote:

 -Original Message-
 From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 21, 2006 11:26 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Re: session vars
 
 This code's exactly the one that produce the error.
 
 That is, in the line:
 
 a href=? echo $_SESSION[root]; ?/about.php
 
 ought to write a href=http://localhost/buffets/about.php;
 
 Did you understand?
 
 --
 ---
 João Cândido de Souza Neto
 Web Developer
 
 
 Can you please provide the simplest example starting from where
 $_SESSION[root] is initialized to where it is first unsuccessfully used,
 in the following format:
 
 top.php:
 (insert example code here)
 
 page.php:
 (insert example code here)
 
 ... and any other relevant files ...
 
 
 Shaunak Kashyap
  
 Senior Web Developer
 WPT Enterprises, Inc.
 5700 Wilshire Blvd., Suite 350
 Los Angeles, CA 90036
  
 Direct: 323.330.9870
 Main: 323.330.9900
  
 www.worldpokertour.com
  
 Confidentiality Notice:  This e-mail transmission (and/or the attachments
 accompanying) it may contain confidential information belonging to the
 sender which is protected.  The information is intended only for the use
 of the intended recipient.  If you are not the intended recipient, you are
 hereby notified that any disclosure, copying, distribution or taking of
 any action in reliance on the contents of this information is prohibited.
 If you have received this transmission in error, please notify the sender
 by reply e-mail and destroy all copies of this transmission.

Ok guy, don't fight with me. hehehe

Follow's all code of files.

In the file /index.php the session is started, the root session variable
is registered and defined, in the In the file sca/index.php the file
top.php if included and in the file top.php the variable $_SESSION[root]
hasn't value.

Thanks for your help.

File top.php:

div align=center
center
table width=780 border=0 cellpadding=0 cellspacing=0
bgcolor=#FF
tr
td colspan=2
img src=img/topo.jpg width=780 
height=117
/td
/tr
tr
td width=353 height=24 
background=img/bg_menu.jpg
style=PADDING-LEFT:10px
table height=24 border=0 
cellpadding=0 cellspacing=0
tr
td 
style=PADDING-TOP:5px;PADDING-BOTTOM:4px
?

function retorna_data ( ) {

$agora = time();

$data = getdate($agora);


if($data[wday]==0) { echo Domingo, ; }

elseif($data[wday]==1) { echo Segunda-feira, ; }

elseif($data[wday]==2) { echo Terça-feira, ; }

elseif($data[wday]==3) { echo Quarta-feira, ; }

elseif($data[wday]==4) { echo Quinta-feira, ; }

elseif($data[wday]==5) { echo Sexta-feira, ; }

elseif($data[wday]==6) { echo Sábado, ; }


if($data[mon]==1) { $mes=Janeiro; }

elseif($data[mon]==2) { $mes=Fevereiro; }

elseif($data[mon]==3) { $mes=Março; }

elseif($data[mon]==4) { $mes=Abril; }

elseif($data[mon]==5) { $mes=Maio; }

elseif($data[mon]==6) { $mes=Junho; }

elseif($data[mon]==7) { $mes=Julho; }

elseif

RE: [PHP] Re: session vars

2006-03-21 Thread tedd

Hi:

I hate this.


Ok guy, don't fight with me. hehehe

Follow's all code of files.


Yeah ! Where's rodape.php ?

If we're going to spend our time looking at your code, shouldn't you 
spend the time to provide all of it?


tedd

--

http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   >