Follow us on Twitter!
Become the change you seek in the world. - Gandhi
Sunday, April 20, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 24
Guests Online: 22
Members Online: 2

Registered Members: 82843
Newest Member: hx47
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

php cookie setting

knutrainer
Member



Posts: 243
Location:
Joined: 08.07.05
Rank:
Apprentice
Posted on 24-05-06 06:54
I am trying to figure out a problem. I dont understand why my code wont set a cookie. Been working on this for 2 hours now and wanted to know if it was me or what.


Code
<html>

<head>

<title>cookie test(cookie Test)</title>

<?php


      setcookie("mission", $yes, time()+2592000);
      echo("cookies should be set!");

?>
</head>
</html>





Any help even if its highly critical is appreciated.


img389.imageshack.us/img389/974/knu5ui1ja.jpg
~PM me if you need help or instant message me.


knutrainer@gmail.com
Author

RE: php cookie setting


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-05-06 07:48
Try using single quotes
Code

<html>

<head>

<title>cookie test(cookie Test)</title>

<?php


setcookie('mission', $yes, time()+2592000);
echo "cookies should be set!";

?>
</head>
</html>






Author

RE: php cookie setting

knutrainer
Member



Posts: 243
Location:
Joined: 08.07.05
Rank:
Apprentice
Posted on 25-05-06 03:05
Here is my new code but I am having problems still with the cookies. Here is the error message.

Warning: Cannot modify header information - headers already sent by (output started at /home/shreves/public_html/enigma_challenge.php:3) in /home/shreves/public_html/enigma_challenge.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/shreves/public_html/enigma_challenge.php:3) in /home/shreves/public_html/enigma_challenge.php on line 17



Code
<html>

<?php

        $ch = curl_init();

        $ip="70.176.49.197";

   $username="knutrainer";

        $mission="yes";
       
   $url="http://www.enigmagroup.org/missions/programming/1/";
if( ($mission != null))
{
   setcookie("mission", $mission, time()+2592000);     // line 16
       
// line 17 is below
header("Location:http://www.enigmagroup.org/missions/programming/1/");
        exit();
}
   curl_setopt($ch, curlopt_url, $url);

        curl_setopt($ch, CURLOPT_POSTFIELDS, $ip&username&mission);

?>
</html>






img389.imageshack.us/img389/974/knu5ui1ja.jpg
~PM me if you need help or instant message me.


knutrainer@gmail.com
Author

RE: php cookie setting


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-05-06 03:15
That's because the '<html>' sent the headers, you have to set all cookies before any content is displayed

Code
<?php

$ch = curl_init();

$ip="70.176.49.197";

$username="knutrainer";

$mission="yes";

$url="http://www.enigmagroup.org/missions/programming/1/";
if( ($mission != null))
{
setcookie("mission", $mission, time()+2592000); // line 16

// line 17 is below
header("Location:http://www.enigmagroup.org/missions/programming/1/";
exit();
}
curl_setopt($ch, curlopt_url, $url);

curl_setopt($ch, CURLOPT_POSTFIELDS, $ip&username&mission);

?>
<html>

</html>





Author

RE: php cookie setting


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-05-06 03:18
ah maybe that is why i love hbh. keep up the good work!.com wasn't let me set cookies!damn i wish i would have know that lol thanks Jake