Sinisterly
When logged in it redirects, how to? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: When logged in it redirects, how to? (/Thread-When-logged-in-it-redirects-how-to)

Pages: 1 2 3


RE: When logged in it redirects, how to? - hellomen - 07-14-2014

Remember: THE HEADER() FUNCTION MUST BE USED BEFORE ANY HTML IS OUTPUTTED

There are 2 different well known header string arguments:: 'Location: Refresh:'

Location:
PHP Code:
Header("Location: http://www.example.eg");
Location will instantly redirect you without showing you anything.

it is also known as:
PHP Code:
Header("Location: Where_To_Redirect_To");

Refresh:
PHP Code:
Header("Refresh 5; URL=http://www.example.eg");
Refresh will be a redirect based on X seconds:

it is also known as:
PHP Code:
Header("Refresh: Seconds; URL= Where_To_Redirect_To");

If you have any problems importing this feel free to post again I hope I gave you a bit more information about what you can do Wink

Regards,
Mike M.


RE: When logged in it redirects, how to? - zomgwtfbbq - 07-14-2014

It's an extremely bad thought to think that using:
Code:
header("Location: http://www.example.eg");
will be enough.
It's not like when the interpreter stumbles upon the header location that it will redirect you right away, it will simply set the header and will proceed executing the rest of the script. Therefore you should always call the exit function to terminate the script, unless of course you want the rest of the script to be executed as well.


RE: When logged in it redirects, how to? - hellomen - 07-14-2014

(07-14-2014, 06:20 PM)zomgwtfbbq Wrote: It's an extremely bad thought to think that using:
Code:
header("Location: http://www.example.eg");
will be enough.
It's not like when the interpreter stumbles upon the header location that it will redirect you right away, it will simply set the header and will proceed executing the rest of the script. Therefore you should always call the exit function to terminate the script, unless of course you want the rest of the script to be executed as well.

like your reputation points given said.
you might neither be as smart as you thought with your judgement against me.
where did I say: "All you need is:" or "this is what you want:"?

the first part is clearly stated to me everyone that can read see's that

I said this as extra on the other replies
so instead of bitching and trying to be a damn smart ass gtfo or read the post.


RE: When logged in it redirects, how to? - The Real Slim Shady - 07-14-2014

(07-14-2014, 10:32 PM)hellomen Wrote: like your reputation points given said.
you might neither be as smart as you thought with your judgement against me.
where did I say: "All you need is:" or "this is what you want:"?

the first part is clearly stated to me everyone that can read see's that

I said this as extra on the other replies
so instead of bitching and trying to be a damn smart ass gtfo or read the post.

Calm the fuck down.

What he said was not wrong. Just because it may ""redirect you immediately"" as far as your perception is concerned, does not mean that other components of the script do not execute.

YOU failed to mention that fact - and its an important one where security is concerned - so dont get all fucking pissy when someone points out a relevant concern where you failed to elaborate.

Grow up or move on out if you cant be civil about being corrected.