Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Errors With $_SESSION


the website i'm creating will block "guest" users to some sections of the site. when "guest users" go to "download" page it will show an alert window. logged in members have the access to download page.

in "login.php", i create a $_SESSION var, each member has their own level, depending on the type of features they want;

$_SESSION['mylevel'] = $member_info['level'];
the checking of level to show the alert window is this: Code:

if (($_SESSION[mylevel']=='')||($_SESSION['mylevel']==Ə')) { ?>
<SCRIPT LANGUAGE=JavaScript>
var agree=alert('Please login first.');
window.location='http://www.mywebsite.com'
</SCRIPT><? }

problem is like this; as a guest user, i go to "download" page, the alert window shows up, saying "please login first". (that's ok) when i log in, then go back to "download" page it still shows the alert window. i have to close the browser first then go to "download" page before its accessible.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Supress Errors At The Page Level? Undefined Index Errors.
I'm creating a simple reply form, and if a form item isn't answered I
get an error:
"Notice: Undefined index: rb_amntspent in
c:inetpubwwwrootmackinawsurvey.php on line 36"
even if in the code I allow for an unselected item. (Code at the
bottom here.)
It works fine otherwise.

Now in the past I've made a change to php.ini to repress errors, but
for this project I don't have access to the php.ini.
Is there a way to supress errors on that page for that session?

Or, is there a way to just not get that error at all?

Here's a sample of the code that gets the form response. If an item is
selected, no error for that question, but if an item is not selected I
get the error above even though I still get a successful echo for the
"else" or "default" option which occurs if nothing is selected:

$rb_visited = $_POST["rb_visited"]; //Have you ever visited Mackinaw
City, Michigan?
if ($rb_visited == "1") {
$rb_visited_reply = "Yes";
} elseif ($rb_visited == "0") {
$rb_visited_reply = "No";
} else {
$rb_visited_reply = "You did not answer this question";
};

$rb_lastvisit = $_POST["rb_lastvisit"]; //When was your last visit to
Mackinaw ity?
switch ($rb_lastvisit) {
case "1":
$rb_lastvisit_reply = "Earlier this year (2003)";
break;
case "2":
$rb_lastvisit_reply = "Last year (2002)";
break;
case "3":
$rb_lastvisit_reply = "2 years ago (2001)";
break;
case "4":
$rb_lastvisit_reply = "3 years ago (2000)";
break;
case "5":
$rb_lastvisit_reply = "4 or more years ago (1999)";
break;
default:
$rb_lastvisit_reply = "You did not answer this uestion";
}

$_session
I'm trying to pass a session variable thru a function and have the variable print out futher down the script. The variable should be echoed but it isn't unless the page is refreshed. I found a work around but it doesn't seem right.

My script is working with the way the code is, so my question is why do I have to call session_register() after $_SESSION to make the variable print without refreshing and if this is wrong what is the proper way of doing it? PHP Code:

$_SESSION
I'm running PHP4.2.3 on W2K box with Apache 1.3.2 I need to set up a login page and some session control for a site I'm working on. I know that there are numerous ways of doing this. Can anyone tell me the benefits/pitfalls of using $_SESSION.

over a class (or any other similar class like session control) called sessMan that stores the session detail in MySQL with all sorts of fancy encrypting code. How secure is $_SESSION?

$_SESSION
I'm having trouble with the final step to writing a support site for a voluntary body - that is, to impose password-controlled access. Office staff start at entry.php which asks for username and password.

Once they have been input, the visitor is passed to entry_check.php which interrogates the database. If the username and password are not valid, entry_check.php exits, returning the user to entry.php. Code:

$_session
I use $_SESSION to set/get my session variables in my scripts. However I am unable to get the current session id. I don't know where to find it! PHP Code:

Using $_SESSION
I have included some variables in my code that I want to be passed from page to page, I wrote the code and everything seemed to be working until I tried my pages from my workplace and discovered that the values weren't being passed. I tried lowering the internet security and allowing cookies and it was fixed. How do I write my code so that all ie sessions will allow the values to be retained?

$_SESSION
Our network Administrator applied an update to our web server recently. After this update was applied (Novell update), my phpMyEdit pages stopped responding. Everything else works fine. After doing some debugging, I found that if I placed all of my pages in the same directory, everything worked.

My $_SESSION vars will not transfer to other pages unless that page is in the same directory as the session was started in. I hope this is enough of an explaination. I am clueless as to why thus far. I am going to look at the php.ini file today.

$_SESSION
My session works in the page I set it, however I use onClick to go to another page or even a hyperlink and in the new page the session no longer exists, what may be the reasons for this?

$_SESSION $_POST
I've got a basic user register form, action="POST". in my php code (on
the same page, i store the $_POST stuff to a $_SESSION if the user
screws a field up so they don't have to reenter all their info. But
i'm thinking, why should i use $_POST at all if i can just us the
$_SESSION array? or maybe even vice versa? or am i doing this all the
wrong way?

$_SESSION Issue
I put together a code that checks for 2 post variables then stores them
in a multi-dim $_SESSION array, something like this:

If ( isset($_POST['value_a'] && isset($_POST['value_b']) )
{
$_SESSION['value']['a'] = $_POST['value_a'];
$_SESSION['value']['b'] = $_POST['value_b'];
}

The problem was that $_SESSION['value']['b'] was being overwritten with
the value for 'a' so that both $_SESSION['value'] vars ended up being
the same (i.e. $_POST['value_b']. I thoroughly tested it to confirm
that this was what happening.

I solved the problem by changing the $_SESSION vars to
$_SESSION['value_a'] and $_SESSION['value_b'].

This was PHP 5, the WAMP package -- I know it's not the latest update
of PHP 5.

My question: is this a bug (perhaps since fixed) or is there a reason
this would be expected behavior?

$_SESSION, Session_is_registered
Platform: Win2k Server, Apache 1.3, PHP 4.2.3

I understand that when using $_SESSION variables, using the
"session_register()" function should not be done. I have seen no
documentation pertaining the the "why" of this, but I am removing the
offending statements from my code anyway.

Prior to discovering this tidbit, I had been attempting to save some arrrays
in individually registered variables. But the arrays were not being saved
between pages.

I have also attempted to save the array in a $_SESSION variable (e.g.
$SESSION['XYZ']=$XYZ, xyz being an array); still no joy (the data seems to
be ending up in the $_SESSION variable, but again it is not saved between
page requests).

"register_globals" is set to "On" in the INI file.

So, to the PHP world at large I ask "what am I missing"?

$_SESSION Not Working?
I have two test files called index.php and index2.php.

Index.php:

<?php
session_start();
$_SESSION['sess_var'] = "hello world";

?>

<a href="index2.php">click</a>

-------------------------------------------------------------------------------
Index2.php:

<?php
error_reporting(E_ALL);
session_start();

echo $_SESSION['sess_var'];
?>

Index2.php does not display anything?!?! Any ideas??

I look at the session cookie and it has been set with the following
inside it:

sess_var|s:11:"hello world";

When I placed the line:

error_reporting(E_ALL);

in index2.php I got the following error:

Notice: Undefined index: sess_var in c:program filesapache
groupapachehtdocsindex2.php on line 5

line 5 is:

echo $_SESSION['sess_var'];

Session_register Or $_SESSION
I am using PHP 4.3 i have heard that we should use $_SESSION rather than session_register to register a session...is it true? also I should no longer use session_is_registered() or anything alike....i should use isset($_SESSION()) instead.

$_SESSION Vs. $variable
What am I doing wrong?

I set the variable co_name on the first page with an <input.... > and
session_start() at the top of both pages.

Clicking on a link that takes me to the second page:

Script on the second page.

echo $_SESSION['co_name']; Does not display
value of co_name
echo "Variable name co_name = ".$co_name; Displays value of co_name

One book suggested using echo {$_SESSION['co_name']}; Does not run.

Server is Apache2 Triad

$_SESSION Question
I've a file login.php that create a session, register a variable(myVar) and
call (include) another file login1.php in the server side.
I need to use the registred variable in the second file but
$_SESSION["myVar"] is empty.

here is a simplified example of my problem, the command echo
($_SESSION["myVar"]) isn't displaying any thing
login.php :
========
<?php
$myVar="test"
session_start();
session_register("myVar");

include("login1.php");
?>

login1.php :
=======
<?php
session_start();

echo ($_SESSION["myVar"]);
?>

$_SESSION[] And Forms
I am trying to declare session variables on a database 'insert record' page so that they can be used on the redirect page (the page that loads after the records are sent to the database). Currently I have it working but I have found out that session_register() is deprecated, so I'm trying to use $_SESSION like i should.

But I can't get it to work. I have tried everything I can think of, and spent about 10 hours searching for an example that i can understand. Several of them looked right, but didn't work for me. i make some vars from post values: PHP Code:

Problem Using $_SESSION
I wondered if anyone could offer me some guidance, I wrote this script
using the dzsoft php editor, which links to php.exe and a internal
server.

Though when I run the code the session files are created, but the item
number in the files never increase beyond (0).

I just wondered if there was anyone options in the php.ini I could
change, to allow this premission. Or any session option I could add to
the code.

<?php
error_reporting(E_ALL);
ini_set('display_errors', &#391;');

session_save_path('c:');
session_start();
if (!isset($_SESSION['item1'])) $_SESSION['item1'] = 0;
if (!isset($_SESSION['item2'])) $_SESSION['item2'] = 0;

if(isset($_GET['Item1'])){
$_SESSION['item1']++;
}
if(isset($_GET['Item2'])){
$_SESSION['item2']++;
}
?>

<html>
<head>
<title>Test Page</title>
</head>

<body>

<form>
<input type="submit" name="Item1" value="Item 1">
<input type="submit" name="Item2" value="Item 2">

<p>Number of Item 1 clicks: <?php echo $_SESSION['item1']; ?></p>
<p>Number of Item 2 clicks: <?php echo $_SESSION['item2']; ?></p>
</form>

</body>
</html>

$_SESSION Does Not Work To Me...
Another newbie question.

I'm using to do a test

$_SESSION["count"]++;

after a POST action, but evry time the page is reloaded $_SESSION is never
initialized... why?

Using Arrays With $_SESSION
I'm really confused on how to store arrays in a $_SESSION.

Right now to access an array I basically do this:

$lc = $_SESSION["cart"];

$lc[$item] = 1;
(plus some other manipulative code)

$_SESSION["cart"] = $lc;

Is there a better way to do this? I can't seem to figure out a proper
way to include the array index inside the same line as $_SESSION (such
as $_SESSION["cart($item)"].

$_SESSION Array
A small problem that has me kinda baffled. This is the situation:

I've set up a self-submitting form FORM.PHP. Once the inputs are
validated, the info gets put in SESSION variables and the script
redirects the user to a review form REVIEW.PHP which displays the info
the user has input and allows them to edit or submit. At the top of
that page, I have the following code:

--- start code ---

foreach ($_SESSION as $key=>$submission) {
if ( empty($submission) || ($submission == "") || (strlen($submission)
== 0) ) {
$DISPLAY[$key] = "&laquo; BLANK &raquo;";
}
else {
$DISPLAY[$key] = $submission;
}
}

extract($DISPLAY);

--- end code ---

The form then displays the info now extracted from the $DISPLAY array.

By creating a new array $DISPLAY for the $_SESSION variables, the idea
is that this page will indicate the optional fields where the user
didn't input data with the string, "BLANK", without changing data in
the $_SESSION array. At the bottom, there is an edit button which will
take a user back to the original form where the form will be
repopulated with the $_SESSION data.

The problem I'm having is that the blank $_SESSION variables are being
overwritten with the "BLANK" string that's only meant to appear in the
review form. Not a huge problem, but I can't figure out why it is
happening.

Any ideas? I've scoured my code. There's nothing that deliberately
overwrites info in the $_SESSION array on the review page. All I can
figure is it must have something to do with the way FOREACH operates.

PHP $_SESSION Expiring In IE 6/*
comp.lang.php,

I have recently launched the new Planet-Tolkien.com, one would think
that writing a message board from scratch and a dynamic weather
system, a simple session login would be the least of my problems
right? Wrong.

It would appear that for Mozilla and Opera keep a $_SESSION is not an
issue and the $_SESSION is continued until the member logs out.
However when members are using Internet Explorer browser (most
versions it seems), they can go around the site for varied amounts of
time, usually less than five minutes and then their $_SESSION will
expire!?

I cannot for the life of me figure out why a server side $_SESSION
would expire on IE but not for MOZ or Opera but it is, and I need to
figure out why and how can I fix this.

REF. All login information is saved as such:

session_save_path("$path/sessions");
session_start(); $_SESSION['session_memberID']=$session_memberID;
$_SESSION['session_username']=$session_username;
$_SESSION['session_groupID']=$membergroup;

How Do I Set A $_SESSION Variable
This is page is called to delete a row on a table using form input. I
set a session variable based on the result of mysql_query and want to
pass it back to the caller like this.

if (mysql_query($deleteSQL,$emailmanager) &&
mysql_affected_rows()>0) {
$_SESSION["mysql_query_result"] = "Your email address has been
successfully removed";
}else {
$_SESSION["mysql_query_result"] = "Your email address was not
found. Please try again";
}

.....

Here is the return code (generated by Dreamweaver) -

header(sprintf("Location: %s", "http://".$_SERVER['HTTP_HOST'].
$deleteGoTo));

How do I return the session variable to the caller? The $_SESSION
array does not exist on return to the caller. I check it using this
print code -

while ($var = each($_SESSION)) {
printf ("Session key <b>%s</bhas the value of: <b>%s</b><br>",
$var['key'], $var['value']);
}

$_SESSION Question:
Is there a maximum amount of variables you can stack into a session array?

I have this:

$_SESSION['count'] = $first;
$_SESSION['blah'] = $first;

echo $_SESSION['blah']."--";
echo $_SESSION['count'];

the result is always the same, $_SESSION['count'] = $first; seems to take but the second does not.. I do have several other session values.. just wondering if I reched my limit??  I have tried everything I could think of but no go.

_SESSION And Form
I am in the progress of creating a script to upload images with, but I have now come to a problem while wanting to add some data to the database.

The form start looks like this:
<form action='upload.php' method='post' enctype='multipart/form-data'>

When I am uploading pictures from gallery.php it is supposed to check if the user has the level required to upload images. So when it sends the data to upload.php it should make a mysql query to check whether the level is high enough or not. The problem, now, is that when you log in your user id is stored in $_SESSION["uid"] which is used in the mysql query, but it does not receive the uid on upload.php. Is there any way in which I can make upload.php receive the $_SESSION["uid"]? In a secure way, not being by inserting the uid in a $_POST or in the link.

I have made a session_start(); in upload.php and required the functions.php (which created the $_SESSION["uid"]) file in upload.php also. None of it makes upload.php get the $_SESSION["uid"].

$_SESSION Question
how do you destroy a session when the user leaves the website, or closes the browser etc

$_SESSION Compatibility
does anyone have any stats on the percentage of browsers/environments that support session cookies? Reason I ask is that I might have come up with a spellbinding anti-form-spam solution.

How Secure Is $_SESSION['id']
i am creating i am basing alot of things around a session id, for example when a customer logs in they are assigned a session id, and on the pages of the website they have many if statements, for example

if($_SESSION['cust'] != ''){

echo "Previous orders<br>Current Orders<br>Logout<br>";

}else{

echo "Login";}

But i was wondering if it is possible to somehow obtain this session id without actually logging in .

Unset $_SESSION Set Anyway?
On first pageview $_SESSION['allowed'] is set and  $_SESSION['disallowed'] is not. Why? This should only happen upon successfull log-in.

The code appears a bit long, but it's mostly just a log-in routine with various checks. When "allowed" is set, sections should be accessible from links in the menu. Code:

Isset($_SESSION)
i'm modifying a script which handles a member area but i can't get the utility of a couple of lines and the php manual is not enought clear for me on the matter. Basically after a user login (which username and password), the script start a session and store and pass the value of the username: Code:

$_POST And $_SESSION Back And Forth
I was fighting a bad case of session persistence
and found a solution but need to be reassured about is reliability
$dir=$_SESSION['dir']; //echo"dir.$dir.<br>";
if
($_SESSION['dir']=="")
{
$dir=$_POST['dir'];
$_SESSION['dir']=$dir;
$dir=$_SESSION['dir']; //echo"dir2.$dir.<br>";
}
else
{
$dir=$_SESSION['dir']; //echo"dir3.$dir.<br>";
}

forgot stating that the problem was when the original file passed a POST value to other files and then going back to that original file from other locations.

Using $_SESSION Variable For Different .php Files
Hi all, still working on getting my page authorization to work for logged-in users:

login.php
// if successful user login
$_SESSION['authenticate'] = 1;
if (isset($_SESSION['authenticate'])) {
echo "<br>session variable is set and has the value:".$_SESSION['authenticate'];
}
echo "<script language="JavaScript">document.location.href='"."http://www.exammple/quiz.php"."'</script>";

This works correctly and prints the session variable has been set to one, then goes to quiz.php

quiz.php
<?php
SESSION_START(); // tried with this line of code, and also ommiting it
if (isset($_SESSION['authenticate'])) {
echo "<br>session variable is set and has the value:".$_SESSION['authenticate'];
}
if (isset($_SESSION['authenticate'])) {
// display some html
}
else
{
echo "<script language="JavaScript">document.location.href='"."http://www.exammple/quiz.php"."'</script>";
}
?>

This does not print that the session variable has value 1. Am I calling/linking this properly, why does session variable loose its value...

$_SESSION =$_POST Easier Way?
I have a form that passes a lot of verriables with the $_POST method.

at the top I then grab them and give them over to my $_SESSION with a line like

$_SESSION['fname']=$_POST['fname'];

Having so many of these just seems silly. can I do this in a loop that would just do something like

$_SESSION['$x']=$_POST['$x'];

then just cycle the entire $_POST[]?

Private Var = $_SESSION['var'];
Any idea why this fails in a class declaration?...

Legal PHP? $_SESSION = New Class;
For various reasons I would like $_SESSION to contain a class. The main reason is I want to do

$someblah = &$_SESSION->blah

$someblat = &$_SESSION->blat

I was thinking of doing this with the following code PHP Code:

Information Regarding $_Session And Extract
I am new to PHP. I would need some information on the following:

1. a) I wanted to know from where the data is extracted and stroed in
the global assocoative
arrays ( specifically what will be the contents of $_Session ?)
b) Is there any way by which i can get to know all the keys of the
arrays ( specifically what
are the Keys of $_Session ?)
extract($_GET);
extract($_POST);
extract($_COOKIE);
extract($_SERVER);
#extract($_SESSION);

Losing $_SESSION Data
I just upgraded to PHP 4.3.3 tonight with easyphp 1.7, and now I've got several problems, don't know really why.

I don't think this is related to register globals being set to OFF, as I had already turned them off in my previous version. mayve it comes from something else, but right now this bug is reall driving me crazy. i've got a login when the user logs, got something like that: file login.php PHP Code:

$_SESSION Comes Empty On Next Page
I am not able to find the solution to this problem :(.
I have two php pages . On the first page i am getting some values in
$_SESSION when i use print_r function. I don't get the values when i
use just echo() or print() functions.
Now, the first page calls the second php page. But when i try to get
the values for $_SESSION on the second page i get empty values even
when i use print_r() function.
register.globals is set to on in php.ini. I am also using
start_session() on these pages but to no effect.

CURL And $_SESSION Problem
What is the most standardized method of utilizing the CURL functions
in PHP (version 4.3.2) to be able to retrieve the contents of a remote
URL that happens to be dependent upon $_SESSION for its content
display?

I've tried the following class methods for display and I have most
everything working until I get to a URL that requires $_SESSION:

Code: ( php )

How Do You Acceess $_SESSION From Within CLI PHP Script?
Is it possible to access values preset from $_SESSION from within a CLI
PHP page? If so, how is it done? Each time I try to access $_SESSION
is an empty array; the moment I leave the CLI PHP and return to my
calling web-app PHP script, $_SESSION is back again, values and all,
completely untouched.

Can $_SESSION be called? If not, then I have a bigger problem inasmuch
as $_REQUEST variables set via form/query-string MUST be accessed from
within CLI PHP script, and the only way I can think of is to put all of
$_REQUEST into $_SESSION, or what else do I do? Stumped.

Numeric Indexes In $_SESSION ?
I used to believe I fully understood sessions... Apparently PHP does not
handles numeric indexes in $_SESSION, as far as I can see. The same yields
for both PHP 4 and 5. Suggestions or explanations to the following? I
thought $_SESSION was a super global array, but arrays would for sure allow
for numeric indices, right?

As an example, this works:

$id = "number" . 3;
$_SESSSION[$id]++;
$id = "number" . 5;
$_SESSSION[$id]++;
print_r($_SESSION); //as expected, two elements occur on screen

If the variable does not exist, it is set to 1, else it is increased (some
code is cut away)
This does, strangely, not work:

$id = 3;
$_SESSSION[$id]++;
$id = 5;
$_SESSSION[$id]++;
print_r($_SESSION); //not as expected, only last element, and this will
always be 1.

Access To The $_SESSION Variable
I got a problem to access the $_SESSION variable in my script.

I wrote some login code: if the user logs in with his name and password
a user object is stored in the $_SESSION variable.

This all works fine , i can correctly read from that variable later on.

I have an old version of my site under a domain name and the new site
under another
domain name.
I wanted to link the domain name of the old site to the new one, but i
ain't got the data of that domain name (user name and password) so i
can't directly link it to the new site.

The 2 versions of the sites are also on different webspaces.

So i created a new index page on the old site. This page has a simple
frame in it wich loads the index of the new site, so far no problem,
but when i try to login it seems as if the $_SESSION variable is never
used.

Is this possible, and does anyone have an explication for this or a
solution?

$_SESSION Not Passing To Next Form
I am using and setting: PHP Code:

Newbie Question: $_SESSION
i have done a lot of development using JSP, so i am used to being able
just to say session.put("whatever") and get it back on any page by
calling session.get("whatever"). i'm not seeming to grasp how the
session works in php.

(php version is 4.1)

i am trying

session_start();
$_SESSION['foo']="someValue";

and then on another page i try to retreive

session_start();//should resume existing session, no??
$foo=$_SESSION['foo'] ;

but $foo ends up having no value.

i am not passing any session id, but i thought that you didn't have to
if the browser is accepting cookies. something i noticed-- i have my
browser set always to alert me before accepting a cookie, and the page
i am working on is not generating any alert, therefore, it is not even
TRYING to set a client cookie. why?

unrelated question, is there no way to "declare" variables so that
they are checked at compile time? e.g., if i write
$foo=1;
$bar=$fooo+3;

i am accidentally creating a new variable called $fooo on the second
line through a misspelling, instead of using the variable i already
stored a value in. is there any way to avoid this, like in JSP?

CURL Ignores $_SESSION?
I have a security mechanism that checks that session variables are set,
and if not, redirects. It seems, however, that CURL just ignores this
statement and completely breaches my security.

Does anyone have any ideas how to avoid this?

$_SESSION / $HTTP_SESSION_VARS Behaviour
I've been trying to integrate some PHP pages of my own with some
existing code. The details of this are for the support forums for that
code (where I have been asking questions), but I wonder if someone here
can enlighten me as to why the problematic code is having the effect it is.

For reasons I don't know, if the PHP version is 5 or greater,
register_long_arrays is false and $_SESSION exists, the following
statement is executed:

$HTTP_SESSION_VARS = $_SESSION;

This line is stopping any subsequent changes to the $_SESSION variable
from being stored in the session file on the server - changes can be
made, but are all lost at the end of the page processing and the value
reverts to whatever it was before the script was executed.

Is this behaviour by design? Why does it happen? Is there a standard
reason why anyone would include a statement like this (security?)?

I'm seeing this behaviour on PHP 5.1.3 / Win 2003 sp1 / IIS 6 and on PHP
5.1.6 / Win XP sp2 / Apache 2.

$_SESSION Variable Not Carrying
I am trying to do some simple session stuff. However it does not seem
as though the session variable is being created for my site. I am
running the latest version of PHP and apache that I installed as part
of WAMP. Machine is XP SP2.

Basically I am trying to do something simple such as:

<?php

// initialize a session
session_start();

// increment a session counter
$_SESSION['counter']++;

// print value
echo "You have viewed this page " . $_SESSION['counter'] . " times";

?>

However my counter does not increment. I can also not see where any
sort of cookie has been created within IE, although firefox shows the
following:

Name: PHPSESSID
Content: 4s0n98f1s7jea6kg11psi4ckd3
Host: 10.0.0.15
Path: /
Send for: Any type of connection
Expires: at end of session

I am not sure about the Path: variable though. The address for my site
is 10.0.0.15/recipe

physical is C:wampwww
ecipe

Here are some of the contents of my php.ini file:

[Session]
session.save_handler = files

session.save_path = "C:Windows emp "

session.use_cookies = 1

session.name = PHPSESSID

session.auto_start = 0

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =

$_SESSION['data'] Not Being Deleted?
I got a login script that basically does that: checks wether username and password is in a mysql file and then sets the variable loged_in to 1 like that PHP Code:

Between Session-register And $_SESSION
http://www.php.net/session_register that using
$_SESSION[var]=value is better than using session_register... is it true in
all cases?

$_SESSION Not Sent Across Multiple Pages....
I am using the following:
Apache version 1.3.37 (Unix)
PHP version 4.4.4
MySQL version 4.1.22-standard

I have a page which sets a few $_SESSION variables as such:
$_SESSION['username'] = Bobby;
$_SESSION['authentic'] = 1;

I didn't use session_start(); at the beginning of this page because from what I read elsewhere there is no need to when using $_SESSION[](only when using session_register()). Now, when I click a link and go to a new page (same domain and same window) none of the $_SESSION variables are read. I just get empty when I echo $_SESSION['username'].


Copyright © 2005-08 www.BigResource.com, All rights reserved