Jump to content

ibr4n

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by ibr4n

  1. I've added session start, and I added the space, so the wouldn't come up in the forum.
  2. I actually do have that in my code. I think the forum messed it up. This is my code. <?php if ($_POST['change']){ $thevar = $_POST['change']; $_SESSION['bcg'] = $thevar; } if(!empty($_SESSION['bcg'])) { $thecolor = $_SESSION['bcg']; } else { $num = rand(0,9); if ($num == 0) $thecolor = "0DEBDF"; // CYAN if ($num == 1) $thecolor = "AE00FF"; // PURPLE if ($num == 2) $thecolor = "FFDC01"; // YELLOW if ($num == 3) $thecolor = "FF6D2D"; // PEACH if ($num == 4) $thecolor = "20ff7f"; // LIGHTER-GREEN if ($num == 5) $thecolor = "00E612"; // GREEN if ($num == 6) $thecolor = "E6005D"; // PINK if ($num == 7) $thecolor = "E600CF"; // PINK-PURPLE if ($num == 8 ) $thecolor = "e2ff20"; // LIME if ($num == 9) $thecolor = "8868ff"; // LAVENDER setcookie("thecolor", $thecolor, time()+604800); } ?>
  3. What do you mean? Can you show me what I need to add?
  4. I'm getting a " Parse error: syntax error, unexpected ';' in /home/ibran/public_html/color-change/stat.php on line 32" error.
  5. This is my code now. <?php if ($_POST['change']){ $thevar = $_POST['change']; $_SESSION['bcg'] = $thevar; } if(!empty($_SESSION['thecolor'])) { $thecolor = $_SESSION['thecolor']; } else { $num = rand(0,9); if ($num == 0) $thecolor = "0DEBDF"; // CYAN if ($num == 1) $thecolor = "AE00FF"; // PURPLE if ($num == 2) $thecolor = "FFDC01"; // YELLOW if ($num == 3) $thecolor = "FF6D2D"; // PEACH if ($num == 4) $thecolor = "20ff7f"; // LIGHTER-GREEN if ($num == 5) $thecolor = "00E612"; // GREEN if ($num == 6) $thecolor = "E6005D"; // PINK if ($num == 7) $thecolor = "E600CF"; // PINK-PURPLE if ($num == $thecolor = "e2ff20"; // LIME if ($num == 9) $thecolor = "8868ff"; // LAVENDER // send a cookie that never expires setcookie("thecolor",$thecolor, time()+604800); } ?> However, I'm now receiving this error. Warning: Cannot modify header information - headers already sent by (output started at /home/ibran/public_html/wp-content/themes/iBran 5/header.php:9) in /home/ibran/public_html/color-change/stat.php on line 36
  6. I've created a code to allow the user to change the background color and scheme of my site. However, I'm having trouble getting a random color to show up if the user has not yet set a color choice. Here's my code. Could someone put it together to make it work? <?php if ($_POST['change']){ $thevar = $_POST['change']; $_SESSION['bcg'] = $thevar; } if(isset($_SESSION['thecolor'])) { $thecolor = $_SESSION['thecolor']; } else { $num = rand(0,9); if ($num == 0) $thecolor = "0DEBDF"; // CYAN if ($num == 1) $thecolor = "AE00FF"; // PURPLE if ($num == 2) $thecolor = "FFDC01"; // YELLOW if ($num == 3) $thecolor = "FF6D2D"; // PEACH if ($num == 4) $thecolor = "20ff7f"; // LIGHTER-GREEN if ($num == 5) $thecolor = "00E612"; // GREEN if ($num == 6) $thecolor = "E6005D"; // PINK if ($num == 7) $thecolor = "E600CF"; // PINK-PURPLE if ($num == $thecolor = "e2ff20"; // LIME if ($num == 9) $thecolor = "8868ff"; // LAVENDER // send a cookie that never expires setcookie("thecolor",$thecolor, time()+604800); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.