开发者

login system with sessions

i have created a login system with sessions in php,when used header to redirect to a particular page after checking username and password, it shows the following in firebug response "Failed to load source for: http://localhost/emp_tracker/main/edit_new.php" ,but it redirects in local system 开发者_C百科instead in server when i host it does not redirect.Is there any way to redirect other than header('Location:'.$filename);

Code:

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


You should use an absolute URL in your header() call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