[PHP] Sessions
Hi All, I'm struggling with a session problem and I'm not sure where I should be looking for the answer. Most of my pages begin like this: include_once('cfheader.php'); $feedback = cfHeader("Main Page"); //Start of page code The cfheader.php file begins like this: "; //Redirect exit; } This works fine on my development PC, (PHP v 4.3.1) and on my primary test site (PHP v4.2.2). However when I try it on the target site (PHP v4.1.2) then I find that immediately after starting the session everything works fine, however when I move to any other page the session information is lost and I'm redirected to log in again. I was looking over the PHPInfo but to be honest I can't see what it is that's different. All help is gratefully appreciated. regards, Dave --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.497 / Virus Database: 296 - Release Date: 04/07/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
Kirk, Thanks for the input. I've never been certain about the "register_globals" setting. From what I read I understood it that since I use the new method and have my dev site set to off that it wouldn't be a problem. As it turns out my dev site has globals OFF, test site ON and target site ON. So I'm no closer to figuring that one out. regards, Dave "Kirk Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > This works fine on my development PC, (PHP v 4.3.1) and on > > my primary test > > site (PHP v4.2.2). > > However when I try it on the target site (PHP v4.1.2) then I find that > > immediately after starting the session everything works fine, > > however when I > > move to any other page the session information is lost and > > I'm redirected to > > log in again. > > Also check the "register_globals" setting in the various php.ini files. It > is probably set to "off" on your dev and test sites, but may be set to "on" > on the target site. > > Kirk --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.497 / Virus Database: 296 - Release Date: 04/07/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions
Thanks to all who posted. Well, I managed to track down the problem. The PHP system was set to use /tmp for its session.save_path but there was no /tmp directiory. Strange because on my test site I don't have a /tmp directory... I'm guessing my ISP has taken care of that separately. Anyway I created a tmp folder and everything seems fine. Thanks again. Dave --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.497 / Virus Database: 296 - Release Date: 04/07/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting at $_POST values using a loop
Hi all, This one is causing me a few headaches. How should I be doing this? On my previous page I've created a series of fields using a loop so that a field is created like this: echo "$fieldname:"; On my next page then I've got to try to read these values. I could do this as $_POST['Field0'], $_POST['Field1'] etc but a loop is what is required. I've tried getting at the value by: $a=$_POST['Field$n']; and $nb='$'."_POST['Field".$n."']"; $a=$$nb; And neither works. How should I be doing it? Thanks in advance for all help. regards, Dave --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting at $_POST values using a loop
Thanks Ralph and everyone else who posted a hint. I'm using the array method. Much better and, I'm ashamed to admit it, it means I can do away with my hidden input with "number of fields" too... regards, Dave "Ralph" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > echo "$fieldname:"; > > for ($i=0, $n=sizeof($_POST['FieldName']); $i<$n; $i++){ > >// do whatever you need to do with each field > echo $_POST['FieldName'][$i]; > } > > > -Original Message- > From: Dave Alger [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 22, 2003 9:12 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Getting at $_POST values using a loop > > Hi all, > > This one is causing me a few headaches. How should I be doing this? > > On my previous page I've created a series of fields using a loop so that > a > field is created like this: > > echo "$fieldname:"; > > On my next page then I've got to try to read these values. I could do > this > as $_POST['Field0'], $_POST['Field1'] etc but a loop is what is > required. > > I've tried getting at the value by: > > $a=$_POST['Field$n']; > > and > > $nb='$'."_POST['Field".$n."']"; > $a=$$nb; > > And neither works. How should I be doing it? > > Thanks in advance for all help. > > regards, > Dave > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Classes within classes
Hiya, It would be useful for me to be able to use a class within another class and I don't know if that's permissable in PHP. Here's an example of what I'm trying to do. Is it just simply not permitted or am I going about it the wrong way? Thanks in advance for any help, Dave Code follows: = class CSSFont { var $family ='Arial'; var $size ='12pt'; var $style = 'none'; function Output() { $out = "\n"; $out .= "font-family:".$this->family.";\n"; $out .= "font-size:".$this->size.";\n"; $out .= "font-style:".$this->style.";\n"; return $out; } } class CSSBorder { var $font1= new CSSFont; var $font2= new CSSFont; function Output() { $out = $this->font1->Output(); $out .= " other stuff goes here "; $out .= $this->font2->Output(); } } = --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php