Greeting everyone

I wonder if anyone here could help me how to set cookie on my site
I have search for how to set cookie but the problem is that i want to use like this:

setcookie("user", "{membername}", time()+3600); This is just an example i found on google.

I have try just to put membername or something, but then membername is just the value.

I want the membername to be the vaule, so if i log in as Jack, the value of the cookie will be Jack. All the membername are stored in a database.


Also im trying to change one of my postback files.
So if a site call back to mine site, and give a positive call, it will get my cookie also in the call back.


Example.

I logging in as Jackie

www.google.com/postback.php?accsess=good

is the calling to my postback file.


It will collect the accsess as good or bad.

If accsess = good

then it will request a username to give accsess for a reward


and then it will try to collect the user from the cookie (Value = Jackie)

Then Jakie would get the access from a database

So anyone know how to do this?


Thanks and hope someone answer back,
Also sorry for my bad English ;)

Member Avatar for diafol
if(isset($_GET['accsess']) && $_GET['accsess'] == 'good'){
  setcookie("user", $membername, time()+3600);
}

HOWEVER - this implementation looks rather dubious. What's stopping any user just typing '.../postback.php?accsess=good' into the address bar?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.