 |
HTML Help Please Search for the answer to your question before asking it! Thanks.
|
| View previous topic :: View next topic |
| Author |
Message |
openxmod
Joined: 19 Sep 2008
Posts: 1
|
| Posted: Fri Sep 19, 2008 4:19 am How to create session in PHP? |
|
|
i want to create session in php site?
how do to it? |
|
|
Daler
Joined: 23 May 2008
Posts: 53
|
| Posted: Fri Sep 19, 2008 7:11 am |
|
|
Create your session with (edit where applicable):
Code:
session_save_path("/home/users/web/b786/d5.anythingweb/phpsessions");
session_start();
Define session parimeters afterwards.
And then define your session:
Code:
$_SESSION['*please change*'] = *please change*);
I'm not 100% certain that's right, I took it from a CAPTCHA script that I made using a tutorial, so you could give it a go, see if it works. |
|
|
Newbie101
Joined: 09 Oct 2008
Posts: 35
|
| Posted: Thu Oct 16, 2008 8:37 am I created in depth explanation |
|
|
I'm a newbie, and find the world of Sessions confusing. Or I did....
In my thread "pass 1 value 2" I used Sessions as my easiest answer, and have simple working code for what works.
It is important to put
Code: <?php
session_start();
?>
at the beginning of your page. Also the page needs to be a .php page. I think any newbies who are looking for this answer could find it on my thread. |
|
|
amitpatekar
Joined: 23 Oct 2008
Posts: 3
|
| Posted: Thu Oct 23, 2008 11:05 pm Re: I created in depth explanation |
|
|
Hi, All,
Sessions are wonder full feature of php and its inbuilt.
One can just write Code: session_start(); and the session will start. Session are stored on server side. HTTP protocol is state less protocol so, we need to use session to keep track which user is doing what.
Unique Session ID is assigned to each user who has logged in to the website and session start is executed.
One this should be keep in mind that the session_start(); should be the first line in the php file.
See Tutorials on Website Development.
You can register a variable in session using following code Code: $_SESSION['variable_name']="some value"
For more tutorials on php sessions visit WebWorldGuru.com[/url] |
|
|
npsari
Joined: 27 Oct 2008
Posts: 3
|
| Posted: Wed Nov 05, 2008 4:44 am |
|
|
I use sessions in one of my sites
I simply included a session in the top menu, so that it stays in all pages
Code: <?php
session_start();
?>
It has to be the start before you put <HTML> tags |
|
|
| |
|
|
|
Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group
|