473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

php session doesn't work

My scripts have been working since past 3 years. But now recently the page doesn''t work well. The page is working well under php4 in localhost but in the server side this seems to be error. on the server side our server switch over to php4 to php5 version. even the simple page is also doesn't work.

I checked whether the error in Javascript and other think so but i couldn't catch it. I have been created the simple page with Jscript. Its work nice. But without session creation the page is working. It seems the error occurs in session in my php.

This source code working under php4 version fine. But in the php5 doesn't work.


Expand|Select|Wrap|Line Numbers
  1. if(isset($_POST['submit']))  
  2.   {  
  3.  session_start(); 
  4.  $_SESSION['id'] = 'AAAA';
  5.  echo "The Session Value is = $id <br></br>";
  6.  } else { 
  7.  echo "<br> <br> Retrieve No Submitted";  
  8.  } 
  9. ?>
  10.  
  11.    <form name = "form" method  = "POST" action = "sess.php">
  12.  
  13.           <input id="submit" name="submit" type="submit" value="Session" />  
  14.     <br><br>
Dec 15 '09 #1
3 5222
Dormilich
8,658 Expert Mod 8TB
where does $id on line #5 come from? from PHP 5, security settings are made so, that you can’t access $_POST['name'] ($_GET, $_REQUEST, etc.) as $name without previous conversion.
Dec 15 '09 #2
Atli
5,058 Expert 4TB
See Using Register Globals for more info on what Dormilich is talking about.
Dec 15 '09 #3
Dormilich
8,658 Expert Mod 8TB
in general it is recommended to always access $_SESSION['id'] as such.

Expand|Select|Wrap|Line Numbers
  1. $_SESSION['id'] = "AAA";
  2. // …
  3. echo $_SESSION['id'];
it may well be that you later access your session variables in a different way by calling the index
e.g.
Expand|Select|Wrap|Line Numbers
  1. // you could for instance write a session handling class:
  2. echo $session->mySessionVarName;
Dec 15 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Peter | last post by:
L.S. I am developing a PHP-login script (on Lycos Tripod) that uses Session to pass on variables. Below is the entire (stripped) structure that I use. It opens a page where you can Set and Read...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
14
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you...
2
by: Jim Owen | last post by:
I know I';ve posted on this topic before, but it still doesn't work. I have a Session_End event in my Global.asax file, but it never fires. I have gone into my web.config file and in session...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
6
by: Bahman | last post by:
Hello! I have a simple question. Do we have session arrays that we can reference, assign, or select from? Could I please have a sample of how this is done. The obvious syntax that I am...
1
by: zzzbla | last post by:
Hello, I have a project in which I'm trying to embed one site, that uses session stored variables, inside an IFRAME in another site (which for that matter doesn't even use sessions). Problem...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.