Shoutbox

Why wont this work? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Why wont this work? (/showthread.php?tid=54637)

Why wont this work? by Val on 01-05-2006 at 04:11 PM

Hey guys I wanted a way for users to select the style sheet they want to use for  my site and save their selection in a cookie so my friend Ezra wrote this up for me but it dosent work becouse the code just gives me and error "unexpected { on line 4"

so here is the code its not all of it just the part that gives the error

code:
<?php
//Setting the cookie

if(!isset($_COOKIE['css']){
    if(isset($_GET['style']) && $_GET['style'] != ""){
        setcookie("css", htmlspecialchars($_GET['style'], ENT_QUOTES), time()+11156);
        header("/");
    }
}
?>


if you need more code just request it
RE: Why wont this work? by L. Coyote on 01-05-2006 at 04:25 PM

quote:
Originally posted by ValSpy
if(!isset($_COOKIE['css']){
There is a ) missing at the end, between the ) and the {
RE: Why wont this work? by Val on 01-05-2006 at 05:05 PM

quote:
Originally posted by Leo
There is a ) missing at the end, between the ) and the {
Thanks leo but now I get a 500 error check it out, http://valspy.net/V2/set.php and if you click on in the header of this page it gives same error http://valspy.net/V2/index.php
RE: Why wont this work? by Plik on 01-05-2006 at 05:11 PM

quote:
Originally posted by ValSpy
quote:
Originally posted by Leo
There is a ) missing at the end, between the ) and the {
Thanks leo but now I get a 500 error check it out, http://valspy.net/V2/set.php and if you click on in the header of this page it gives same error http://valspy.net/V2/index.php

that would most likely be this line:
quote:
Originally posted by ValSpy
header("/");

I assume you're trying to do a header relocation? if you are then you need to do this:
header("Location: the place you are relocating to");
and im not sure if you can use / as the location, you will probably need to use the file, eg, index.php, although im not sure about this
RE: Why wont this work? by Ezra on 01-05-2006 at 05:21 PM

yeah, I was tired when I made that :P

But I gave him a new working & tested version :)


RE: Why wont this work? by L. Coyote on 01-05-2006 at 05:21 PM

quote:
Originally posted by Madman
and im not sure if you can use / as the location, you will probably need to use the file, eg, index.php, although im not sure about this
Yes, you can.

Edit: meh, I didn't see the header("/"); when I replied before (my first reply to this thread). Anyway, in this post I meant you can put header("Location: /");
RE: Why wont this work? by Val on 01-05-2006 at 06:09 PM

Thanks guys for all your help and if you want to test it out go here http://valspy.net/V2/ and I have 3 colors blue, pink, orange if anyone wants to suggest a color please do so here in this thread


RE: Why wont this work? by Nathan on 01-05-2006 at 06:31 PM

Red+Black would go pretty nicely!
Overall good start