Php 我的代码没有';登录时不显示电子邮件名称
logins.phpPhp 我的代码没有';登录时不显示电子邮件名称,php,codeigniter,login-script,Php,Codeigniter,Login Script,logins.php <?php session_start(); $email= $_POST['email']; $Password= $_POST['pass']; if ($email && $Password){ $connect =mysql_connect("localhost","root","") or die ("Couldn't connect!"); mysql_select_db
<?php
session_start();
$email= $_POST['email'];
$Password= $_POST['pass'];
if ($email && $Password){
$connect =mysql_connect("localhost","root","") or die ("Couldn't connect!");
mysql_select_db("formbatch7") or die ("couldn't find db");
$query = mysql_query("select * FROM logintr where email='$email'");
$numrows = mysql_num_rows($query);
if ($numrows!=0)
{
while ($row= mysql_fetch_assoc($query))
{
$dbemail = $row['email'];
$dbpassword = $row['Password'];
}
//Chack to see if they match
if ($email==$dbemail and $Password==$dbpassword)
{
echo "you are in! <a href='trl.php'>click</a> hear to enter the page";
$_session['email']=$email;
}
else
echo "incorrect password!";
}
else
die ("That user dosent Exist");
//echo"<script>alert('details not correct') </script>";
}
else
die ("please evter the user name and password");
?>
请将您的
$\u会话['email']
更改为$\u会话['email']
PHP使用一组预定义的变量
我们需要按原样使用它们,而不改变它们的情况
希望这有帮助 感谢@Object ManufactorCodeIgniter拥有自己的database.php配置文件和库,它将使用
$connect=mysql\u connect保存您,您可以自动加载它。而且codeigniter还有一个会话库
<?php
session_start();
echo "welcome, ".$_session['email']."!";
?>