1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| <?php
function random($length) { $hash = ""; $chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $max = strlen($chars) - 1; PHP_VERSION < "4.2.0" && mt_srand((double)microtime() * 1000000); for($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } return $hash; }elseif(valid_email($email) == false){
$con = mysql_connect("localhost","root","你的密码"); if (!$con){ die("Could not connect: " . mysql_error()); } mysql_select_db("ultrax", $con);
$result=mysql_query("SELECT * FROM pre_ucenter_members WHERE username="".$email."" ",$con); if ($myrow = mysql_fetch_array($result)){ $salt=$myrow["salt"];
} $opwd=md5(md5(trim($_POST["pwd"])).$salt); $result=mysql_query("SELECT * FROM pre_ucenter_members WHERE username="".$email."" AND password="".$opwd.""",$con); if ($myrow = mysql_fetch_array($result)){
$oemail=$myrow["email"]; $opwd=$myrow["password"]; $username=$myrow["username"]; $areaid=2; $fuserid=0;
mysql_select_db("qing", $con); $oemailNum = $db->once_num_rows("select * from ".dbprefix."user where email="$oemail" ");
if($oemailNum == "0"){
$db->query("INSERT INTO ".dbprefix."user (`pwd` , `email`) VALUES ("$opwd", "$oemail");"); $userid = $db->insert_id();
$db->query("insert into ".dbprefix."user_scores (`userid`,`scorename`,`score`,`addtime`) values ("".$userid."","注册","1000","".time()."")");
$arrData = array( "userid"=> $userid, "fuserid"=> $fuserid, "username"=> $username, "email"=> $oemail, "sex"=> $sex, "areaid" => $areaid, "ip"=> getIp(), "count_score"=> "1000", "addtime"=> time(), "uptime"=> time(), );
$db->insertArr($arrData,dbprefix."user_info");
$isgroup = $db->once_fetch_assoc("select optionvalue from ".dbprefix."user_options where optionname="isgroup""); if($isgroup["optionvalue"] != ""){ $arrGroup = explode(",",$isgroup["optionvalue"]); foreach($arrGroup as $item){ $groupusernum = $db->once_num_rows("select * from ".dbprefix."group_users where `userid`="".$userid."" and `groupid`="".$item."""); if($groupusernum == "0"){ $db->query("insert into ".dbprefix."group_users (`userid`,`groupid`,`addtime`) values("".$userid."","".$item."","".time()."")");
$count_user = $db->once_num_rows("select * from ".dbprefix."group_users where groupid="".$item."""); $db->query("update ".dbprefix."group set `count_user`="".$count_user."" where groupid="".$item."""); } } }
$userData = $db->once_fetch_assoc("select * from ".dbprefix."user_info where userid="$userid"");
$sessionData = array( "userid" => $userData["userid"], "username" => $userData["username"], "areaid" => $userData["areaid"], "path" => $userData["path"], "face" => $userData["face"], "count_score" => $userData["count_score"], "uptime" => $userData["uptime"], ); $_SESSION["tsuser"] = $sessionData;
$msg_userid = "0"; $msg_touserid = $userid; $msg_content = "亲爱的 ".$username." :<br />您使用OC账号成功加入了 ".$TS_SITE["base"]["site_title"]."<br />在遵守本站的规定的同时,享受您的愉快之旅吧!"; aac("message")->sendmsg($msg_userid,$msg_touserid,$msg_content);
}
$userData = $db->once_fetch_assoc("select * from ".dbprefix."user_info where email="$oemail""); if($userData["isenable"] == 1) qiMsg("sorry,你的帐号已被禁用!");
if($cktime != ""){ setcookie("ts_email", $email, time()+$cktime,"/"); setcookie("ts_pwd", $pwd, time()+$cktime,"/"); } $sessionData = array( "userid" => $userData["userid"], "username" => $userData["username"], "areaid" => $userData["areaid"], "path" => $userData["path"], "face" => $userData["face"], "count_score" => $userData["count_score"], "uptime" => $userData["uptime"], ); $_SESSION["tsuser"] = $sessionData; $userid = $userData["userid"]; $db->query("insert into ".dbprefix."user_scores (`userid`,`scorename`,`score`,`addtime`) values ("".$userid."","登录","10","".time()."")"); $strScore = $db->once_fetch_assoc("select sum(score) score from ".dbprefix."user_scores where userid="".$userid."""); $db->query("update ".dbprefix."user_info set `uptime`="".time()."" , `count_score`="".$strScore["score"]."" where userid="$userid""); if($jump != ""){ header("Location: ".$jump); }else{ header("Location: ".SITE_URL); } }else{ qiMsg("登录失败!问问老曾吧=_="); } ?>
|