登录后我在检索个人资料页面时遇到问题 我不知道如何开始 我有所有登录代码 我不知道如何在登录后使用会话显示个人资料信息 请帮助我 我不知道还有什么去做
登录.php
<?php
include('com.php');
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$email = $_POST['email'];
$password = $_POST['password'];
// To protect MySQL injection (more detail about MySQL injection)
$email = stripslashes($email);
$password = stripslashes($password);
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$sql = "SELECT * FROM $tbl_name WHERE email='$email' AND password='$password'";
$result = mysql_query($sql);
// Mysql_num_row is counting table row
$count = mysql_num_rows($result);
// If result matched $email and $password, table row must be 1 row
if ($count == 1) {
// Register $email, $password and redirect to file "report.php"
session_register("email");
session_register("password");
header("location:profile.php");
} else {
echo "Wrong Username or Password";
}
?>