php skinning problems -- cookiecheck.php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kylee
Forum Newbie
Posts: 1
Joined: Thu Dec 27, 2007 12:52 pm

php skinning problems -- cookiecheck.php?

Post by kylee »

im having a problem skinning my site. everything is fine EXCEPT this:
i change my skin from my default & it changes fine but it wont stay with the new skin
heres my cookiecheck.php

Code: Select all

<?

$total_skins = 2;
$default_skin = 2;

if (isset($_REQUEST['newskin'])) {
$newskin=(int)$_REQUEST['newskin'];
if ( ($newskin<1) OR ($newskin>$total_skins) )
$newskin=$default_skin;
} elseif (isset($_REQUEST['skin'])) {
$newskin=(int)$skin;
if ( ($skin<1) OR ($skin>$total_skins) )
$newskin=$default_skin;
} else $newskin=$default_skin;

$skin=$newskin;
setcookie ('skin', "", time() - 3600);
setcookie('skin',$newskin,time()+(86400*3<? include("/home/kylee96/kylee.synthoxide.net/cookiecheck.php");?>
<? include($headervar.$extension); ?>
<? include($contentvar.$extension); ?> 
content
<? include($footervar.$extension);?>65),'/');
setcookie('skin',$newskin,time()+(86400*365),'/','.kylee.synthoxide.net');
$skin=$newskin;

$headervar = "/home/kylee96/kylee.synthoxide.net/skins/$newskin/header";
$footervar = "/home/kylee96/kylee.synthoxide.net/skins/$newskin/footer";
$contentvar = "/home/kylee96/kylee.synthoxide.net/skins/$newskin/content";
$extension = ".php";
?>
can anybody see if theres a mistake in my cookiecheck.php? thanks
& heres what im pasting into every content page

Code: Select all

<? include("/home/kylee96/kylee.synthoxide.net/cookiecheck.php");?>
<? include($headervar.$extension); ?>
<? include($contentvar.$extension); ?> 
content
<? include($footervar.$extension);?>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Are you receiving any errors?
If you aren't, make sure that errors are turned on.

Also, shouldn't

Code: Select all

setcookie('skin',$newskin,time()+(86400*3<? include("/home/kylee96/kylee.synthoxide.net/cookiecheck.php");?>
be

Code: Select all

...
setcookie('skin', $newskin, time()+86400*3); ?>
<?php include('/home/kylee96/kylee.synthoxide.net/checkcookie.php'); ?>
?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Oh, and also make sure to have setcookie before the <html> tag.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

PHPyoungster wrote:Oh, and also make sure to have setcookie before the <html> tag.
setcookie() needs to be before any content is sent to the browser
Post Reply