Question : jquery Colorbox login form redirect

hi,

I have a jQuery that opens with an iframe which is a login form. The user enters a username and password which then check a simple php file that if the username and password are correct needs to close colorbox and redirect the page starting the session.

I got the login check to work, however I cannot close the colorbox and redirect to the correct page with the session started.

my login script that opens in the  iframe in the colorbox popup looks like the attached code...

Any help or suggestions would be gratefully received.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
<?php

$Admin_Username=mysql_escape_string($_POST['Admin_Username']);
$Admin_Password=mysql_escape_string($_POST['Admin_Password']);

//Data base check here

if ($Admin_Password == 'XXX' AND $Admin_Username == 'XXX') 
 {
 session_start();
 $_SESSION['123']='123';
 
 // need to close the colorbox - I know this is not right
 parent.jQuery.fn.colorbox.close(); return false;
 //then redirect parent to index.phph with the session starting
  header('Location: index.php');
 }
 //else redirect userback to loginform 
else header('Location: login.php');

?>

Answer : jquery Colorbox login form redirect

Did not parent.jQuery.fn.colorbox.close(); return false; should be called on browser side ?
Maybe you should add sth like:

$Admin_Username=mysql_escape_string($_POST['Admin_Username']);
$Admin_Password=mysql_escape_string($_POST['Admin_Password']);

//Data base check here

if ($Admin_Password == 'XXX' AND $Admin_Username == 'XXX')
 {
session_start();
$_SESSION['123']='123';

 // need to close the colorbox - I know this is not right
?><html><script>parent.jQuery.fn.colorbox.close(); return false;</script></html><?
//then redirect parent to index.phph with the session starting
 header('Location: index.php');
}
//else redirect userback to loginform
else header('Location: login.php');

?>
Random Solutions  
 
programming4us programming4us