Log in

View Full Version : how do cookies work



queerfm
07-07-2006, 04:57 PM
Just found a script that i am thinking of using for my website on twey.co.uk the code rocks.

but my question is the following how do cookies work like i understand a littel bit how they are suppost to work but lets say some one when they log in click a link to see a page call about me is there any way when they log in they get that page straight away?

i was thinking about using iframes and the include code how would these effect a cookie

Twey
07-07-2006, 05:11 PM
but my question is the following how do cookies work like i understand a littel bit how they are suppost to work but lets say some one when they log in click a link to see a page call about me is there any way when they log in they get that page straight away?Yes indeed. Cookies work by storing a text file on the user's computer. This allows you to store some data that will be accessible to every page on your server that the user visits, whether it's in a frame, a seperate page, a new window, or whatever.

In your case, you would store the intended page in a cookie, then redirect to the login page, then, after logging in, redirect to the page in the cookie.

If you have some form of server-side scripting, sessions are usually a better idea than cookies. Sessions store data about the user on the server, then use a unique session identifier (usually a 16-digit hexadecimal number) to identify the user. This number can be passed from page to page by cookie or another means, such as a GET variable. Sessions are more secure than cookies since only the session ID is stored on the client (or sent over the network).


Just found a script that i am thinking of using for my website on twey.co.uk the code rocks. Oh? Which one? They're all in the DD forums somewhere... the Fadable Objects script got rejected (too complicated) and the enhanced Encrypted Password script is awaiting approval.

queerfm
07-07-2006, 05:26 PM
i used this one enhanced Encrypted Password

also where is a good site i can learn more about cookies and you say server-side scripting, sessions how would i know if my sever has that??

i re sell server space so i have access to the whole server so where would i look or what would i look under. it is a linux server.

Thanks

Twey
07-07-2006, 05:36 PM
i re sell server space so i have access to the whole server so where would i look or what would i look under. it is a linux server.Do a "slocate php" and see.

queerfm
07-07-2006, 06:13 PM
what is slocate php and what do i do with it

Twey
07-07-2006, 07:15 PM
It's a command. You execute it. It finds files with "php" in the filename. :) If you don't have any relevant files (specifically the "php" executable or mod_php.so), you don't have PHP.

queerfm
07-08-2006, 05:34 AM
oh yes my server can have phop i have a dating site on the same severs osdate
here is there website www.tufat.com/osdate.php

Twey
07-08-2006, 01:46 PM
Well, if you've got PHP you can use it to write server-side scripts. There's an official PHP introductory tutorial here (http://uk.php.net/tut.php), or a one by w3schools here (http://www.w3schools.com/php/).

queerfm
07-08-2006, 05:57 PM
ok well i don't understand any of that i mean the other website they are writen if i am already suppost to know what they do... sorry i just don't understand i have never made a php page in my life and if html or xml will do then why learn something i will hardly use? i just need to know if a cookie will work for what i want to do and how many cookies would i need to make so that they all work

Sorry

Twey
07-08-2006, 06:58 PM
i have never made a php page in my life and if html or xml will do then why learn something i will hardly use?Oh, you'll use it a lot, if you get used to it :)
i just need to know if a cookie will work for what i want to do and how many cookies would i need to make so that they all workYes, and one. However, Javascript is not a hugely reliable way to set a cookie, and since you'll be using a server-side script anyway (for the login script), I'd suggest modifying that to do what you want rather than using client-side scripts.