<?php
//session_start();
include("indexbase.php");
include("conn.php"); if(isset($_POST['submit'])){ //isset -->exist
if(isset($_POST["email"]))
{ $log=query('SELECT email FROM clientcompte WHERE email="'.$_POST["emails"].'"');
$result=mysql_num_rows($log);
}
else
$result=1; if($result!=0)
$loginexist=true;
else
$loginexist=false;
if((isset($_POST["nom"])) || !($loginexist)|| (isset($_POST["prenom"])) || (isset($_POST["emails"]))
||(isset($_POST["mot_de_pass"]))||(isset($_POST["remot_de_pass"])))
{
// code a executer si le formulaire est bien rempli
$info[]=$_POST["nom"];
$info[]=$_POST["prenom"];
$info[]=$_POST["emails"];
$info[]=$_POST["mot_de_pass"];
$info[]=$_POST["remot_de_pass"];
$values=implode("'), ('",$info);
$sql="INSERT INTO `clientcompte` (
`id` ,
`nom` ,
`prenom` ,
`email` ,
`mot_de_pass` ,
`remot_de_pass` ,
)
VALUES (NULL ,('".rtrim($values)."'))";
mysql_query($sql);
echo "<script language='javascript'>alert('inscrire success!');history.back();</script>";
}
else if($loginexist){
echo "<script language='javascript'>alert('ce user deja exist!');history.back();</script>";
}
mysql_close($conn);
}
下面else if 为什么不起作用呢?
//session_start();
include("indexbase.php");
include("conn.php"); if(isset($_POST['submit'])){ //isset -->exist
if(isset($_POST["email"]))
{ $log=query('SELECT email FROM clientcompte WHERE email="'.$_POST["emails"].'"');
$result=mysql_num_rows($log);
}
else
$result=1; if($result!=0)
$loginexist=true;
else
$loginexist=false;
if((isset($_POST["nom"])) || !($loginexist)|| (isset($_POST["prenom"])) || (isset($_POST["emails"]))
||(isset($_POST["mot_de_pass"]))||(isset($_POST["remot_de_pass"])))
{
// code a executer si le formulaire est bien rempli
$info[]=$_POST["nom"];
$info[]=$_POST["prenom"];
$info[]=$_POST["emails"];
$info[]=$_POST["mot_de_pass"];
$info[]=$_POST["remot_de_pass"];
$values=implode("'), ('",$info);
$sql="INSERT INTO `clientcompte` (
`id` ,
`nom` ,
`prenom` ,
`email` ,
`mot_de_pass` ,
`remot_de_pass` ,
)
VALUES (NULL ,('".rtrim($values)."'))";
mysql_query($sql);
echo "<script language='javascript'>alert('inscrire success!');history.back();</script>";
}
else if($loginexist){
echo "<script language='javascript'>alert('ce user deja exist!');history.back();</script>";
}
mysql_close($conn);
}
下面else if 为什么不起作用呢?
if(isset($_POST["email"]))
是什么意思?谢谢大家!
if($sql){
echo "<script>alert('该用户已经存在,请重新输入');</script>";
}
是不是
$result = mysql_query("select password from student where studentNum = '$studentNum' and password = '$password'");
while($row = mysql_fetch_row($result))
{
$array[]=$row;
}
mysql_free_result($result);
if(count($array))
{
$_SESSION["login"] = "yes";
header("Location: list.php");
}
else
{
echo "用户名或密码不正确!";
}如果不是,这段代码是什么意思呢?还有if($sql){
echo "<script>alert('该用户已经存在,请重新输入');</script>";
} 没有实现,为什么?
$log=query('SELECT email FROM clientcompte WHERE email="'.$_POST["emails"].'"');
$t=mysqli_fetch_array($log);
$useid=$_POST['注册页的useid'];
$a=$_POST['注册页的其他信息'];
if ( $t['用户名'] == 用户名 && $t['其他信息'] == 其他信息 )//如果进行过点评提示
{
echo '该用户名已经注册过';
}
if ( $t['用户名'] == 用户名 && $t['其他信息'] == 其他信息 )//如果进行过点评提示
{
echo '该用户名已经注册过';
}
这样就哦了