View Full Version: Cookies

CheatSync.net Forums > Computers + Tech > Cookies



Title: Cookies
Description: What do i need..


Li'l Freak - December 8, 2007 10:07 PM (GMT)
I would like to set up a cookie system.

What i want/need to know is how... lol.

Heres what i want.

I have the site with a song that autoplays.
But i will have a link that stops the song and sends a cookie which has a value.
The value saying in the long run don't play the song.

I just need to know what do i need to send the cookie. What do i need to have my site check for the cookie.

I have total access to the system. So any programs that may need to run is possible.

emcp - December 9, 2007 01:07 AM (GMT)
QUOTE (Li'l Freak @ Dec 8 2007, 10:07 PM)
I would like to set up a cookie system.

What i want/need to know is how... lol.

Heres what i want.

I have the site with a song that autoplays.
But i will have a link that stops the song and sends a cookie which has a value.
The value saying in the long run don't play the song.

I just need to know what do i need to send the cookie. What do i need to have my site check for the cookie.

I have total access to the system. So any programs that may need to run is possible.

php or js

in php its pretty simple and would recommend it because all you have to do is check for the cookie and if the cookie exists or whatever just make it echo the code which plays your music

http://www.w3schools.com/php/php_cookies.asp

Li'l Freak - December 9, 2007 03:48 AM (GMT)
Thanks cool.

Now thats cool but um.. How exactly would i go by setting this up?

emcp - December 9, 2007 01:52 PM (GMT)
show us the code for playing

Li'l Freak - December 9, 2007 08:11 PM (GMT)
QUOTE (emcp @ Dec 9 2007, 01:52 PM)
show us the code for playing

well it would just be

<EMBED SRC="Glow.mp3" HIDDEN="true" AUTOSTART="true" STARTTIME="00:00">

I'm not sure exactly how to set the whole retrive cookie

if cookie
don't play

Else play.


...... ... help lol.

Li'l Freak - December 12, 2007 06:42 AM (GMT)
Anyone? hello? man this place needs more attention..

I'm not going with a background music anymore.

But i still would like to know how to put these cookies to good use..

The tut you gave me is .. well OK but it doesn't really teach you how to use the info from the cookie once it's receive..


Waterbottle - December 12, 2007 04:24 PM (GMT)
QUOTE (Li'l Freak @ Dec 12 2007, 08:42 AM)
Anyone? hello? man this place needs more attention..

I'm not going with a background music anymore.

But i still would like to know how to put these cookies to good use..

The tut you gave me is .. well OK but it doesn't really teach you how to use the info from the cookie once it's receive..

It tells you how to use cookies, with some common sense and a basic knowledge of PHP you shouldn't have any trouble using it.

I suppose I could post an example (untested).
CODE

$musicon = 0;
// If the cookie already exists
if(isset($_COOKIE['playMusic']))
{
  $musicon = intval( $_COOKIE['playMusic'] );
}
else
{
  // if it doesn't create it, storing the value one to represent that you will play music
  setcookie("playMusic", 1, time()+360000);
  $musicon = 1;
}
if( $musicon == 1 )
{
  //play music code here
}

Li'l Freak - December 12, 2007 10:54 PM (GMT)
QUOTE (Waterbottle @ Dec 12 2007, 04:24 PM)
QUOTE (Li'l Freak @ Dec 12 2007, 08:42 AM)
Anyone? hello? man this place needs more attention..

I'm not going with a background music anymore.

But i still would like to know how to put these cookies to good use..

The tut you gave me is .. well OK but it doesn't really teach you how to use the info from the cookie once it's receive..

It tells you how to use cookies, with some common sense and a basic knowledge of PHP you shouldn't have any trouble using it.

I suppose I could post an example (untested).
CODE

$musicon = 0;
// If the cookie already exists
if(isset($_COOKIE['playMusic']))
{
  $musicon = intval( $_COOKIE['playMusic'] );
}
else
{
  // if it doesn't create it, storing the value one to represent that you will play music
  setcookie("playMusic", 1, time()+360000);
  $musicon = 1;
}
if( $musicon == 1 )
{
  //play music code here
}

well i have the common sense... just not the php knowledge.


Thanks cool.

But how would you Make it so the music stops if there is a cookie.

I would also have to make it.



CODE
$musicon = 0;
// If the cookie already exists
if(isset($_COOKIE['stopMusic']))
{
 $musicon = intval( $_COOKIE['stopMusic'] );
}
else
{
 // if it doesn't create it, storing the value one to represent that you will play music
 setcookie("stopMusic", 1, time()+360000);
 $musicon = 1;
}
if( $musicon == 1 )
{
 //stop music code here
}
else
{
// play music code here
}


I think..

I'm not totally sure but anyway. I think that would work.

I want the code to seach for the cookie when the page (index) has been open.

But if they click a link (stop) on the index page they cookie sets to 1, equaling stop.

chad1416 - December 13, 2007 02:39 AM (GMT)
i know how to make one in flash if that'll help?

Waterbottle - December 13, 2007 03:30 PM (GMT)
QUOTE (Li'l Freak @ Dec 13 2007, 12:54 AM)
QUOTE (Waterbottle @ Dec 12 2007, 04:24 PM)
QUOTE (Li'l Freak @ Dec 12 2007, 08:42 AM)
Anyone? hello? man this place needs more attention..

I'm not going with a background music anymore.

But i still would like to know how to put these cookies to good use..

The tut you gave me is .. well OK but it doesn't really teach you how to use the info from the cookie once it's receive..

It tells you how to use cookies, with some common sense and a basic knowledge of PHP you shouldn't have any trouble using it.

I suppose I could post an example (untested).
CODE

$musicon = 0;
// If the cookie already exists
if(isset($_COOKIE['playMusic']))
{
  $musicon = intval( $_COOKIE['playMusic'] );
}
else
{
  // if it doesn't create it, storing the value one to represent that you will play music
  setcookie("playMusic", 1, time()+360000);
  $musicon = 1;
}
if( $musicon == 1 )
{
  //play music code here
}

well i have the common sense... just not the php knowledge.


Thanks cool.

But how would you Make it so the music stops if there is a cookie.

I would also have to make it.



CODE
$musicon = 0;
// If the cookie already exists
if(isset($_COOKIE['stopMusic']))
{
 $musicon = intval( $_COOKIE['stopMusic'] );
}
else
{
 // if it doesn't create it, storing the value one to represent that you will play music
 setcookie("stopMusic", 1, time()+360000);
 $musicon = 1;
}
if( $musicon == 1 )
{
 //stop music code here
}
else
{
// play music code here
}


I think..

I'm not totally sure but anyway. I think that would work.

I want the code to seach for the cookie when the page (index) has been open.

But if they click a link (stop) on the index page they cookie sets to 1, equaling stop.

I was thinking, only add the music html code if the music is on.

Li'l Freak - December 16, 2007 02:16 AM (GMT)
so what you mean is send the cookie originally. But if they click stop music It will change the cookie num to say.. 0. Meaning don't play music?

Waterbottle - December 16, 2007 10:53 AM (GMT)
Yeah.




Hosted for free by InvisionFree