/    Sign up×
Community /Pin to ProfileBookmark

how to read cookies

I have this php script that set a cookie

naam
nameofperson
[url]www.vakantiehuizengids.com/[/url]
1024
1774618752
29581538
2354136048
29581537
*
telefoon
03587687686+%28avond%29
[url]www.vakantiehuizengids.com/[/url]
1024
1774618752
29581538
2354136048
29581537
*

etc….

now i want to show the variables into a page

like this

name = nameofperson
telefoon = 035907709+%28avond%29

etc etc ….
is there someone who can tell me how to do that

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliAug 12.2003 — you can access a cookie in php using something along these lines.

echo "$HTTP_COOKIE_VARS[cookiename]";

where cookie name is the name that you used when you set the cookie.
Copy linkTweet thisAlerts:
@derksjauthorAug 12.2003 — sorry

but i have to read the cookie with javascript
Copy linkTweet thisAlerts:
@Khalid_AliAug 12.2003 — for tht take a look at he lin below.its the most basic solution to read and write cookies with JavaScript.

http://68.145.35.86/skills/javascripts/SimpleLoginCookieScript.html
Copy linkTweet thisAlerts:
@derksjauthorAug 12.2003 — so i use this function

function getCookie (CookieName) {

var cname = CookieName + "=";

var i = 0;

while (i < document.cookie.length) {

var j = i + cname.length;

if (document.cookie.substring(i, j) == cname){

var leng = document.cookie.indexOf (";", j);

if (leng == -1) {

leng = document.cookie.length;

}

return (unescape(document.cookie.substring(j, leng))).split("`");

}

i = document.cookie.indexOf(" ", i) + 1;

if (i == 0) break;

}

}

what should i code to schow my variables
Copy linkTweet thisAlerts:
@FangAug 12.2003 — [B]derksj[/B] don't give real data; I know the persons name and address!
×

Success!

Help @derksj spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...