2012-06-26 64 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); 

感謝您尋找到雖然。

感謝

安迪