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

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 August 30th, 2002, 07:37 AM
alsaffar alsaffar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 58 alsaffar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Using Sessions

Hi there,

When I'm using cookies, I just set the cookie to any information I want:

<?

$loginUserName = $HTTP_POST_VARS[loginUserName];
setcookie ("CkUserName", $loginUserName, time()+14400, "/", ".myDomain.com",0);

?>

then if I want to retrieve that cookie, I just call it:

<?

$CkUserName = $HTTP_COOKIE_VARS["CkUserName"];
echo "$CkUserName";

?>

This is just Great, but if I want to use sessions, cause so many programmers advice me to use sessions instead of cookies, so:

Q. How can I convert the above 2 scripts, to use sessions instead of cookies? because I searched the php manual and I couldn't find the way.

Reply With Quote
  #2  
Old September 13th, 2002, 08:20 PM
raulkgongora raulkgongora is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: La Paz, La Paz, Bolivia
Posts: 5 raulkgongora User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to raulkgongora
RE: Using Sessions

If you want to change the way you have been programming using cookies you could use the following instructions:
script one:
<?php
$loginUserName = $HTTP_POST_VARS[loginUserName];
session_start();
$CkUserName=$loginUserName;
session_register("CkUserName")
?>
script two:
<?php
session_start();
//shows the value stored
echo $CkUserName;
?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Using Sessions


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