2010-10-05 220 views
0

我創建了一個登錄系統與會話在PHP中,當使用標題重定向到一個特定的頁面後,檢查用戶名和密碼,它顯示以下在螢火蟲響應「未能加載源:http://localhost/emp_tracker/main/edit_new.php」 ,但它重定向在本地系統,而不是在服務器上,當我託管它不重定向。是否有任何方式重定向,而不是header('Location:'.$filename);登錄系統與會話

代碼:

<?php 
session_start(); 
include("db_connect.php"); 
$filename="edit-grid.php"; 
$myusername = mysql_real_escape_string($_REQUEST['myusername']); 
$encrypted_mypassword = mysql_real_escape_string(crypt($_REQUEST['mypassword'], 'ctk')); 
$check_query=mysql_query 
("select * from login where u_name='$myusername' and password='$encrypted_mypassword'"); 
$session_value=mysql_fetch_array($check_query); 
$count=mysql_num_rows($check_query); 
$session_name=$session_value['u_name']; 
if($count==1){$_SESSION['session_name']=$session_name; 
header('Location:'.$filename); 
} 
?> 
+0

我不知道你在說什麼。你能顯示一些代碼和URL重定向嗎? – 2010-10-05 11:54:40

+0

@pekka我已經添加了我的代碼只是檢查,我打印每一行代碼,並發現當我使用頭,在火災bug它顯示無法加載源:http:// localhost/emp_tracker/main/edit_new。 PHP。其他方面,它工作正常 – mayuri 2010-10-05 11:58:51

+0

然後是什麼問題?我不確定我是否明白 – 2010-10-05 13:28:56

回答

1

你應該在你的頭()調用使用絕對URL。