php-general Digest 2 Jan 2004 18:19:08 -0000 Issue 2508

Topics (messages 173623 through 173645):

Re: A simple instruction
        173623 by: Justin French

Array into $_SESSION
        173624 by: Cesar Aracena
        173625 by: Gerard Samuel
        173626 by: Cesar Aracena
        173641 by: Larry Brown
        173642 by: Larry Brown

No cookie is being set?
        173627 by: Cesar Aracena
        173640 by: Larry Brown
        173644 by: Cesar Aracena

Welcher Bugtracker in/für PHP?
        173628 by: Andreas Korthaus

Re: ereg + performance problem
        173629 by: Mirek Novak
        173635 by: Martin Helie

Re: which Bugtracker for a PHP-project?
        173630 by: Andreas Korthaus

Using -> operator for declarations?
        173631 by: Marco Skulschus
        173639 by: Greg Beaver

Setting timeout for fopen
        173632 by: Boaz Yahav

Sort a while loop ?
        173633 by: Dave Carrera
        173634 by: Tom Rogers
        173636 by: Dave Carrera
        173637 by: Martin Helie

SimpleXML and documentation
        173638 by: Eric Daspet

[Stats] PHP Net List: December 2003
        173643 by: Bill Doerrfeld

Session logic question
        173645 by: Al

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- On Friday, January 2, 2004, at 09:30 AM, Dino Costantini wrote:

i have a file name with the path ex food/italy/pizza/margherita.php. how can i obtain the name of the file in this case "margherita.php" i know there is a function, but i don't remember it.
thx

<?=$_SERVER['PHP_SELF']?> ... will echo something like... food/italy/pizza/margherita.php

If you need just margherita.php, then you can explode() the string on '/', and take the last element:

<?
$pathBits = explode('/',$_SERVER['PHP_SELF']);
echo $file = $pathBits[count($pathBits)-1];
?>

To look for other useful vars, try <pre><? print_r($_SERVER); ?></pre>

Justin French
--- End Message ---
--- Begin Message ---
Hi all,

can somebody remind me how to propperly insert not just one but many
variables into a $_SESSION handle? php manual doesn't explain it very well.
It just says that it can be done.

Thanks in advanced,

Cesar Aracena

--- End Message ---
--- Begin Message ---
On Friday 02 January 2004 02:11 am, Cesar Aracena wrote:
> Hi all,
>
> can somebody remind me how to propperly insert not just one but many
> variables into a $_SESSION handle? php manual doesn't explain it very well.
> It just says that it can be done.
>

$_SESSION['foo'] = array('a', 'b', 'c', 'd', 'e');

var_dump($_SESSION['foo'][3]);  => 'd'

--- End Message ---
--- Begin Message ---
Thanks a lot :)

"Gerard Samuel" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> On Friday 02 January 2004 02:11 am, Cesar Aracena wrote:
> > Hi all,
> >
> > can somebody remind me how to propperly insert not just one but many
> > variables into a $_SESSION handle? php manual doesn't explain it very
well.
> > It just says that it can be done.
> >
>
> $_SESSION['foo'] = array('a', 'b', 'c', 'd', 'e');
>
> var_dump($_SESSION['foo'][3]);  => 'd'

--- End Message ---
--- Begin Message ---
session_register("user");
session_register("authLevel");
session_register("sessionExpire");

$user=$userDataFromForm;
$authLevel = $authLevelFromDB;
$sessionExpire = time() + 3600;

etc...

