The MU forums have moved to

Adding PHP Code To Set Cookie (3 posts)

  1. johanhorak
    Posted 14 years ago #

    Hi I need to add some php to one of my mu blogs that was created at

    Here's the code:

    if (!empty($_GET['jrox']))
    $cookie_expires = 1 * 60 * 60 * 24 * 365;
    $cookie_domain = ''; //DON'T FORGET THE . (dot) before the domain
    setcookie("jrox", $_GET['jrox'], time()+$cookie_expires,"/", $cookie_domain);

    Apparently I can create a cookiepage.php and place it at

    But how do I do it at

    There must be another solution where I just add this php code to one of my existing php pages.

    Thanks for helping.


  2. cafespain
    Posted 14 years ago #

    create a file called cookiepage.php, put your code in it and upload it to your server.

  3. johanhorak
    Posted 14 years ago #

    Thanks cafespain That makes sense if it was not a mu blog that needs to set the cookie at the one subdomain. I cannot see how to upload this file to sub domain


    I have now decided to add the code to the theme I use for this sub domain only.

    If use my own logic I should add it to my header.php because then the cookie can be set for any page. The other option is index.php but then my limited experience tells me the cookie may only be set for the main url

About this Topic

  • Started 14 years ago by johanhorak
  • Latest reply from johanhorak