The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Other
> Development Articles
|
Page 4 -
Couch Sessions
Page 4 - Discuss Couch Sessions in the Development Articles forum on Dev Shed. Couch Sessions Development Articles forum discussing articles and tutorials located at http://www.devshed.com. See what our authors have created for your viewing pleasure.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 16th, 2001, 01:16 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|

January 26th, 2002, 05:38 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Sessions with mulitple pages
That's the beauty of sessions. The customers browser keeps track of the session for you.(sort-of)
All you have to do is put session_start on each page and then use your variables. Each customer(browser) will have their own session and variables.
To see this in action, just create some sample session pages. Use session_id() to print out the id #'s.
Now, open the page up in two different browsers on your machine. Both have different session id's, but the id stays the same until you close the browser(or it times out)
Brian
|

January 26th, 2002, 05:41 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Problem with the time elapse example
Well, not sure if it's a problem, or I just don't understand.
My question/problem: When refreshing the browser, it resets the session. I get a new session id and the script doesn't ever tell the time.
I put a link on the page to itself, click on that, and it works as intended(doesn't reset the session)
Is this how it's supposed to work? Or is there some setting in the configuration that changes how this works?
thx
Brian
|

May 17th, 2002, 12:40 PM
|
|
Junior Member
|
|
Join Date: May 2002
Location: Aberdeen, UK
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Re: Cannot send session cache limiter
Adam - this http://www.faqts.com/knowledge_base/view.phtml/aid/13713/fid/51
worked for me - I went to the enf of the file, hit backspace until I reached the > and the problem ... ermmm ..went away.
|

September 15th, 2002, 10:18 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: cookie
Which might be said plainer, too.
If you have initialized a session using 'session_start()' you also can use 'session_id()'.::
<?php
// start the session
session_start();
echo "<a href=\"nextpage.php?PHPSESSID=" . session_id() . "\">Click for next page</a>";
?>
There is an important security breach to consider: even if you carefully do not add the session id to external links, the session id will be visible in the referer.
|

September 15th, 2002, 10:28 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: cookie
Okay, sorry, that sucked. The "structured text" is obviously *not* implemented completely here...
The example from above which was gorked was (replace [] with < or >):
[?php
// open session
session_start();
// create GET session id variable
$mysessionid = "PHPSESSID=" . session_id();
// give an example of use
echo "[a href=\"nextpage.php?" . $mysessionid . "\"]Click for next page[/a]"
?]
|

October 15th, 2002, 08:25 PM
|
|
php n00b
|
|
Join Date: Oct 2002
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
problem with first code
the first cde on the tutorials doesnt work.
<?php
// initialize a session
session_start();
// register a session variable
session_register('counter');
// increment and display the value of the counter
$counter++;
echo("You have visited this page $counter times! Don't you have anything else to do, you bum?!");
?>
i get this error :
Notice: Undefined variable: counter in c:\program files\apache group\apache\htdocs\counter.php on line 10
You have visited this page 1 times! Don't you have anything else to do, you bum?!
and the counter doesnt go beyond 1.
|

October 23rd, 2002, 03:20 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Cannot send session cache limiter
Give U two Exmaple!One is right,other is error!
This is an error
****************************
<html>
<head><title>this is a error exm!</title>
</head>
<body>
<?php
session_start();
session_register("test")
........................
?>
</body></html>
*************************************
this right
======================================
<?php
session_start();
session_register("test")
........................
?>
<html>
<head><title>this is a error exm!</title>
</head>
<body>
<?php
.................
?>
</body></html>
========================================
understand?Please email to me,if U want!
|

October 23rd, 2002, 03:22 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Cannot send session cache limiter
Give U two Exmaple!One is right,other is error!
This is an error
****************************
<pre>
<html>
<head><title>this is a error exm!</title>
</head>
<body>
<?php
session_start();
session_register("test")
........................
?>
</body></html></pre>
*************************************
this right
======================================
<pre>
<?php
session_start();
session_register("test")
........................
?>
<html>
<head><title>this is a error exm!</title>
</head>
<body>
<?php
.................
?>
</body></html></pre>
========================================
understand?Please email to me,if U want!
|

October 23rd, 2002, 03:26 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Cannot send session cache limiter
Give U two Exmaple!One is right,other is error!
<p>This is an error <br>
****************************<br>
<pre><br>
<html><br>
<head><title>this is a error exm!</title><br>
</head><br>
<body><br>
<?php<br>
session_start();<br>
session_register("test")<br>
........................<br>
?><br>
</body></html></pre><br>
*************************************</p>
<p>this right<br>
======================================<br>
<pre><br>
<?php<br>
session_start();<br>
session_register("test")<br>
........................<br>
?><br>
<html><br>
<head><title>this is a error exm!</title><br>
</head><br>
<body><br>
<?php<br>
.................<br>
?><br>
</body></html></pre><br>
========================================</p>
<p>understand?Please email to me,if U want!</p>
|

October 31st, 2002, 04:41 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Good!
Thanks for intoduction!
It's funny :)
|

April 20th, 2003, 01:08 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Re: Cannot send session cache limiter
At the begining i thought that you were joking. After 10-20 differnt ways that i tried and nothing, i finaly decided to do what you recomented. IT WORKS!!!!!!!!!!!!!!!!!!!!!No more cache limiter just with a few backspaces! THX
|

May 27th, 2003, 03:18 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Couch Sessions
Couch Sessions
May 02, 2000 - Need to build an online shopping cart in a hurry? This article takes a look at session management, an important component of transaction-based Web sites, and explains the fundamentals of adding session support to your site. Examples in PHP4 and PHP3 with PHPLib.
Please discuss this article in this thread. You can read the article here .
|

May 28th, 2003, 09:05 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
If you would like to see an article covering a particular topic, please post your request here.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|