-----Original Message-----
From: Cesar Aracena [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 2:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Array into $_SESSION


Hi all,

can somebody remind me how to propperly insert not just one but many
variables into a $_SESSION handle? php manual doesn't explain it very well.
It just says that it can be done.

Thanks in advanced,

Cesar Aracena

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

--- End Message ---
--- Begin Message ---
Sorry, my bad.  This is the Register Globals on version...

with RegisterGlobals off you would simply use..

$_SESSION['user'] = $userDataFromForm;
$_SESSION['authLevel'] ....



-----Original Message-----
From: Larry Brown [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 11:33 AM
To: Cesar Aracena; PHP List
Subject: RE: [PHP] Array into $_SESSION


session_register("user");
session_register("authLevel");
session_register("sessionExpire");

$user=$userDataFromForm;
$authLevel = $authLevelFromDB;
$sessionExpire = time() + 3600;

etc...

-----Original Message-----
From: Cesar Aracena [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 2:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Array into $_SESSION


Hi all,

can somebody remind me how to propperly insert not just one but many
variables into a $_SESSION handle? php manual doesn't explain it very well.
It just says that it can be done.

Thanks in advanced,

Cesar Aracena

-- 
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

--- End Message ---
--- Begin Message ---
Hi again,

I have the following code to first start a session and then write a
cookie... is that so hard? Well it is starting the session but the cookie is
not being set. see:

$row = mysql_fetch_array($result);
$_SESSION["user"] = $row[member_id];
if ($_POST["autologin"] == "yes")
{
 $id = $_SESSION["user"];
 setcookie("memberlogin", $id, time()+60*60*24*365);
 header("Location: $CFG->wwwroot");
 exit();
}
else
{
 header("Location: $CFG->wwwroot");
 exit();
}

What can it be? No error is posted.

Thanks in advanced,

Cesar Aracena

--- End Message ---
--- Begin Message ---
shouldn't $row[member_id] be $row['member_id'].  In case anyone can profit
from this, when I find a function doesn't work right and I am using
variables in its execution I run an echo/die combination immediately before
the function to verify the data being fed to it is as it should be.  In this
example...

...
$id = $_SESSION["user"];
echo "setcookie(\"memberlogin\", ".$id.", ".time() +60*60*24*365.");";
die();
setcookie...

What does this yeild?





-----Original Message-----
From: Cesar Aracena [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 2:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] No cookie is being set?


Hi again,

I have the following code to first start a session and then write a
cookie... is that so hard? Well it is starting the session but the cookie is
not being set. see:

$row = mysql_fetch_array($result);
$_SESSION["user"] = $row[member_id];
if ($_POST["autologin"] == "yes")
{
 $id = $_SESSION["user"];
 setcookie("memberlogin", $id, time()+60*60*24*365);
 header("Location: $CFG->wwwroot");
 exit();
}
else
{
 header("Location: $CFG->wwwroot");
 exit();
}

What can it be? No error is posted.

Thanks in advanced,

Cesar Aracena

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

--- End Message ---
--- Begin Message ---
As extrange as can be, the echo function simply returns the following:

31536000);

but not the setcookie, $varname and $value parts... What's this? Do I havve
a missconfiguration in php.ini file?

Thanks,

Cesar Aracena

"Larry Brown" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> shouldn't $row[member_id] be $row['member_id'].  In case anyone can profit
> from this, when I find a function doesn't work right and I am using
> variables in its execution I run an echo/die combination immediately
before
> the function to verify the data being fed to it is as it should be.  In
this
> example...
>
> ...
> $id = $_SESSION["user"];
> echo "setcookie(\"memberlogin\", ".$id.", ".time() +60*60*24*365.");";
> die();
> setcookie...
>
> What does this yeild?
>
>
>
>
>
> -----Original Message-----
> From: Cesar Aracena [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 02, 2004 2:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] No cookie is being set?
>
>
> Hi again,
>
> I have the following code to first start a session and then write a
> cookie... is that so hard? Well it is starting the session but the cookie
is
> not being set. see:
>
> $row = mysql_fetch_array($result);
> $_SESSION["user"] = $row[member_id];
> if ($_POST["autologin"] == "yes")
> {
>  $id = $_SESSION["user"];
>  setcookie("memberlogin", $id, time()+60*60*24*365);
>  header("Location: $CFG->wwwroot");
>  exit();
> }
> else
> {
>  header("Location: $CFG->wwwroot");
>  exit();
> }
>
> What can it be? No error is posted.
>
> Thanks in advanced,
>
> Cesar Aracena
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi!

Suche nen netten/einfachen Bugtracker für ein PHP-Projekt.

Welchen könnt Ihr empfehlen?

Grüße
Andreas

--- End Message ---
--- Begin Message --- Hi,
I think that smarty [ http://smarty.php.net ] can do this for u. It has tag nesting and, of course, you can define your own tag as a plugin.


As for performance problem - this is known "feature" of regexp. Solution is not simple. You, IMHO, have to rethink your approach. For parsing larger or complex files is much better to use state machine (finite state automaton). Try to search google for more theory. For ex. http://en.wikipedia.org/wiki/Finite_state_automaton

Martin Helie wrote:
Hello,

I'm writing a routine that recursively reads an HTML document, looking for
"special tags". It's a template system, but contrary to what I've seen out
there so far, no template engines allow for any kind of customization from
within the document; they only seem to be variable replacement systems.

What I have in mind is something along the lines of:

<HTML>
    blah blah
    {MAGICTAG param1=a param2=b}some more {ANOTHERTAG}text{/ANOTHERTAG} here
{/MAGICTAG}
    blah
</HTML>

The text between ANOTHERTAG would first be changed and then passed along
with the other text to MAGICTAG. ie, the data is treated from the inside
out, and nesting is obviously supported.

I've got everything working, but the problem is I'm using quite a few "ereg"
statements recursively, so performance is not so good.

Here's a simplified version of the core (it's part of a class, and I
modified the code for a "standalone" version here).

Thanks in advance for any ideas. Feel free to recycle this code.

function parse( $template ) {

    //Look for (before*) {a tag} (after*) anything and store matches in
$regs
    if( ereg( "(.*)[{]([a-zA-Z0-9]+)[}](.*)", $template, $regs ) ) {
        $before = $regs[1];
        $tag     = $regs[2];

        //Now look for (data*) {/closing tag} (after*) in the "after"
portion of first match
        if( ereg( "(.*)[{][/]" . $tag. "[}](.*)", $regs[3], $regs ) ) {
            $after = $regs[2];
            $data = $regs[1];
            $resolvedTag = initHandler( $tag, $data ); //handle this tag and
data
        }
        //support for "standalone" tags (no {/closing tag} )
        else {
            ereg( "(.*)", $regs[3], $regs );
            $resolvedTag = getTagValue( $tag );
            $after = $regs[1];
        }
    }
    if( $resolvedTag ) {
        $template =
        $before
        . $resolvedTag
        . $after;
        parse( $template );
    }
    else {
        return $template;
    }
}


-- Mirek Novak

jabberID: [EMAIL PROTECTED]
ICQ: 119499448

--- End Message ---
--- Begin Message ---
Hi Mirek,

thanks for pointing this out. This looks like a great site -- although, as
you say, will require some [longer term] study.

I'll have closer look at Smarty as well...


"Mirek Novak" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>   I think that smarty [ http://smarty.php.net ] can do this for u. It
> has tag nesting and, of course, you can define your own tag as a plugin.
>
> As for performance problem - this is known "feature" of regexp. Solution
> is not simple. You, IMHO, have to rethink your approach. For parsing
> larger or complex files is much better to use state machine (finite
> state automaton). Try to search google for more theory. For ex.
> http://en.wikipedia.org/wiki/Finite_state_automaton
>
> Martin Helie wrote:
> > Hello,
> >
> > I'm writing a routine that recursively reads an HTML document, looking
for
> > "special tags". It's a template system, but contrary to what I've seen
out
> > there so far, no template engines allow for any kind of customization
from
> > within the document; they only seem to be variable replacement systems.
> >
> > What I have in mind is something along the lines of:
> >
> > <HTML>
> >     blah blah
> >     {MAGICTAG param1=a param2=b}some more {ANOTHERTAG}text{/ANOTHERTAG}
here
> > {/MAGICTAG}
> >     blah
> > </HTML>
> >
> > The text between ANOTHERTAG would first be changed and then passed along
> > with the other text to MAGICTAG. ie, the data is treated from the inside
> > out, and nesting is obviously supported.
> >
> > I've got everything working, but the problem is I'm using quite a few
"ereg"
> > statements recursively, so performance is not so good.
> >
> > Here's a simplified version of the core (it's part of a class, and I
> > modified the code for a "standalone" version here).
> >
> > Thanks in advance for any ideas. Feel free to recycle this code.
> >
> > function parse( $template ) {
> >
> >     //Look for (before*) {a tag} (after*) anything and store matches in
> > $regs
> >     if( ereg( "(.*)[{]([a-zA-Z0-9]+)[}](.*)", $template, $regs ) ) {
> >         $before = $regs[1];
> >         $tag     = $regs[2];
> >
> >         //Now look for (data*) {/closing tag} (after*) in the "after"
> > portion of first match
> >         if( ereg( "(.*)[{][/]" . $tag. "[}](.*)", $regs[3], $regs ) ) {
> >             $after = $regs[2];
> >             $data = $regs[1];
> >             $resolvedTag = initHandler( $tag, $data ); //handle this tag
and
> > data
> >         }
> >         //support for "standalone" tags (no {/closing tag} )
> >         else {
> >             ereg( "(.*)", $regs[3], $regs );
> >             $resolvedTag = getTagValue( $tag );
> >             $after = $regs[1];
> >         }
> >     }
> >     if( $resolvedTag ) {
> >         $template =
> >         $before
> >         . $resolvedTag
> >         . $after;
> >         parse( $template );
> >     }
> >     else {
> >         return $template;
> >     }
> > }
> >
>
> -- 
> Mirek Novak
>
> jabberID: [EMAIL PROTECTED]
> ICQ: 119499448

--- End Message ---
--- Begin Message ---
Andreas Korthaus wrote:
> Suche nen netten/einfachen Bugtracker für ein PHP-Projekt.
>
> Welchen könnt Ihr empfehlen?

Oh sorry, I it wasn't the german list ;-)

But perhaps it's also a question for this group:

I am looking for a nice/easy Bug-Tracker for my PHP-Project.

What would you recommend?

regards,
Andreas

--- End Message ---
--- Begin Message ---
Maybe, it was "correct" even in the past, but I am astonished that the
following special "variable declaration" works. Although there is not var
$MissingText in the class, one can fill it with data and pass it to the
object.

<?php
class Output {
 var $Text;
 function PrintOutput($Text){
  echo $Text;
 }
}

$Message = new Output();
// first attempt
$Message -> Text = "Hello World";
$Message -> PrintOutput($Message -> Text);
// second attempt
$Message -> MissingText = "Hello Moon";
$Message -> PrintOutput($Message -> MissingText);
?>

Maybe you can correct me.
Marco

--- End Message ---
--- Begin Message --- Hi Marco,

This is and has always been possible, php is not a strongly typed language.

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

Marco Skulschus wrote:
Maybe, it was "correct" even in the past, but I am astonished that the
following special "variable declaration" works. Although there is not var
$MissingText in the class, one can fill it with data and pass it to the
object.

<?php
class Output {
 var $Text;
 function PrintOutput($Text){
  echo $Text;
 }
}

$Message = new Output();
// first attempt
$Message -> Text = "Hello World";
$Message -> PrintOutput($Message -> Text);
// second attempt
$Message -> MissingText = "Hello Moon";
$Message -> PrintOutput($Message -> MissingText);
?>

Maybe you can correct me.
Marco

--- End Message ---
--- Begin Message ---
Hi

I can see that socket_set_timeout() will set the timeout for
fsockopen().
What would do the same for fopen?

Sincerely
 
berber
 
Visit http://www.weberdev.com/ & http://www.weberblog.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com
Search for PHP Code from your browser http://toolbar.weberdev.com
Share your thoughts : http://www.weberblog.com/submit.php?type=story

--- End Message ---
--- Begin Message ---
Hi List,

How can I sort a while loop or do something before it to achieve the
following?

I have a MySql result fetching something like this:

Id Name Number
1  Bob  34567
2  Ben  234
3  Jeff 4567
4  Dave 2345

But I want to sort the while loop by Number Highest first so the result
looks like this:

Id Name Number
1  Bob  34567
2  Jeff 4567
3  Dave 2345
4  Ben  234

I have looked at sort() asort() and others in the manual and either I am
doing something wrong (which is more than likely) or a while loop is not
what I need to use to achieve this.

Thank you in advance for any help

Dave C

P.S: Happy New Year to you all.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
 

--- End Message ---
--- Begin Message ---
Hi,

Saturday, January 3, 2004, 1:12:49 AM, you wrote:
DC> Hi List,

DC> How can I sort a while loop or do something before it to achieve the
DC> following?

DC> I have a MySql result fetching something like this:

DC> Id Name Number
DC> 1  Bob  34567
DC> 2  Ben  234
DC> 3  Jeff 4567
DC> 4  Dave 2345

DC> But I want to sort the while loop by Number Highest first so the result
DC> looks like this:

DC> Id Name Number
DC> 1  Bob  34567
DC> 2  Jeff 4567
DC> 3  Dave 2345
DC> 4  Ben  234

DC> I have looked at sort() asort() and others in the manual and either I am
DC> doing something wrong (which is more than likely) or a while loop is not
DC> what I need to use to achieve this.

DC> Thank you in advance for any help

DC> Dave C

DC> P.S: Happy New Year to you all.

DC> ---
DC> Outgoing mail is certified Virus Free.
DC> Checked by AVG anti-virus system (http://www.grisoft.com).
DC> Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
 


add

ORDER BY number DESC

to your mysql query

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Thanks Tom,

I had a complicated sql line and used my count(var) for the order by
statement and bingo. Just sometimes you forget the obvious an need a kick up
the **** :-)

Dave C

-----Original Message-----
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: 02 January 2004 15:22
To: Dave Carrera
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sort a while loop ?


Hi,

Saturday, January 3, 2004, 1:12:49 AM, you wrote:
DC> Hi List,

DC> How can I sort a while loop or do something before it to achieve the 
DC> following?

DC> I have a MySql result fetching something like this:

DC> Id Name Number
DC> 1  Bob  34567
DC> 2  Ben  234
DC> 3  Jeff 4567
DC> 4  Dave 2345

DC> But I want to sort the while loop by Number Highest first so the 
DC> result looks like this:

DC> Id Name Number
DC> 1  Bob  34567
DC> 2  Jeff 4567
DC> 3  Dave 2345
DC> 4  Ben  234

DC> I have looked at sort() asort() and others in the manual and either 
DC> I am doing something wrong (which is more than likely) or a while 
DC> loop is not what I need to use to achieve this.

DC> Thank you in advance for any help

DC> Dave C

DC> P.S: Happy New Year to you all.

DC> ---
DC> Outgoing mail is certified Virus Free.
DC> Checked by AVG anti-virus system (http://www.grisoft.com).
DC> Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
 


add

ORDER BY number DESC

to your mysql query

-- 
regards,
Tom




---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
 

--- End Message ---
--- Begin Message ---
Since you mention mysql, why not just add

"ORDER BY number DESC" to your query? The database will do the work for you.



"Dave Carrera" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi List,
>
> How can I sort a while loop or do something before it to achieve the
> following?
>
> I have a MySql result fetching something like this:
>
> Id Name Number
> 1  Bob  34567
> 2  Ben  234
> 3  Jeff 4567
> 4  Dave 2345
>
> But I want to sort the while loop by Number Highest first so the result
> looks like this:
>
> Id Name Number
> 1  Bob  34567
> 2  Jeff 4567
> 3  Dave 2345
> 4  Ben  234
>
> I have looked at sort() asort() and others in the manual and either I am
> doing something wrong (which is more than likely) or a while loop is not
> what I need to use to achieve this.
>
> Thank you in advance for any help
>
> Dave C
>
> P.S: Happy New Year to you all.
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003
>

--- End Message ---
--- Begin Message --- Hi

I'm working on a PHP5 project with some simple XML. I've seen examples of SimpleXML in CVS ("tests" and "examples" directories) but cannot find any real documentation.
Is there any docs somewhere ? where ?


If not, does someone can answer a few questions ?
- how do I add an element ?
- can I change the text content of an element ? if yes, how can I deal with something like "<element> text1 <sub/> text2 </element>" ?
- can I delete elements ? attributes ?
- how do I deal with namespaces ? I've seen a "register_ns" method but do not know if registration is inherited, and do not know how to use namespaces after registration ($element->ns:subelement is not a valid PHP syntax)
- I've seen many times that simpleXML is limited to 3 levels of nesting but there is a phpt with 4 levels. Is there a limitation ? if yes, which one ?


thanks per advance for all answers.
--
Eric Daspet

--- End Message ---
--- Begin Message ---
----------------------------------------------------------------------
Searchable archives for this list are available at
<http://www.listsearch.com/phplist.lasso>
----------------------------------------------------------------------

======================================================================
PHP Net List Stats
December, 2003
======================================================================

Note: Up/Down % as compared with November, 2003

Posts:   2149 (Down 33%)
Authors:  508 (Down  9%)
Threads:  628 (Down 17%)


Top 20 Contributors by Number of Posts ---------------------------------------------------------------------- Jay Blanchard 68 Justin Patrin 59 Chris Shiflett 43 David T-G 43 Richard Davey 41 Chris W. Parker 37 Manuel Lemos 37 Marek Kilimajer 37 John W. Holmes 36 Jason Wong 35 Jas 32 Ryan A 31 Chris 28 Raditha Dissanayake 26 Matt Matijevich 25 Robert Cummings 23 Justin French 22 Mike 20 Sven 20 Gerard Samuel 19


Top 20 Threads by Number of Posts ---------------------------------------------------------------------- [PHP] post an array into another site 27 [PHP] PHP IDE? 26 [PHP] What do you say to someone who says... 24 [PHP] how to determine if shopping cart has been abandoned? 22 [PHP] register_globals problem 17 [PHP] problem with INSERT query 17 [PHP] progress in php 17 [PHP] How New Is <<<HERE? 17 [PHP] goto label 15 [PHP] Can't upload file greater than 11kb 15 [PHP] file uploads 14 [PHP] Write on image in faint color 14 [PHP] related products, how to's best practices 13 [PHP] [Newbie Guide] For the benefit of new members 12 [PHP] header("Location: page.php") not redirecting 11 [PHP] validating email address 11 [PHP] (0/T) executeing script below public 11 [PHP] Sorting arrays 11 [PHP] HTTP headers, IE and downloading 11 [PHP] replace %rand[x]-[y]% macro in string with random string 10


Top 20 Search Terms by Number of Requests ---------------------------------------------------------------------- upgrade 13 problem 11 japanese 2 Server 2 session_destroy 2 setcookie 1 cart 1 date 1 calander 1 hassle 1 calendar 1 --


--------------------------------------------------------------------- Bill Doerrfeld [EMAIL PROTECTED] Blue World Communications, Inc. http://www.blueworld.com/ --------------------------------------------------------------------- Build and serve powerful data-driven Web sites with Lasso Studio and Lasso Professional.

--- End Message ---
--- Begin Message --- I use the $_SESSION buffer extensively on my site without a problem, except one.
Maybe someone can help me understand the problem.


I have a simple page counter with a test to see if the page has been counted for the user.

start_session();
*
* [additional code]
*
if($_SESSION['ctr_file']!==$counterFile) //See if visitor has already been counted for this page
{$num = $num+1; $_SESSION['ctr_file'] = $counterFile; //set/reset counter file for next time


Pages that use the counter function all have a start_session(); and a call to the counter function,

Everything works fine, except when I include another script file that also uses the $_SESSION buffer.

What appears to be happening is that start_session() on the second script reinitializes the session buffer and I lose the data from the first session.

Yet, as I read php manual, it seems to say that start_session is suppose to simply restore the variables for the page it is on; not start a new session.

many thanks....
--- End Message ---

Reply via email to