Re: Re: SESSION and include
| From: | Jochem Maas | Date: | Wed, 08 Feb 2006 16:38:43 +0000 |
| Subject: | Re: Re: SESSION and include | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230110@lists.php.net to get a copy of this message | ||
your problem is probably the fact that when you include
page.php you are in effect calling session_start() twice -
no idea what that does to your session but I wouldn't be
suprised if that borked the _SESSION array.
TIP: create a 'global include file' that contains all the code
required by every 'page' (i.e. every request) and have each page
do a require_once on the 'global include' - below is a basic
example:
INDEX.PHP
require_once 'global.inc.php'; // bla bla bla - do stuff <<<<<<<<<<<< GLOBAL.PHP<?php
session_start(); // do more repetitive 'init' stuff <<<<<<<<<<<< Fredrik Tillman wrote:<?php
ok.. I was a little too fast again when explaining my problem.. Gonna put some code up for you to see... First of all I DO use quotes. I tried both single and double ones (',")I can't smell that from here though can I? but on the plus side you have just learnt to cut and paste the real [problem] code as opposed to writing out a similar bit of code as an example. ....
if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){one has to wonder why you are needing to stripslashes on the values you are retrieving from the DB ??? especially given that you then don't use the values you have just stripped. you could remove this whole foreach loop and the code would work indentically (based on what I can see here). ....$$key = stripslashes( $val );