session_start();
class save_reg{
private $usernc;
private $userpsw;
private $truename;
private $sex;
private $email;
private $tel;
private $qq;
private $photo;
private $address;
public function __construct($usernc,$userpsw,$truename,$sex,$email,$tel,$qq,$photo,$address){
$this->usernc=$usernc;
$this->userpsw=$userpsw;
$this->truename=$truename;
$this->sex=$sex;
$this->email=$email;
$this->tel=$tel;
$this->qq=$qq;
$this->photo=$photo;
$this->address=$address;
}
public function savereg(){
include_once(conn.php);
if (mysql_query("select usernc from tbuser where usernc='".$this->usernc."'",$conn)) {
echo "";
exit; }
if (mysql_query("insert into tbuser(usernc,pwd,truename,email,qq,tel,ip,address,photo,regtime,sex,lastlogintime,logintime)
values('".$this->usernc."','".$this->userpsw."','".$this->truename."','".$this->email."','".$this->qq."','".$this->tel."','".$_SERVER["PHP_SELF"]."',
'".$this->address."','".$this->photo."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1')",$conn)) {
if ($_SESSION["unc"]!="") {
session_unregister("unc");
}
session_register("unc");
$_SESSION["unc"]=$this->usernc;
echo "";
}else {
echo "";
}
}
}
$obj=new save_reg($_POST[usernc],md5($_POST[psw]),$_POST[truename],$_POST[sex],$_POST[eamil],$_POST[tel],$_POST[qq],$_POST[photo],$_POST[address]);
$obj->savereg();
?>
上头是代码,提交后,就只是注册失败了
展开