LOGIN Endless Loop Problem - Newbie
| From: | revDAVE | Date: | Tue, 08 Apr 2008 15:03:39 +0000 |
| Subject: | LOGIN Endless Loop Problem - Newbie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272712@lists.php.net to get a copy of this message | ||
Hi folks - Newbie Question here...
I'm using php with filemaker and api from http://fmwebschool.com I am asking
them also for help (nothing yet) - but I thought that here would also be a
great place to ask:
Thread listed here for easier reading...
http://fmwebschool.com/frm/index.php?topic=2234.0
---
Start with question:
*Q: Can someone show me how to solve the endless loop problem that Only
Happens : *if you type a BAD LOGIN and it asks you to do it again - and then
you do a successful login*
---
Sorry for this verbose thread...
My Login Setup:
Normally: FMWS login is set so after a successful login - you will go to the
page you started from (that needed a login).....
Currently I have things set so: after a login - before it goes to the page
you started from - ** it will first go to VARS.PHP and set some session
variables *** - then go to the final destination....
*PROBLEM: Somehow it all works - EXCEPT if you type a BAD LOGIN and it asks
you to do it again - and then user types a successful login then:
*It gets STUCK in an *Endless Loop* and the browser says:
Too many redirects occurred trying to open ³http://127.0.0.1/nm/vars.php².
This might occur if you open a page that is redirected to open another page
which then is redirected to open the original page.
I'm still confused by this issue...
*Q: Can someone show me how to solve the endless loop problem that Only
Happens : *if you type a BAD LOGIN and it asks you to do it again - and then
you do a successful login*
1 ==========MY LOGIN PAGE:
<?php
$_SESSION['login_from'] = 'client.php';
require_once('FileMaker/FMStudio_Tools.php');
if(!session_id()) session_start();
if( isset($_SESSION['login_from']) && $_SESSION['login_from'] !=
'vars.php'
) {
$_SESSION['orig_login_from'] = $_SESSION['login_from'];
}else{
//$_SESSION['orig_login_from'] = 'client.php';
}
$_SESSION['login_from'] = 'vars.php';
$_GET["errorMsg"] = fmsPerformLogin();
// FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?>
ALSO set like FMWS basic login - it goes to itself:
<form id="login_form" name="login_form" method="post"
action="">
etc..........
2 =========== MY VARS.PHP PAGE
... code.... set some variables....
<?php
if(!session_id()) session_start();
if($_SESSION['orig_login_from'] != "vars.php")
{ fmsRedirect($_SESSION['orig_login_from']);}
else
{ fmsRedirect('client.php');}
?>
3 =============FMStudio_Tools.php... (UNTOUCHED BY ME)
function fmsPerformLogin() {
if(!session_id()) session_start();
fmsCheckLogout();
if(isset($_POST['login_user'])) {
$user = fmsPOST('login_user');
$pass = fmsPOST('login_pass');
if($user == '' || $pass == '') return 'User Name or Password cannot
be
blank';
$conn = $_SESSION['login_conn'];
if(isset($_SESSION['login_from']) && $_SESSION['login_from'] !=
'') {
$from = $_SESSION['login_from'];
}else if(isset($_POST['defaultURL']) && $_POST['defaultURL'] !=
'') {
$from = $_POST['defaultURL'];
}else{
$from = 'index.php';
}
if(isset($_SESSION['login_type']) && $_SESSION['login_type'] ==
'table') {
$_SESSION[$conn.'_tableLogin'] =
array('user'=>$user,'pass'=>$pass,'first'=>true);
}else{
$_SESSION[$conn.'_login'] =
array('user'=>$user,'pass'=>$pass,'first'=>true);
}
session_write_close();
header('Location: '.$from);
exit();
}
if(isset($_GET["errorMsg"]) && $_GET["errorMsg"] != '') {
return $_GET["errorMsg"];
}else{
return '';
}
}
--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]