sweetsmile78
(sweetsmile78)
注册会员

一般会员
UID 47547
精华
0
积分 59
帖子 59
金钱 59 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2004-11-10 来自 北京
状态 离线
|
[广告]: 代充Paypal帐号美元
这个函数怎么显示返回值
大家帮忙看一下,这个函数的返回值,要显示每个条件的返回结果应该怎么调用
$str= "<script>alert('注册成功!');location.href='reg.php'; </script>";
return $str;
这个javascript返回值这么写对吗?
<?
function CheckPassword($username,$password)
{
$sql="select * from user where user='".$username."'";
if($result=$db->query($sql))
{
if($rs=mysql_fetch_object($result))
{
if($rs->password==$password)
{
$str="<script>alert('该用户已注册!');location.href='reg.php'; </script>";
return $str;
return false;
}
else
{
$sql = "update user set password='".password."'
where id=min(select id from user where statu='0')";
$query = $db->query($sql);
$str= "<script>alert('注册成功!');location.href='reg.php'; </script>";
return $str;
return $username;
return $password;
}
}
else
{
$sql = "update user set id='".$username."',password='".password."'
where id=min(select id from user where statu='0')";
$query = $db->query($sql);
$str= "<script>alert('注册成功!');location.href='reg.php'; </script>";
return $str;
return $username;
return $password;
}
}
else
{
$str="<script>alert('连接数据库错误!');location.href='reg.php';</script>";
return $str;
}
}
?>
|
|