PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 22nd, 2003, 04:20 PM
wvsurveyor wvsurveyor is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 wvsurveyor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sessions not working

Basic Info first. I am running Windows ME (don't know why just am) and I have downloaded PHPDEV423 and have also upgraded to PHP 4.3.0.

Everything on my computer seems to be working fine except sessions. I have tried a number of things and have tracked it down to sessions.

I have downloaded a couple of scripts from the web I suspect are a little old. These scripts logo a user in but they do not seem to work because of the sessions.

I have copied a test script out of a book I have and it does not work either, it looks like this:
<?
session_start();
session_register("your_name");
if(!empty($your_name))
{
echo "I already know you name, $your_name";
}
elseif(empty($your_name) && !isset($submit))
{
echo "<form name=myform method=post action=$PHP_SELF>
<input type=text name=first_name> first name<br>
<input type=test name=last_name> last name<br>
<input type=submit name=submit value=submit>
</form>";
} elseif (isset($submit) && empty($your_name))
{
$your_name = $first_name . " " . $last_name;
echo "Thank you, $your_name";
}
?>

On the first visit it should ask for your name and after hitting refresh if should say it already knows you name.

It does creat a session but the only thing it puts in the file is this:
!your_name|

I have tried globals on and off.

Has there been a change in the way sessions are handled that is making these scripts in need of a re-wright?

I have put many houre into trying to solve this problem and help would be greatly apperaciated.

Reply With Quote
  #2  
Old April 23rd, 2003, 04:10 PM
opus006 opus006 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 65 opus006 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Sessions not working

Quote:
It does creat a session but the only thing it puts in the file is this:
!your_name|


you need to move session_register("your_name");

also look at http://www.php.net/docs.php
for $_SESSION & $_POST reguardless of register_global setting

php Code:
Original - php Code
  1.  
  2. <?
  3. if(!empty($your_name))
  4. {
  5.     echo "I already know you name, $your_name";
  6. }
  7. elseif(empty($your_name) && !isset($submit))
  8. {
  9.     echo "<form name=myform method=post action=$PHP_SELF>
  10.         <input type=text name=first_name> first name<br>
  11.         <input type=test name=last_name> last name<br>
  12.         <input type=submit name=submit value=submit>
  13.         </form>";
  14. } elseif (isset($submit) && empty($your_name))
  15. {
  16. $your_name = $first_name . " " . $last_name;
  17. session_register("your_name");
  18. echo "Thank you, $your_name";
  19. }
  20. ?>

Reply With Quote
  #3  
Old April 23rd, 2003, 07:15 PM
wvsurveyor wvsurveyor is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 wvsurveyor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Sessions not working

Thank you for the reply I am starting to figure this out but the above code did not work for me either. I did however go through the sessions turtorial and that worked. What I would really like to know is why do none of the old scripts work there must be a way of configuring php to work with these old scripts. I got the script I posted out of MySQL/PHP Database Applications by Jay Breenspan and Brad Bulger and if it does not work then I need to know why so I will know if this is an old book that I need to trash or what, I just got it though so what is up?

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > Sessions not working


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway