<?php
ob_start();
include("db_connect.php");
$tbl_name='login';
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$encrypted_mypassword = crypt($mypassword,'ctk');
$sql="SELECT * FROM $tbl_name WHERE u_name='$myusername' and password='$encrypted_mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
session_register("myusername");
session_register("encrypted_mypassword");
header("location:edit-grid.php");
}
else {header("location:main_login.php?a=Login Failed Try Again!!");
//echo "Wrong Username or Password";
}
ob_end_flush();
?>
我有一个登录页面如上所示,在本地主机上它可以正常工作,但在 firebug 中显示错误:
“Failed to load source for: http://localhost/emp_tracker/main/checklogin.php”
main_login.php?a=<iframe src="http://myevilsite.com"></iframe>
是否也能起作用? - acqu13sce