2012-06-26 68 views
0

我在翻译这个基于序列化的错误。mod_rewrite规则被忽略

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

这被忽略,跳到顶级?任何帮助是极大的赞赏。

+0

你有'RewriteEngine叙述On'在你的.htaccess? – Zagorax

+0

是的,我做..呃,它的硬性发布,我有什么在小评论框,但如果你可以看到这个?选项+ FollowSymLinks RewriteEngine在 RewriteCond%{SCRIPT_FILENAME}!-dRewriteRule^/?(register)\。html/errors /([^ /] +)index.php?temp = register&errors = $ 1 [L] RewriteRule^/?(register_) \ .html /templates/manage_user_account.php [L] RewriteRule。([^ /] +)。html index.php [L] RewriteCond%{SCRIPT_FILENAME}!-f –

+0

我尝试确保所有内容都在逻辑上放置以相反的顺序排列,以便最后的规则被超越。 x –

回答

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(); 

?> 
+0

我刚刚用这个链接变量做了最愚蠢的事情。应该是像register.html /错误/ blahblah –

+0

还没有失败。 :o(会到那里......需要更多的啤酒,大声笑 –

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); 

感谢您寻找到虽然。

感谢

安迪