Solved

Simple 2 part question about $_GET AND $_SESSION

Posted on 2002-07-15
8
144 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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…
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.

679 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