我想显示: 登录为:_ __ _ ___
到目前为止的代码:
登录检查,
<?php
include('config.php');
// username and password sent from form
$myemail=$_POST['myemail'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection
$myemail = stripslashes($myemail);
$mypassword = stripslashes($mypassword);
$myemail = mysql_real_escape_string($myemail);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE email='$myemail' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
if($count==1){
session_start();
$_SESSION['myemail'] = $myemail;
header("Location: http://www.jblanksby.yourwebsolution.net/login_success.php? user=$myemail"); }
else
{ header("Location: http://www.jblanksby.yourwebsolution.net/loginerror.php");
}
?>
登录成功页面/第一个会员页面,
<?
$email = $_GET['myemail'];
session_start();
$_SESSION['myemail'] = $email;
if(isset($_SESSION['email'])){
} else {
echo "
<script language='javascript'>
alert('Sorry, but you must login to view the members area!')
</script>
<script>
window.location='http://jblanksby.yourwebsolution.net/sign_in.php'
</script>
"; }
?>
<html>
blah blah blah
</html>
用于显示用户电子邮件的代码,
Logged in as: <? echo "$email"; ?>
事物的登录方面是完美的。仅显示用户电子邮件被证明是困难的。我做错了什么/错过了什么?