You are here: Re: PHP Script not working correctly in some browsers « PHP Programming Language « IT news, forums, messages
Re: PHP Script not working correctly in some browsers

Posted by Amanda H. on 02/16/06 00:02

My bad! Here is the PHP script, sans bulk of notes:

<?
header('Content-Type: text/css');
// CONFIGURATION
// If you want to specify a default CSS file for users who can't handle
// cookies, replace styles.css with the filename below:

$basicsheet = "basic.css";

// CHECK IF NEW STYLESHEET IS BEING LOADED
if(isset($_GET['sheet']) OR isset($_POST['sheet'])) {

// CHECK IF FILE IS SPECIFIED IN URL
if(isset($_GET['sheet'])) { $newsheet = $_GET['sheet']; }

// CHECK IF FILE IS SPECIFIED IN FORM DATA
if(isset($_POST['sheet'])) { $newsheet = $_POST['sheet']; }

// MAKE THE USER REMEMBER WHICH STYLESHEET IS LOADED
setcookie("my_stylesheet", "$newsheet.css", 0, "/");

// SEND THE USER BACK
$ref = $_SERVER['HTTP_REFERER'];
header("Location: $ref");

} else {

// NORMAL STYLESHEET REQUEST
$mysheet = $_COOKIE['my_stylesheet'];
if($mysheet == "") { $mysheet = $basicsheet; }
include "$mysheet";

}

?>

---end of PHP script. Then the link header for the HTML file is:

<link rel="stylesheet" type="text/css"
href="http://www.amandahenson.com/styleswitcher.php" />

---end of link. It works in most browsers, but has the problems as
stated in the originl post.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация