Azi
Erfahrenes Mitglied
Ich habe (versucht) einen Styleswitcher zu programmieren. Auf meinem lokalen Server hat es geklappt. Nur auf dem richtigem Server gab es Probleme: Irgendwie passiert nichts. Der Server hat PHP 4.3.3 drauf.
index.php
index.php
PHP:
<?php
if(isset($styleswitch)){
$style=$_POST['Style'];
setcookie("Style", $style, time()+365*24*3600);
$refresh=1;
}
else {
}
?>
<html>
<head>
<base href="<?php echo($_SERVER['PHP_SELF']); ?>">
<?php
if($refresh=="1"){
$refresh=0;
echo "<meta http-equiv=\"refresh\" content=\"0; URL=";
echo $_SERVER['PHP_SELF'];
echo "\">";
}
else {
echo " ";
}
?>
<?php
if($_COOKIE['Style']=="VirtualAquaBlue"){
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"data/styles/style01/style01.css\" title=\"VirtualAquaBlue\">";
}
elseif($_COOKIE['Style']=="Martin-und-Max"){
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"data/styles/style02/style02.css\" title=\"Martin-und-Max\">";
}
elseif($_COOKIE['Style']=="Mac"){
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"data/styles/style03/style03.css\" title=\"Martin-und-Max\">";
}
elseif($_COOKIE['Style']=="Kein"){
echo " ";
}
else{
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"data/styles/style01/style01.css\" title=\"VirtualAquaBlue\">";
}
?>
...
<form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="POST">
<select name="Style" size="1">
<option value="VirtualAquaBlue">VirtualAquaBlue</option>
<option value="Martin-und-Max">Martin-und-Max</option>
<option value="Mac">Mac</option>
<option value="Kein">Kein</option>
</select><br>
<input type="hidden" name="styleswitch" value="styleswitch">
<input type="Submit" name="Switch" value="Switch">
</form>
...