Solved

global.asa equivalent in PHP

Posted on 2008-10-23
1
447 Views
Last Modified: 2012-06-27
Hello,

I'm trying to keep track of a session variable in PHP.
It will be set to 0 when the user comes to the website but once they go to a certain page, I want it to be once throughout their session.
It should only be initialized to 0 when they close the browser.

Is there like a global.asa equivalent in php?
Thanks.
0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

by:
NoiS earned 500 total points
ID: 22789553
hmmm...
Maybe I didn't undertand it right but...
Sessions in PHP are recoverable by de id (you can acess the value by session_id() function).
If you do a session_start() PHP automatically read the session_id() from $_COOKIE or $_REQUEST (in this order).
SESSION is used to identify uniquely a user. So you can simulate persistance of vars and objects.
Its praticaly impossible to control when user go out,  so, the session have a time to expire (or not).
Some people use some tricks to test if the user is displaying the contents with AJAX or put a js on body tag function onunload(); But is untrusted.
Think about it!
About global.asa. Global.asa is for WEB SERVER, not for the script language. There's none relationship.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP Curl Problem 10 68
How to get chosen background-color on every line? 10 42
What is key combo for a b with a forward slash through it? 12 59
Joomla Editing 3 18
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question