FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


SESSION or Cookie which useful ?





differentone
Hello guys.
I'm sorry for my poor english ^^ Still working on it for learning.
Regards from Turkey Smile

Now im new on php language. still preparing on user management script.
but im stuck about how can i keep user sessions. Which way more useful ? $_session or $_cookie ?
I could'nt understand difference between session and cookie commands. i know just session serverside and cookie browser side. Thats right or am i wrong?

Could you explain this to me, which way is better ?
Thank you for your interest.
Best regards...
SonLight
Because web servers send each page independently, they have no memory of a user's past actions unless special provisions are made. A cookie -- a small piece of text stored by the browser, and returned to the server when requesting another page -- is the way the server normally remembers information about that user. A session is the two-way conversation that takes place between the server and the user. Sessions are not alternatives to cookies, but in fact normally use cookies to function.

The confusion may arise because you can either use cookies directly in PHP, or you can use sessions which preserve the information the server needs using cookies, but relieve you of the need to keep track of all the details.

I hope my explanation helps you to read the PHP manual with better understanding. If you have more questions, feel free to ask. Obtaining a PHP manual in your first language might help you. I think it is available in many languages.

Other possible sources of information are sites like w3schools.com.
differentone
SonLight wrote:
Because web servers send each page independently, they have no memory of a user's past actions unless special provisions are made. A cookie -- a small piece of text stored by the browser, and returned to the server when requesting another page -- is the way the server normally remembers information about that user. A session is the two-way conversation that takes place between the server and the user. Sessions are not alternatives to cookies, but in fact normally use cookies to function.

The confusion may arise because you can either use cookies directly in PHP, or you can use sessions which preserve the information the server needs using cookies, but relieve you of the need to keep track of all the details.

I hope my explanation helps you to read the PHP manual with better understanding. If you have more questions, feel free to ask. Obtaining a PHP manual in your first language might help you. I think it is available in many languages.

Other possible sources of information are sites like w3schools.com.


Thank you for your information.
my primary source of already w3schools.com. Now i understand better Smile
Today while surfing on web, i have read a few articles about frameworks and PHP editors.
i know frameworks not for beginner but editor choice really important i think for saving time and simple codes. Now i found Delphi for PHP editor. I love it good to be visual design. there is no need to write long codes. just drag and drop codes generating automatically Smile
So... should study more Smile
Best Regards
Have a nice day...
chatrack
Hi,
You can store variables in session and can be retrieved in any of your pages, as it loads. Session variables are as i understood stored in the server side. And can be accessed what ever may be the
client side browser.

If the client side browser is set not to accept cookies or store cookies after the browser window is closed, we can not store it on client side computer.

better to stick with session variables for serious data, such as log in check
ankur209
Whenever you'll create the session or store the session record for the users computer will automatically create the log(cookie) for it !
SonLight
As ankur said, session variables are stored in cookies which have to be exchanged with the client on every page load. An article which discusses this is at:

http://www.4guysfromrolla.com/webtech/092098-2.shtml

Generally there is no way to avoid using cookies if you want to remember the browsing history of your user. If you want to minimize the data stored in cookies, you can assign a different number to each visitor and store only that number in a cookie; the rest of the data is kept in a database record with that key. I don't know how that affects efficiency in general, but it can be a big improvement for the user's privacy if any personal data is kept. You might be storing information about the internal functioning of your services also that you don't want a user to be able to see in his cookies.
Related topics
cookie problems?
FireFox and Cookies/Sessions
Explain and get up to 30FRIH!
[*OUT OF BUSINESS*] Please close
My Site (In it's infancy)
easy frihs
SMF help needed!
[help] Problema de Hackeo en el server 2
problem chyba z sesja ??
WTF?!
Critical problem with my phpopenchat engine
Joomla Log-in Issue
destroy\unset sessions?
$_COOKIE and $_SESSION help needed!
Session Question
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.