Forum Moderators: coopster

Message Too Old, No Replies

header redirect

refresh?

         

kumarsena

5:28 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



have a script thta does skinning for my website. on the script that sets the seesion i use a header location thing.

header("Location: [localhost:8080...]

the setskin.php3 page is where the user selects the skin. i was aiming for refreshing the page after selection, so that the user can see the look. but the header location part does not seem to refresh the page in any way. how come?

is there anyway of refreshing that page after a skin has been selected?

kumar

jatar_k

5:51 pm on Mar 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what about submitting the page to itself?

using $_SERVER['PHP_SELF'] [ca.php.net]

kumarsena

6:42 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



'PHP_SELF'
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address [example.com...] would be /test.php/foo.bar.

my script is a seperate file to setskin.php3. wouldnt that mean that the $_SESSION['PHP_SELF'] would be session.php3 (the script file) rather than setskin.php3, which is what i want it to be?

kumarsena

6:43 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



sorry, $_SERVER['PHP_SELF']

jatar_k

7:19 pm on Mar 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so

1. session.php3
2. header redirect to
3. setskin.php3
4. then refresh to
5. setskin.php3

is that what you are doing? and you need an answer for 4?

kumarsena

7:30 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



yeah, my friend, exactly...

jatar_k

7:40 pm on Mar 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



does setskin.php require user input?

is the header call there giving you an error or just not working?

kumarsena

8:07 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



well the user have to click on the chosen skin in setskin.php. which will pass teh skin name to session.php that will set the skin. and tehn refresh so that the user can see how the skin looks. no error messeges, the header redirect is working i think, casue i changed he location to a diffrent file than setskin.php and then it was working, showing the skin the user chose, but it is not working when redirecting to setskin.php itself.

jatar_k

8:26 pm on Mar 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If the redirect worked when you changed the filname but not to setskin then it is strange.

have you checked the path, or that some flag or var is set that makes the setskin script bomb?

kumarsena

9:18 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



cant notice anything,,,,

this is the script that on every page called check_session.php3

<?php
// start the session
session_start();
header('Cache-control: private'); //IE 6 Fix

if ( isset($_SESSION['skin']) ) {
$skin = $_SESSION['skin'];
}

else {
$skin = "wolf.css";
}
?>

this is the script that start session(session.php3)

<?php

session_start();
header("Cache-control: private"); //IE 6 Fix

// Get the user's input
$sname = $_GET['sname'];

// Register session key with the value
$_SESSION['skin'] = $sname;

header("Location: [localhost:8080...]
?>

seems ok to me

kumarsena

9:24 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



actually,

i found the error,

i ahd included the check_session script in the setscin file, but had not included the echo $skin in the link to the stylesheet, so it kept showing the same style all the time..

thansk for the help

kumar

jatar_k

9:28 pm on Mar 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm glad you found it I was sittin here scratchin my head to be honest :)