dtmsaqtly798322992 2015-07-13 23:02
浏览 23

重定向太多

I have this php script ( phpfanlist ) with an admin section that refused to work one day. I guess it came with a php update or something. I didn't mind at the time but now it's bugging me big time.

I made research, I checked the log and all ( there was a depreciate =& new in front.inc.php but I corrected it, so that's fine ) but the login page still redirect to a blank page after successful login. If the login is not successful, it throws back an error message. If I manually try to enter the admin section ( admin.php ) after successfully login-in, I get into the admin without problem.

I checked the log and I don't get any message, at all. How can I make that login page work ? I just want to enter the admin without typing it manually ... Is the code too old ?

So, login.php gives a form to enter login/pass

  • Successful login : reload login.php to blank page of login.php
  • Unsuccessful login : reload login.php with unsuccessful message
  • What it's suppose to do on successful login : open admin.php

This is login.php :

require_once('includes/front.inc.php');
    $passok = true;
    if (isset($_POST['user']) && isset($_POST['pass']) && (strcasecmp($_POST['user'], $fanlisting->settings['admin_name']) == 0) &&     (strcmp($_POST['pass'], $fanlisting->settings['admin_pass']) == 0)) {
        session_start();
        header("Cache-control: private"); // IE fix!!!
        $_SESSION['loggedin'] = 1;
        if (!isset($fanlisting->settings['cookie_lifetime'])) {
            $fanlisting->settings['cookie_lifetime'] = 60;
        }
        if (isset($_POST['rememberme']) && ($_POST['rememberme'] == 'yes')) {
            setcookie('phpfanlist_rememberme', 'yesplease',     time()+60*60*24*$fanlisting->settings['cookie_lifetime'], '/');
            setcookie('phpfanlist_username', $_POST['user'], time()+60*60*24*$fanlisting->settings['cookie_lifetime'], '/');
        } else {
            setcookie('phpfanlist_rememberme', FALSE, time()+60*60*24*$fanlisting->settings['cookie_lifetime'], '/');
            setcookie('phpfanlist_username', FALSE, time()+60*60*24*$fanlisting->settings['cookie_lifetime'], '/');
        }
        if (isset($_SESSION['previous_url'])) {
            $url = $_SESSION['previous_url'];
            unset($_SESSION['previous_url']);
        } else { 
            $url = 'admin.php'; 
        }
        header('Location: ' . $url);
        exit;
    } else { (isset($_POST['pass'])) ? $passok = false : $passok = true; }

EDIT : so, it looks like there's too many redirect from admin.php Looking at admin.php doesn't seem to give much info

// Password protect it \\
session_start();
header("Cache-control: private"); // IE fix!!!
if (isset($_GET['action']) && ($_GET['action'] == 'logout')) {
    $_SESSION = array();
    }
if ((!isset($_SESSION['loggedin'])) || ($_SESSION['loggedin'] != 1)) {

    header('Location:admin.php');
    exit;
    }
/***********************/

require_once('includes/inc.php');
require_once(realpath(PHPFANLIST_INCLUDES . 'admin.inc.php'));

Header of admin.inc.php is just asking for

require_once('./includes/inc.php');

// Get the actions
require_once('admin.scripts.inc.php');
$fanlisting->LastChecked();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端