PDA

View Full Version : php help


lifesux
11-01-2006, 11:01 PM
with this script:

<?php
if(isset($_SESSION['pwngame']))
{
print "<table class='maintable'>";
print "<tr valign='top'><td width=25%>";
include "left.php";
print "</td>";
print "<td width=75%>";
//main table
print "<table width=90% class='maintable'>
<tr class='headline'><td>Main screen</td></tr>";
print "<tr class='mainrow'><td>";
print "This is your main user control panel, from here you change your password and change your avatar. To own people, point them to this URL:<br> $path/own.php?ID=$getuser3[eatid]<br><br>";
print "You have ownd $getuser3[score] people so far.<br><br>";
print "<A href='topscores.php'>Top 100 owners</a>";
print "</td></tr></table></td>";
print "</table><br><br>";
}
else
{
print "<table class='maintable'>";
print "<tr valign='top'><td width=100%>";
print "You are not logged in.";
print "</td></tr></table>";

}
?>,

if a user is not logged in, how do i get a redirect using php to login.php?

nometers
11-03-2006, 07:07 AM
The only way to do this in PHP would be to use a location header like this:


header( "Location: http://www.yoursite.com/new_page.html" ) ;


The only downfall with this method is that the line above should appear before anything is output to the browser (meaning that you cannot display a message before the user is redirected).

If you want to display a message and then redirect the user after some time, you have to use a JavaScript solution.