

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Web Development Website design and programming, content development. It's all here. |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
![]() ![]() Deviant Join Date: Aug 2006
Posts: 44
![]() |
![]() I do not understand this script, please explain the following if possible: 1. Set exdate's date to be the value exdate already pocessed, plus expire days. Is this correct? Where is expiredays defined? (Yes, I see the (expiredays==null) thing in there, is that it?) 2. What does this do? What does escape do? 3.If the webpage's cookie's length is greater than 0. Is this correct? 4.What does this do? I've never seen IndexOf before. Why is the (C_name + "=") thrown in? 5.If c_start is not equal to 1. Is this correct? Where is C_start defined? 6. c_start equals whatever value it already has, plus the length of C_name +1. Is this correct? 7.What does this do? 8. Isn't this defined twice? 9.What does this do? What is unescape? 10. Return what? Nothing? 11. The variable username equals the function getCookie(). Is the parameter the string "username" or the variable username again? 12. What does this do? |
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
![]() |
|
|
#4 (permalink) | ||||||||||||
|
Senior Member
Gold Member ![]() Evangelist |
Ok, I have some research to do for a paper so I'm answering all these questions to distract me =p. But I'd take SCM's and KDS's advice, use PHP for cookie handling. Not only is it easier, but it's more secure also.
Quote:
This is basically defining a function with those 3 parameters, a user will call it using something like "setCookie('somename','poop',20)". This will set c_name, value, and expiredays to those values accordingly. Quote:
Cookies need to be in some format like "cookieName=cookieValue;cookieName2=cookieValue2.. ..etc" The first line of code you asked about defines the cookie to be something like c_name=valueThatIsEscaped;expires=somegaydate Quote:
Quote:
For example: var string="poopy"; stuff = string.indexOf("y"); This will return 4, because the letter y first occurs as the 4th letter of the string. Quote:
This line basically means if the cookie was found, then continue. Quote:
Quote:
Quote:
something=1; < this line sets something equal to 1. and something==1; < this line checks if something is equal to 1. Quote:
Substr basically "cuts" out everything between c_start and c_end. This is the actual value of the cookie. This line returns that new value. So if the user calls asdf = getCookie("poop") asdf will now be equal to that value that the cookie holds. Quote:
Quote:
Quote:
Hope that helps. You didn't actually need to know all of that to set/get cookies. You really only had to know how to call the function that they provided you (the last part is just an example). The actual functions may seem confusing, but most of this stuff is just string manipulation (just searching through strings and cutting stuff out). |
||||||||||||
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#8 (permalink) |
|
Loading javascript...
Senior Member
Moderator ![]() Inquisitor |
There are a lot of differences between PHP and javascript that they are barely comparable. Yeah, sure, they are both interpreted languages and they both have C style programming, but their purposes are completely different.
|
|
|
|
![]() |
![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
| All times are GMT. The time now is 12:13 AM. |

