|
Posted by Toby A Inkster on 11/27/07 17:52
Mike wrote:
> If the Login is incorrect, they just get a embedded message.
> If it is correct, I want to redirect COMPLETLY.
if ($rowcount==0)
{
echo "<p>Wrong Username or Password Dufus</p>";
}
else
{
$_SESSION['U'] = $result_1[U];
$_SESSION['P'] = $result_1[P];
print 'Location: Main_Mockup.php';
}
And then your Javascript needs to do something like this:
var $result = (result from AJAX request as string);
if ($result.match( /^Location\:/i ))
{
var $url = $result.replace( /^Location\:\s+/i, '' );
window.location.href = $url;
}
else
{
// Display the message like you already do.
}
The redirection is the Javascript's job here, not PHP's. The PHP just
needs to tell the Javascript where to redirect to.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 3 days, 34 min.]
It'll be in the Last Place You Look
http://tobyinkster.co.uk/blog/2007/11/21/no2id/
[Back to original message]
|