整合成这样子
是什么原因?
$user_tablename="discuz.cdb_members"; //用户表 $user_userid="uid"; //用户ID字段 $user_username="username"; //用户名字段 $user_password="password"; //密码字段 $user_dopass=0; //密码保存形式,0为md5,1为明码,2为双重加密 $user_rnd="enewsrnd"; //随机密码 $user_email="email"; //邮箱字段 $user_registertime="regdate"; //注册时间字段 $user_register=1; //注册时间保存形式,0为正常时间,1为数值型 $user_group="enewsgroupid"; //会员组字段 $user_userfen="enewsuserfen"; //点数字段 $user_userdate="enewsuserdate"; //包月字段 $user_money="enewsmoney"; //帐户余额 $user_todaydate="enewstodaydate"; //下载日期 $user_todaydown="enewstodaydown"; //当天下载次数 $user_groupid=$public_r[defaultgroupid]; //注册时会员组ID(ecms的会员组) //其他设置 $user_seting="discuz.cdb_settings"; //设置表 $forumgroupid=9; //论坛的普通会员组id值 //会员注册地址 $registerurl="http://localhost/discuz/register.php"; //特殊设置(如vbb,molyx) $user_salt="salt"; //salt $user_saltnum=3; //salt随机码字符数 $utfdata=0; //数据是否是utf-8编码,0为正常数据,1为utfdata编码 //-----------------------编码转换 function doUtfAndGbk($str,$phome=0) {global $utfdata; //正常编码 if(empty($utfdata)) { return $str; } //是否支持iconv if(!function_exists("iconv")) { echo"Iconv is not install!"; exit(); } //gbk转utf if(empty($phome)) { $str=iconv("gbk","UTF-8",$str); } //utf转gbk else { $str=iconv("UTF-8","gbk",$str); } return $str; } //-----------------------登录附加cookie function AddLoginCookie($r) { } //-----------------------后台修改资料 function admin_EditMember($add,$logininid,$loginin) {global $empire,$user_tablename,$user_username,$user_userid,$user_password,$user_dopass,$user_group,$user_email,$user_userfen,$user_money,$user_userdate,$user_saltnum,$user_salt; if(!trim($add[userid])||!trim($add[email])||!trim($add[username])||!$add[groupid]) {printerror("EmptyEmail","history.go(-1)");} //验证权限 CheckLevel($logininid,$loginin,$classid,"member"); //变量 $add[userid]=(int)$add[userid]; //编码转换 $dousername=$add[username]; $add[username]=doUtfAndGbk($add[username],0); $add[oldusername]=doUtfAndGbk($add[oldusername],0); $add[password]=doUtfAndGbk($add[password],0); $add[email]=doUtfAndGbk($add[email],0); //修改密码 if($add[password]) { //单重md5 if(empty($user_dopass)) { $add[password]=md5($add[password]); } elseif($user_dopass==2)//双重md5 { $salt=make_password($user_saltnum); $add[password]=md5(md5($add[password]).$salt); $sa=",".$user_salt."='$salt'"; } else {} $add1=",".$user_password."='".$add[password]."'".$sa; } //修改用户名 if($add[oldusername]<>$add[username]) { $num=$empire->gettotal("select count(*) as total from ".$user_tablename." where ".$user_username."='$add[username]' and ".$user_userid."<>'$add[userid]' limit 1"); $add1.=",".$user_username."='$add[username]'"; if($num) { printerror("ReUsername","history.go(-1)"); } } //包月 if($add[userdate]>0) { $userdate=time()+$add[userdate]*24*3600; } //变量 $add[groupid]=(int)$add[groupid]; $add[userfen]=(int)$add[userfen]; $userdate=(int)$userdate; $add[money]=(float)$add[money]; $sql=$empire->query("update ".$user_tablename." set ".$user_email."='$add[email]',".$user_group."=$add[groupid],".$user_userfen."=$add[userfen],".$user_money."=$add[money],".$user_userdate."=$userdate".$add1." where ".$user_userid."='$add[userid]'"); //附加表 $addnum=$empire->gettotal("select count(*) as total from phome_enewsmemberadd where userid='$add[userid]'"); if(empty($addnum)) { $sql1=$empire->query("insert into phome_enewsmemberadd(userid,truename,oicq,msn,`call`,phone,address,zip) values($add[userid],'$add[truename]','$add[oicq]','$add[msn]','$add[call]','$add[phone]','$add[address]','$add[zip]');"); } else { $sql1=$empire->query("update phome_enewsmemberadd set truename='$add[truename]',oicq='$add[oicq]',msn='$add[msn]',`call`='$add[call]',phone='$add[phone]',address='$add[address]',zip='$add[zip]' where userid='$add[userid]'"); } if($sql) { //操作日志 insert_dolog("userid=".$add[userid]." username=".$dousername); printerror("EditMemberSuccess","ListMember.php"); } else { printerror("DbError","history.go(-1)"); } } //---------------------后台删除会员 function admin_DelMember($userid,$loginuserid,$loginusername) {global $empire,$user_tablename,$user_username,$user_userid; $userid=(int)$userid; if(empty($userid)) {printerror("NotDelMemberid","history.go(-1)");} //验证权限 CheckLevel($loginuserid,$loginusername,$classid,"member"); $r=$empire->fetch1("select ".$user_username." from ".$user_tablename." where ".$user_userid."='$userid'"); $sql=$empire->query("delete from ".$user_tablename." where ".$user_userid."='$userid'"); //删除附加表 $sql1=$empire->query("delete from phome_enewsmemberadd where userid='$userid'"); //删除收藏 $del=$empire->query("delete from phome_enewsfava where userid='$userid'"); $del=$empire->query("delete from phome_enewsfavaclass where userid='$userid'"); if($sql) { $dousername=doUtfAndGbk($r[$user_username],1); //操作日志 insert_dolog("userid=".$userid." username=".$dousername); printerror("DelMemberSuccess","ListMember.php"); } else { printerror("DbError","history.go(-1)"); } } //--------------------后台批量删除会员 function admin_DelMember_all($userid,$logininid,$loginin) {global $empire,$user_tablename,$user_username,$user_userid; //验证权限 CheckLevel($logininid,$loginin,$classid,"member"); $count=count($userid); if(!$count) { printerror("NotDelMemberid","history.go(-1)"); } $j=0; for($i=0;$i<$count;$i++) { $add.=" ".$user_userid."='$userid[$i]' or"; $adda.=" userid='$userid[$i]' or"; $j++; } $add=substr($add,0,strlen($add)-3); $sql=$empire->query("delete from ".$user_tablename." where".$add); //删除附加表 $sql1=$empire->query("delete from phome_enewsmemberadd where".$adda); //删除收藏 $del=$empire->query("delete from phome_enewsfava where".$add); $del=$empire->query("delete from phome_enewsfavaclass where".$add); if($sql) { //操作日志 insert_dolog(""); printerror("DelMemberSuccess","ListMember.php"); } else { printerror("DbError","history.go(-1)"); } } //---------------取得邮件地址 function GetUserEmail($userid,$username) {global $empire,$user_tablename,$user_email,$user_userid; $r=$empire->fetch1("select ".$user_email." from ".$user_tablename." where ".$user_userid."='$userid' limit 1"); return doUtfAndGbk($r[$user_email],1); } //-------------返回修改资料 function ReturnUserInfo($userid) {global $empire,$user_tablename,$user_userid,$user_username,$user_email,$user_group,$user_userfen,$user_money,$user_userdate,$user_todaydown; $r=$empire->fetch1("select ".$user_username.",".$user_email.",".$user_group.",".$user_userfen.",".$user_money.",".$user_userdate.",".$user_todaydown." from ".$user_tablename." where ".$user_userid."='$userid' limit 1"); $re[username]=doUtfAndGbk($r[$user_username],1); $re[email]=doUtfAndGbk($r[$user_email],1); $re[userfen]=$r[$user_userfen]; $re[money]=$r[$user_money]; $re[groupid]=$r[$user_group]; $re[userdate]=$r[$user_userdate]; $re[todaydown]=$r[$user_todaydown]; return $re; } //--------------取得会员投稿数 function TotalUserNews($userid) {global $empire,$user_tablename; $r=$empire->fetch1("select count(*) as total from phome_enewsnews where userid='$userid' and ismember=1"); return $r[total]; } //------------------用户注册 function register($username,$password,$repassword,$email) {global $empire,$user_tablename,$public_r,$user_groupid,$user_username,$user_userid,$user_email,$user_password,$user_dopass,$user_rnd,$user_registertime,$user_register,$user_group,$user_saltnum,$user_salt,$user_seting,$forumgroupid,$registerurl; //关闭 if($public_r[register_ok]) {printerror("CloseRegister","history.go(-1)");} if(!empty($registerurl)) { Header("Location:$registerurl"); exit(); } $username=trim($username); $password=trim($password); $username=RepPostVar1($username); $password=RepPostVar1($password); if(!$username||!$password||!$email) {printerror("EmptyMember","history.go(-1)");} //用户字数 $pr=$empire->fetch1("select min_userlen,max_userlen,min_passlen,max_passlen from phome_enewspublic limit 1"); $userlen=strlen($username); if($userlen<$pr[min_userlen]||$userlen>$pr[max_userlen]) {printerror("FaiUserlen","history.go(-1)");} //密码字数 $passlen=strlen($password); if($passlen<$pr[min_passlen]||$passlen>$pr[max_passlen]) {printerror("FailPasslen","history.go(-1)");} if($repassword!=$password) {printerror("NotRepassword","history.go(-1)");} if(!chemail($email)) {printerror("EmailFail","history.go(-1)");} $check_r=explode("|",$username); if(count($check_r)!=1) {printerror("NotSpeWord","history.go(-1)");} $username=htmlspecialchars($username); $num=$empire->gettotal("select count(*) as total from ".$user_tablename." where ".$user_username."='$username' limit 1"); if($num) {printerror("ReUsername","history.go(-1)");} if($user_register) { $registertime=time(); $dyh=""; } else { $registertime=date("Y-m-d H:i:s"); $dyh="'"; } $birthday=$y.$m.$d; $rnd=make_password(12);//产生随机密码 $password=str_replace(" ","",$password); //单重md5 if(empty($user_dopass)) { $password=md5($password); } elseif($user_dopass==2) { $salt=make_password($user_saltnum); $password=md5(md5($password).$salt); } $user_groupid=(int)$user_groupid; $email=htmlspecialchars(addslashes($email)); $sql=$empire->query("insert into ".$user_tablename."(".$user_username.",".$user_password.",".$user_email.",".$user_registertime.",".$user_group.",".$user_rnd.") values('$username','$password','$email',".$dyh."$registertime".$dyh.",$user_groupid,'$rnd');"); //取得userid $userid=$empire->lastid(); if($sql) { $set1=setcookie("mloginusername",$username,0,"/",""); $set2=setcookie("mloginuserid",$userid,0,"/",""); $set3=setcookie("mlogingroupid",$user_groupid,0,"/",""); $set4=setcookie("mloginrnd",$rnd,0,"/",""); printerror("RegisterSuccess","../../"); } else {printerror("DbError","history.go(-1)");} } //---------------------信息修改 function EditInfo($password,$repassword,$oldpassword,$email) {global $empire,$user_tablename,$public_r,$user_userid,$user_username,$user_password,$user_dopass,$user_email,$user_salt,$user_saltnum; //是否登陆 $user_r=islogin(); $userid=$user_r[userid]; $username=$user_r[username]; $rnd=$user_r[rnd]; $groupid=$user_r[groupid]; if(!$userid||!$username||!trim($email)) {printerror("NotEmpty","history.go(-1)");} if(!chemail($email)) {printerror("EmailFail","history.go(-1)");} $email=htmlspecialchars(addslashes($email)); $post=$_POST; //编码转换 $username=doUtfAndGbk($username,0); $email=doUtfAndGbk($email,0); //修改密码 if($password) { if($password!=$repassword) {printerror("NotRepassword","history.go(-1)");} $password=doUtfAndGbk($password,0); $oldpassword=doUtfAndGbk($oldpassword,0); //单重加密 if(empty($user_dopass)) { $password=md5($password); $oldpassword=md5($oldpassword); } //双重加密 elseif($user_dopass==2) { $salt=make_password($user_saltnum); $password=md5(md5($password).$salt); $sa=",".$user_salt."='$salt'"; } else {} $num=0; //双重md5 if($user_dopass==2) { $ur=$empire->fetch1("select ".$user_userid.",".$user_salt.",".$user_password." from ".$user_tablename." where ".$user_username."='$username'"); $oldpassword=md5(md5($oldpassword).$ur[$user_salt]); $num=0; if($oldpassword==$ur[$user_password]) {$num=1;} if(empty($ur[$user_userid])) {$num=0;} } else { $num=$empire->gettotal("select count(*) as total from ".$user_tablename." where ".$user_username."='$username' and ".$user_password."='".$oldpassword."'"); } if(!$num) {printerror("FailOldPassword","history.go(-1)");} $add=",".$user_password."='".$password."'".$sa; } $sql=$empire->query("update ".$user_tablename." set ".$user_email."='$email'".$add." where ".$user_userid."='$userid'"); //附加表 $addnum=$empire->gettotal("select count(*) as total from phome_enewsmemberadd where userid='$userid'"); if(empty($addnum)) { $sql1=$empire->query("insert into phome_enewsmemberadd(userid,truename,oicq,msn,`call`,phone,address,zip) values($userid,'$post[truename]','$post[oicq]','$post[msn]','$post[call]','$post[phone]','$post[address]','$post[zip]');"); } else { $sql1=$empire->query("update phome_enewsmemberadd set truename='$post[truename]',oicq='$post[oicq]',msn='$post[msn]',`call`='$post[call]',phone='$post[phone]',address='$post[address]',zip='$post[zip]' where userid='$userid'"); } if($sql) {printerror("EditInfoSuccess","../member/EditInfo");} else {printerror("DbError","history.go(-1)");} } //----------------------------------是否登陆 function islogin() {global $empire,$editor,$user_tablename,$user_userid,$user_group,$user_groupid,$user_rnd; if($editor==2) {$a="../";} $r[userid]=(int)$_COOKIE['mloginuserid']; $r[username]=RepPostVar1($_COOKIE['mloginusername']); $r[rnd]=RepPostVar1($_COOKIE['mloginrnd']); $r[groupid]=RepPostVar1($_COOKIE['mlogingroupid']); if(!$r[userid]||!$r[username]) { $set3=setcookie("return_url",$_SERVER['HTTP_REFERER'],0,"/",""); //printerror("NotLogin",$a."../login"); printerror("NotLogin","history.go(-1)"); } return $r; } //-------------------------------------退出登陆 function loginout1($userid,$username,$rnd) {global $empire,$public_r; //是否登陆 $user_r=islogin(); $set1=setcookie("mloginusername","",0,"/",""); $set2=setcookie("mloginuserid","",0,"/",""); $set4=setcookie("mloginrnd","",0,"/",""); $set3=setcookie("mlogingroupid","",0,"/",""); printerror("ExitSuccess","../../"); } //----------------------------------------登陆 function login1($username,$password,$lifetime,$key,$location) {global $empire,$user_tablename,$user_userid,$user_username,$user_password,$user_dopass,$user_group,$user_groupid,$user_rnd,$public_r,$user_salt,$user_saltnum; if(!trim($username)||!trim($password)) {printerror("EmptyLogin","history.go(-1)");} //验证码 if($public_r[loginkey_ok]) { if($key<>$_COOKIE['checkplkey']||empty($_COOKIE['checkplkey'])) {printerror("FailKey","history.go(-1)");} } $username=RepPostVar1($username); $password=RepPostVar1($password); //编码转换 $utfusername=doUtfAndGbk($username,0); $password=doUtfAndGbk($password,0); if(empty($user_dopass)) {$password=md5($password);} //双重md5 $num=0; if($user_dopass==2) { $ur=$empire->fetch1("select ".$user_userid.",".$user_salt.",".$user_password." from ".$user_tablename." where ".$user_username."='$utfusername'"); $password=md5(md5($password).$ur[$user_salt]); $num=0; if($password==$ur[$user_password]) {$num=1;} if(empty($ur[$user_userid])) {$num=0;} } else { $num=$empire->gettotal("select count(*) as total from ".$user_tablename." where ".$user_username."='$utfusername' and ".$user_password."='".$password."' limit 1"); } if(!$num) { printerror("FailPassword","history.go(-1)"); } $r=$empire->fetch1("select * from ".$user_tablename." where ".$user_username. "='$utfusername' limit 1"); $time=date("Y-m-d H:i:s"); $rnd=make_password(12);//取得随机密码 if(empty($r[$user_group])) {$r[$user_group]=$user_groupid;} $r[$user_group]=(int)$r[$user_group]; $usql=$empire->query("update ".$user_tablename." set ".$user_rnd."='$rnd',".$user_group."=".$r[$user_group]." where ".$user_userid."='$r[$user_userid]'"); $set1=setcookie("mloginusername",$username,0,"/",""); $set2=setcookie("mloginuserid",$r[$user_userid],0,"/",""); $set3=setcookie("mlogingroupid",$r[$user_group],0,"/",""); $set4=setcookie("mloginrnd",$rnd,0,"/",""); //登录附加cookie AddLoginCookie($r); $location=$_COOKIE['return_url']; if(empty($location)) {$location="../../";} if(strstr($_SERVER['HTTP_REFERER'],"e/member/iframe")) {$location="../member/iframe";} $set5=setcookie("checkplkey","",0,"/",""); if($set1&&$set2) { printerror("LoginSuccess",$location); } else { printerror("NotCookie","history.go(-1)"); } } //----------------------------------批量赠送点数 function GetFen_all($cardfen,$userid,$username) {global $empire,$user_tablename,$user_userfen; $cardfen=(int)$cardfen; if(!$cardfen) {printerror("EmptyGetFen","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"card"); $sql=$empire->query("update ".$user_tablename." set ".$user_userfen."=".$user_userfen."+$cardfen"); if($sql) { //操作日志 insert_dolog("cardfen=$cardfen"); printerror("GetFenSuccess","GetFen.php");} else {printerror("DbError","history.go(-1)");} } //----------------------------------增加点数 function AddInfoFen($cardfen,$userid) {global $empire,$user_tablename,$user_userfen; $cardfen=(int)$cardfen; $sql=$empire->query("update ".$user_tablename." set ".$user_userfen."=".$user_userfen."+".$cardfen." where userid='$userid'"); } ?> Warning: Cannot modify header information - headers already sent by (output started at F:wwwtesteclassuser.php:6) in F:wwwtesteclassfunctions.php on line 3970 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') as total from' at line 1 select count() as total from
|
|
|