PDA

Click to See Complete Forum and Search --> : Is it possible to use page_open() and close()?


wordracr
Jun 9th, 2002, 07:44 PM
When I try to use these to create a session, I get a message saying that there was a called to an undefined function.

All I know about my web host is that they use PHP 4.1

Is there a way so I can use these functions? Or.. is there another way to have cookieless sessions?

Thanks a lot!! :p

chrisjk
Jun 9th, 2002, 07:54 PM
urrmm, probably because those functions don't exist

shouldn't they be session_start() and session_destroy()?

The Hobo
Jun 9th, 2002, 07:55 PM
Originally posted by wordracr
When I try to use these to create a session, I get a message saying that there was a called to an undefined function.


That's because they aren't functions. Look up Session Functions in the manual.

wordracr
Jun 9th, 2002, 08:02 PM
thanks for the responses. I assumed they were functions because it sounded like it. I got this text from another website: "As in PHP4, you need to call a predefined page_open() function each time you initiate a session. " The page doesn't mention anything about creating the function.
Click to see the page.. (http://www.devshed.com/Server_Side/PHP/Sessions/page5.html)

So, anyway, what way would I create a session that doesn't use cookies on the client side? That is one of my objectives.

Thanks for all the help.

The Hobo
Jun 9th, 2002, 08:09 PM
Basic example:


<?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}

echo "You have visited this page " . $_SESSION['count'] . " times!";

?>

The Hobo
Jun 9th, 2002, 08:12 PM
As in PHP4, you need to call a predefined page_open() function each time you initiate a session. PHPLIB comes with a default session class named Example_Session - you can modify this by changing the values in the "local.inc" file - which is what we've used in the following example:


You probably need whatever PHPLIB is. That's probably where the function is.

chrisjk
Jun 9th, 2002, 08:15 PM
phplib was an add-on for PHP < 4 for sessions

Much of it's functionality was built into PHP 4+, so you don't really need it now. That page related to phplib so you shouldn't follow it

See this http://www.php.net/manual/en/ref.session.php for the built in session handling functions

cpradio
Jun 9th, 2002, 09:11 PM
If you read the following you will get all the information you need to know about sessions:

http://www.vbforums.com/showthread.php?s=&threadid=173853
http://www.vbforums.com/showthread.php?s=&threadid=175041

-Matt

wordracr
Jun 9th, 2002, 09:24 PM
Thanks for the information! I will read it all when I get time.:cool:

scoutt
Jun 10th, 2002, 11:04 AM
Originally posted by wordracr
So, anyway, what way would I create a session that doesn't use cookies on the client side? That is one of my objectives.

Thanks for all the help.
you can't. you have to have cookies enabled on the client side to use sessions. although the session is saved on the server, the browser keeps the seesion_id in cache or a cookie.

chrisjk
Jun 10th, 2002, 11:15 AM
it can go in the URL which is what it does if it can't (or you tell it not to in php.ini) use cookies

scoutt
Jun 10th, 2002, 11:22 AM
true, but on my server I don't control the ini file and I turned off cookies and it didn't go in the url. it just didn't keep any session variables. but which ever way he wanted I guess

chrisjk
Jun 10th, 2002, 11:50 AM
I noticed a bug with the parser, in that if you split the <a href.... over two lines, it won't append the session id

Also, you have to keep the paths relative otherwise it assumes it's an outside server which you wouldn't want to leak the session id to (even though it would be in the referrer anyway :rolleyes: )

Also you have to have compiled PHP with enable-trans-id or something like that.

Maybe some of those are why it didn't work for you.