Ok, so I'm stupid that I didn't realize this earlier. Like 2 years earlier, we won't talk about that. So for sometime now, I've been trying to figure out how to redirect using the header function once session_start has been called. Up until now I've been using a function similar to this:
Code: Select all
<?php
function redirect_to($url)
{
if(!headers_sent())
{
header('location:' $url);
}
else
{
echo '<meta http-equiv="refresh" content="0;url='.$url.'">';
}
exit();
}
?>
However, today I found a simpler way to get it done. I actually RTFM, for once.
Code: Select all
<?php
@session_start();
$_SESSION['var'] = 'Test';
@session_write_close();
header('location: http://www.google.com');
?>
Hope this help's someone. For everyone else, please don't laugh to hard

.