skin problem

A

Anonymous

Guest
Hey I am using a script to change images on my site when a skin is set.. But it isnt changing? please help me

Code:
<? 
// the skin variable is set, so let´s set the cookie. 
if ($HTTP_COOKIE_VARS['skin']!=""){ 

global $skinpath, $skincolor, $skintitle; 
$cookieval = $HTTP_COOKIE_VARS['skinval']; 

include "connect.php"; 
// select form the DB a skin with that value ($cookieval). 
$result = mysql_query("SELECT * FROM skin WHERE id='$cookieval'"); 
$row = mysql_fetch_array($result); 
// set the cookie 
setcookie ($row[ck_name],$row[ck_value],time()+60*60*24*30,"/");
// Feel the skin vars with the corresponding info 
$skinpath = $row[ck_skpath]; 
$skincolor = $row[ck_skcolor]; 
$skintitle = $row[ck_sktitle]; 
mysql_close(); 
} 
// If the cookie was not set, it will put a default skin 
else{ 
$skinpath = "images"; 
$skincolor = "blue"; 
$skintitle = "blue"; 
} 
?> 

<html>
webpage shit here and that

It will only change the images to what ever i have set as defualt
 
Oh i know...!
Do you already have the stuff in DB??
Cut this line (It´s doing nothing there):
PHP:
global $skinpath, $skincolor, $skintitle;
Is it setting the cookie ??Try $_COOKIE instead of $HTTP_COOKIE_VARS!
Anyway, check this topic, you may find easier ways to do what you want!
 
Gesf is correct, global has no effect in this context (global has nothing to do with sessions, it has to do with variable scope, which isn't what you're interested in here). Use $_COOKIE.
 
Back
Top