mod_rewrite规则被忽略

时间:2012-06-26 16:15:05

标签: mod-rewrite

我希望根据序列化错误进行翻译。

RewriteRule ^/?(register)\.html/errors/([^/]+) index.php?temp=register&errors= $1 [L]
RewriteRule ^/?(register)\.html index.php?temp=register [L]

这被忽略并跃升至顶级水平?非常感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

Zagorax确定......这是管理注册表单的代码......

<?php 

/// Stage 1 check - create basic account and present options
require_once('../connections/application.php');

//// set the new connection to be able to write/update the DB
///// for writing database
$eggbox->close_eggbox();
$eggbox->connect_eggbox("write");

$eggbox_secure_checks = new eggbox_secure_checks;

$timenow = strtotime(date('Y-m-d H:i:s'));

////// Set the references
$PHPSESSIONID = $_SESSION['PHPSESSIONID'];  

////// set credentials
$_SESSION['client_name'] = stripslashes(str_replace("'", "''", ($_POST['client_name'])));
$_SESSION['client_email'] = stripslashes(str_replace("'", "''", ($_POST['client_email'])));
 $_SESSION['email_check'] = stripslashes(str_replace("'", "''", ($_POST['email_check'])));
$_SESSION['client_psw'] = $_POST['client_psw'];
$_SESSION['psw_check'] = $_POST['psw_check'];
$_SESSION['client_tel'] = stripslashes(str_replace("'", "''", ($_POST['client_tel'])));
$_SESSION['client_mobile'] = stripslashes(str_replace("'", "''", ($_POST['client_mobile'])));

if(isset($_POST['is_organisation'])){
    $_SESSION['is_organisation'] = $_POST['is_organisation'];
} else {
    $_SESSION['is_organisation'] = 0;
}

if($_SESSION['is_organisation'] == 1) {

    $_SESSION['company_name'] = stripslashes(str_replace("'", "''", ($_POST['company_name'])));
    $_SESSION['company_regno'] = stripslashes(str_replace("'", "''", ($_POST['company_regno'])));
    $_SESSION['company_url'] = stripslashes(str_replace("'", "''", ($_POST['company_url'])));

} else {

    $_SESSION['company_name'] = "Individual";
    $_SESSION['company_regno'] = "";    
$_SESSION['company_url'] = "";

}

if(isset($_POST['sign_up'])){
    $_SESSION['sign_up'] = $_POST['sign_up'];
} else {
    $_SESSION['sign_up'] = 0;
}

////// Checks for basic details are entered or relocate back with error messges
$error = array();
$i = 0;

if(($timenow - $_POST['timestampnow'] ) < 3){
    $error[$i][0] = 1;
    $error[$i][1] = 1;
    $i++;
    exit();
}

if($_SESSION['client_name'] == ""){    
$error[$i][0] = 2;
    $error[$i][1] = 'client_name';
    $i++;
}

if($_SESSION['client_email'] == ""){
    $error[$i][0] = 3;
    $error[$i][1] = 'client_email';
    $i++;
}

if($eggbox_secure_checks->validEmail($_SESSION['client_email']) == false){
    $error[$i][0] = 15;
    $error[$i][1] = 'client_email';
    $i++;
} 

if($_SESSION['client_email'] != $_SESSION['email_check']){
    $error[$i][0] = 4;
    $error[$i][1] = 'client_email';
    $i++;
}

if($_SESSION['client_psw'] == ""){
    $error[$i][0] = 5;
    $error[$i][1] = 'client_psw';
    $i++;
}

if($_SESSION['client_psw'] != $_SESSION['psw_check']){
    $error[$i][0] = 6;
    $error[$i][1] = 'client_psw';
    $i++;
}



/////// Additional checks for companies
if($_SESSION['is_organisation'] != 0){

    if($_SESSION['company_name'] == ""){
        $error[$i][0] = 2;
        $error[$i][1] = 'company_name';
        $i++;
    }

 } /// End if

/////// If Error then return to checkout.php
if(!empty($error)){ 


    $linkback =  "../index.php?temp=register&errors=" .      base64_encode(serialize($error));  ///// old link back
      $linkback =  "register.html?errors=" . base64_encode(serialize($error));
      header('location: ' . $linkback); //// new linkback

 } else { //// Process Transaction
////..........

 header('location: ' . $linkback);

 $eggbox->close_eggbox();

?>

答案 1 :(得分:0)

好的我现在解决了这个问题。

HTACCESS文件......

 RewriteRule ^/?(register)\.html/errors/([^/]+) index.php?temp=register&errors=$1 [L]
 RewriteRule ^/?(register)\.html index.php?temp=register [L]
 RewriteRule ^/?(manage_user_account)\.html templates/manage_user_account.php [L]

在主要的php文件中

 $linkback =  "register.html/errors/" . base64_encode(serialize($error));
 header('location: ' . $linkback);

感谢您查看。

由于

岸堤