Solved

global.asa equivalent in PHP

Posted on 2008-10-23
1
452 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
The viewer will learn how to count occurrences of each item in an array.

718 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