dongman2721
dongman2721
2013-11-01 17:58

标头重定向不重定向

已采纳

ok so i deleted some md5 password encryption because i was having issues with it. but now when i go to log in after adjusting the passwords in phpmyadmin the header redirect is not working. i know that the user logs in because when i go to the next pages link by typing it in the url it shows the user as logged in.

<?php
require('user_chat/config.php');
if(isset($_SESSION[''.CHAT_SESSION_UID.''])){
     header('http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
}

include_once 'include/processes.php';
   $Login_Process = new Login_Process;
      $Login_Process->check_login($_GET['page']);
         $Login = $Login_Process->log_in($_POST['user'], $_POST['pass'], $_POST['remember'], $_POST['page'], $_POST['submit']); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ccrxpersonnel.com</title>
<link type="text/css" rel="Stylesheet" href="http://wordpress.techlifeforgotten.com/wp-content/uploads/ultimatum/b9b341fd54db6ec6136e9edd548c0511.css?ver=3.6.1" />
<body>
<div class="container">

<?php
        if(isset($error_msg)){
        echo '<div class="err">'.$error_msg.' <a href="index.php">Go Back</a></div>';
                } else {
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >

<h1>Log In</h1>

<div class="red"><?php echo $Login; ?></div>
    <div class="label">
        Username:
    </div>
       <input name="user" type="text" class="field" id="user"/> 
       <br />
    <div class="label">
        Password:
    </div>
    <input name="pass" type="password" class="field" id="pass" value="" />
    <br />
    <div class="right">
        <label>Remember Me For 30 Day's
           <input name="remember" type="checkbox" value="true" />
        </label>
    </div>
    <input name="page" type="hidden" value="<? echo $_GET['page']; ?>" />
    <input name="submit" type="submit" class="button" value="Log In" />
    <br />
    <br />
    <div class="center">
        <a href="forgotpassword.php">Password Recovery</a>
    </div>
</form>
<?php
}
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/jquery.cookie.js"></script>
<script>
$.cookie("c_openbox","", { expires: -30 });
$.cookie("min_openbox","", { expires: -30 });
</script>
<?php
if(isset($_POST['submit']))
{
$time = time();
$username = mysql_real_escape_string($_POST['user']);
$password = mysql_real_escape_string($_POST['pass']);
    if($_POST['user'] != "" && $_POST['pass'] != ""){
        $password = $_POST['pass'];
        $query_test_new_user = mysql_query("SELECT * FROM ".DB_PREFIX."".USER_TABLE." WHERE ".USER_TABLE_USERNAME."='$username' AND ".USER_TABLE_PASSWORD."='$password' LIMIT 1");
        $row_test_new_user = mysql_fetch_array($query_test_new_user);
        $num_test_new_user = mysql_num_rows($query_test_new_user);
        if($num_test_new_user != '0' && $num_test_new_user != ''){
            $_SESSION[''.CHAT_SESSION_UID.''] = $row_test_new_user[''.USER_TABLE_ID.''];
            $_SESSION[''.CHAT_SESSION_UNAME.''] = $row_test_new_user[''.USER_TABLE_USERNAME.''];
            $_SESSION["Select_Whos"] = "Users";
            header('http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
        } else {
        $error_msg = 'Username and/or password is worng. Please try agian.';
        }
    } else {
    $error_msg = 'Username and/or password is empty. Please try agian.';
    }
}
?>
</div>
</body>
</html>

I honestly don't know what had happened with this but I am hoping it is something simple that I have overlooked.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanhunlou7051 duanhunlou7051 8年前

    You are missing to add Location in header. also add exit() after header.

    header('Location: http://digitalmed1.proadminsolutionsplus.com/wp-content/plugins/bittech_login/main.php');
    exit();
    
    点赞 评论 复制链接分享

相关推荐