Solved

Simple 2 part question about $_GET AND $_SESSION

Posted on 2002-07-15
8
134 Views
Last Modified: 2006-11-17
What's the difference between $_GET, and $HTTP_GET_VARS? And what does $_SESSION do?
0
Comment
Question by:sargento
  • 5
  • 2
8 Comments
 

Accepted Solution

by:
Theril earned 50 total points
ID: 7155836
$_GET holds exactly the same data as $HTTP_GET_VARS. Shorter names for these predefined arrays were introduced in PHP 4.1.0, maybe because register_globals were removed from default configuration (register_globals registers cookie, session, get, post etc. to simple global variables).
More information: http://www.php.net/manual/en/reserved.variables.php

$_SESSION ($HTTP_SESSION_VARS) is an array that holds data for the current session. For more information on sessions, see: http://www.php.net/manual/en/ref.session.php
0
 
LVL 32

Expert Comment

by:Batalf
ID: 7155840
There are no difference between $_GET and $HTTP_GET_VARS, just 2 ways of refering to the same thing.

$_SESSION is the same as $HTTP_SESSION_VARS and is an assosiative array containing information stored as sessin-variables.

For more info, look at :

http://www.zend.com/manual/ref.session.php
0
 

Author Comment

by:sargento
ID: 7155844
If seen this:
print_r($_SESSION);
0
 

Author Comment

by:sargento
ID: 7155846
Does that just verify a session?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:sargento
ID: 7155850
Does that just verify a session?
0
 
LVL 32

Expert Comment

by:Batalf
ID: 7155856
NO, it does more than that. It stores all the variables registred in a session.

Example:

<?php
session_start();
if (isset($HTTP_SESSION_VARS['count'])) {
   $HTTP_SESSION_VARS['count']++;
}
else {
   $HTTP_SESSION_VARS['count'] = 0;
}
?>
 
To register the variable:

<?php
if (!session_is_registered('count')) {
    session_register("count");
    $count = 0;
}
else {
    $count++;
}
?>

$HTTP_SESSION_VARS could in this example be replaced by $_SESSION


0
 

Author Comment

by:sargento
ID: 7155907
Does that just verify a session?
0
 

Author Comment

by:sargento
ID: 7156126
i'll put up 50 for Batalf also! THank you both!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now