header & $var

Status
Not open for further replies.

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Alright, this is a part from a code I am using:
Code:
unset($result);
if($action == 'logout'){
setcookie('md5_password', '');
setcookie('username', '');
setcookie('login_referer', '');
 
if($config_use_sessions){
@session_destroy();
@session_unset();
setcookie(session_name(), '');
header("Location: $PHP_SELF");
$result = ''.$say['wessel_loguit'];
}
}

However the problem is, after the header("Location: $PHP_SELF"); it doesn't execute $result = ''.$say['wessel_loguit']; in the PHP script. Anyone knows how to fix this?
 

iHarrison

Member
Mar 11, 2012
321
131
It's on the same page as far as I know.

If the header code is redirecting to the same page it's basically refreshing the whole thing, so I guess it will leave out any code after it.

I'm not sure how to fix this, um, maybe switching the two lines of code around?
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
If the header code is redirecting to the same page it's basically refreshing the whole thing, so I guess it will leave out any code after it.

I'm not sure how to fix this, um, maybe switching the two lines of code around?

Already tried, to bad it didn't work...
 

Sledmur

Web-Developer
Nov 29, 2011
459
98
Why in the holy fuck are you storing passwords as a cookie? facepalm.jpg 
And once it hits the header location. Its moving to a new page. It's not going to execute anything after that as your no longer on that page.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Why in the holy fuck are you storing passwords as a cookie? facepalm.jpg 
And once it hits the header location. Its moving to a new page. It's not going to execute anything after that as your no longer on that page.

It's UTF-8 CuteNews, I'm trying to fix some bugs in the Simpla Admin template for a friend. CuteNews doesn't use a database, so.

However, is there any possibilty for this to let it execute the $result, AND sending it to the other page?
 

Sledmur

Web-Developer
Nov 29, 2011
459
98
It's UTF-8 CuteNews, I'm trying to fix some bugs in the Simpla Admin template for a friend. CuteNews doesn't use a database, so.

However, is there any possibilty for this to let it execute the $result, AND sending it to the other page?
Yeah, put it before the header?
 

Adil

DevBest CEO
May 28, 2011
1,278
716
Sleep just delays a script by however many seconds are specified, not very asynchronous :(
You unset the result variable, why are you doing that? Unset destroys all data associated with a certain variable.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Sleep just delays a script by however many seconds are specified, not very asynchronous :(
You unset the result variable, why are you doing that? Unset destroys all data associated with a certain variable.

Removed both unsets, still isn't working.
 

Sledmur

Web-Developer
Nov 29, 2011
459
98
PHP:
[FONT=Consolas]unset($result);
if($action == 'logout'){
setcookie('md5_password', '');
setcookie('username', '');
setcookie('login_referer', '');
 
if($config_use_sessions){
@session_destroy();
@session_unset();
setcookie(session_name(), '');
$result = $say['wessel_loguit'];[/FONT]
[FONT=Consolas]header("Location: $PHP_SELF")[/FONT]
[FONT=Consolas]}
}[/FONT]
[FONT=Consolas]
[/FONT]
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
The whole code? Because I don't know where I can take a screenshot of. 
Whoops, misread something.
Where are you declaring your say array?

In another file, but that isnt the problem as the other say arrays work fine. 
PHP:
[FONT=Consolas]unset($result);
if($action == 'logout'){
setcookie('md5_password', '');
setcookie('username', '');
setcookie('login_referer', '');
 
if($config_use_sessions){
@session_destroy();
@session_unset();
setcookie(session_name(), '');
$result = $say['wessel_loguit'];[/FONT]
[FONT=Consolas]header("Location: $PHP_SELF")[/FONT]
[FONT=Consolas]}
}[/FONT]
[FONT=Consolas]
[/FONT]

What did you change, as I can't see it.
 
Status
Not open for further replies.

Users who are viewing this thread

Top