EOF; if( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko' ) === false ) { showmessage('x'.$myadx.'x'); } //申请PHPWind5的免费论坛 $ubbsid = $bbsid; if(!submitcheck('regsubmit', 0, $seccodecheck)) { $enctype = $groupinfo['allowavatar'] == 3 ? 'enctype="multipart/form-data"' : NULL; $accessexp = '/('.str_replace("\r\n", '|', preg_quote($accessemail, '/')).')$/i'; $censorexp = '/('.str_replace("\r\n", '|', preg_quote($censoremail, '/')).')$/i'; $accessemail = str_replace("\r\n", '/', $accessemail); $censoremail = str_replace("\r\n", '/', $censoremail); $advcheck = $regadvance ? 'checked' : ''; $advdisplay = $regadvance ? '' : 'none'; $styleselect = $dayselect = ''; $query = $db->query("SELECT styleid, name FROM {$tablepre}styles WHERE bbsid='0' AND available='1'"); while($styleinfo = $db->fetch_array($query)) { $styleselect .= ''."\n"; } for($num = 1; $num <= 31; $num++) { $dayselect .= ''; } $dateformatorig = $dateformat; $dateformatorig = str_replace('n', 'mm', $dateformatorig); $dateformatorig = str_replace('j', 'dd', $dateformatorig); $dateformatorig = str_replace('y', 'yy', $dateformatorig); $dateformatorig = str_replace('Y', 'yyyy', $dateformatorig); if($seccodecheck) { $seccode = random(4, 1); } include template('getbbs'); } else{ $domain = strtolower(trim($domain)); $domain_ext = trim($domain_ext); if(preg_match('/[^a-zA-Z0-9]/i',$domain)) { //strtolower showmessage('域名只能使用英文字母和数字,请返回重新选择'); } if(strlen($domain) <= 2) { showmessage('域名必须大于2位,请返回重新选择'); } if(in_array($domain,array('www','hanliu','mybbs','my','ww','w','bbs','get','forum','music','blog','reg','register','join','images','image','vip'))){ showmessage('该域名已经被系统预留,你不能申请,请返回重新选择.'); } $domain = strtolower($domain.'.'.$domain_ext); $query = $db->query("SELECT * FROM {$tablepre}bbs WHERE domain='$domain'"); if($db->num_rows($query)) { showmessage('域名已经存在,请返回重新选择.'); } require_once DISCUZ_ROOT.'./include/discuzcode.func.php'; $email = trim($email); $username = trim($username); $alipay = trim($alipay); if(strlen($username) < 3) { showmessage('profile_username_tooshort'); // profile_username_tooshort } if(strlen($username) > 15) { showmessage('profile_username_toolong'); } if($password != $password2) { showmessage('profile_passwd_notmatch'); } $guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8'; $censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($censoruser = trim($censoruser)), '/')).')$/i'; if(preg_match("/^\s*$|^c:\\con\\con$|[%,\*\"\s\t\<\>\&]|$guestexp/is", $username) || ($censoruser && @preg_match($censorexp, $username))) { showmessage('profile_username_illegal'); } if($censoruser && (@preg_match($censorexp, $nickname) || @preg_match($censorexp, $cstatus))) { showmessage('profile_nickname_cstatus_illegal'); } if(!$password || $password != addslashes($password)) { showmessage('profile_passwd_illegal'); } $accessexp = '/('.str_replace("\r\n", '|', preg_quote($accessemail, '/')).')$/i'; $censorexp = '/('.str_replace("\r\n", '|', preg_quote($censoremail, '/')).')$/i'; $invalidemail = $accessemail ? !preg_match($accessexp, $email) : $censoremail && preg_match($censorexp, $email); if(!isemail($email) || $invalidemail) { showmessage('profile_email_illegal'); } if($alipay && !isemail($alipay)) { showmessage('profile_alipay_illegal'); } if($regverify == 2 && !trim($regmessage)) { showmessage('profile_required_info_invalid'); } if($groupinfo['maxsigsize']) { if(strlen($signature) > $groupinfo['maxsigsize']) { $maxsigsize = $groupinfo['maxsigsize']; showmessage('profile_sig_toolong'); } } else { $signature = ''; } $password = md5($password); $secques = quescrypt($questionid, $answer); $tppnew = in_array($tppnew, array(10, 20, 30)) ? $tppnew : 0; $pppnew = in_array($pppnew, array(5, 10, 15)) ? $pppnew : 0; if($dateformatnew) { $dateformatnew = str_replace('mm', 'n', $cdateformatnew); $dateformatnew = str_replace('dd', 'j', $dateformatnew); $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew); $dateformatnew = str_replace('yy', 'y', $dateformatnew); } else { $dateformatnew = ''; } $dateformatnew = str_replace('mm', 'n', $dateformatnew); $dateformatnew = str_replace('dd', 'j', $dateformatnew); $dateformatnew = str_replace('yyyy', 'Y', $dateformatnew); $dateformatnew = str_replace('yy', 'y', $dateformatnew); $icq = preg_match("/^([0-9]+)$/", $icq) && strlen($icq) >= 5 && strlen($icq) <= 12 ? $icq : ''; $qq = preg_match("/^([0-9]+)$/", $qq) && strlen($qq) >= 5 && strlen($qq) <= 12 ? $qq : ''; $bday = datecheck($bday) ? $bday : '0000-00-00'; //$avatar = dhtmlspecialchars($avatar); $yahoo = dhtmlspecialchars($yahoo); $msn = dhtmlspecialchars($msn); $taobao = dhtmlspecialchars($taobao); $email = dhtmlspecialchars($email); $alipay = dhtmlspecialchars($alipay); $bday = dhtmlspecialchars($bday); $signature = censor($signature); $sigstatus = $signature ? 1 : 0; $sightml = addslashes(discuzcode(stripslashes($signature), 1, 0, 0, 0, ($groupinfo['allowsigbbcode'] ? ($groupinfo['allowcusbbcode'] ? 2 : 1) : 0), $groupinfo['allowsigimgcode'], 0)); $bio = censor(dhtmlspecialchars($bio)); $site = dhtmlspecialchars(trim(preg_match("/^https?:\/\/.+/i", $site) ? $site : ($site ? 'http://'.$site : ''))); $locationnew = cutstr(censor(dhtmlspecialchars($locationnew)), 30); $nickname = $groupinfo['allownickname'] ? cutstr(censor(dhtmlspecialchars($nickname)), 30) : ''; $cstatus = $groupinfo['allowcstatus'] ? cutstr(censor(dhtmlspecialchars($cstatus)), 30) : ''; $invisiblenew = $invisiblenew && $groupinfo['allowinvisible'] ? 1 : 0; $idstring = random(6); $authstr = $regverify == 1 ? "$timestamp\t2\t$idstring" : ''; //avatar $avatar = ''; $avatarimagesize = array(); if($groupinfo['allowavatar'] == 3 && disuploadedfile($_FILES['customavatar']['tmp_name']) && $_FILES['customavatar']['tmp_name'] != 'none' && $_FILES['customavatar']['tmp_name'] && trim($_FILES['customavatar']['name'])) { $_FILES['customavatar']['name'] = daddslashes($_FILES['customavatar']['name']); $avatarext = strtolower(fileext($_FILES['customavatar']['name'])); if(!in_array($avatarext, array('gif', 'jpg', 'png'))) { showmessage('profile_avatar_invalid'); } $avatar = 'customavatars/'.$uid.'.'.$avatarext; $avatartarget = DISCUZ_ROOT.'./'.$avatar; if(!@copy($_FILES['customavatar']['tmp_name'], $avatartarget)) { @move_uploaded_file($_FILES['customavatar']['tmp_name'], $avatartarget); } $avatarimagesize = @getimagesize($avatartarget); if(!$avatarimagesize) { @unlink($avatartarget); showmessage('profile_avatar_invalid'); } elseif($maxavatarsize && filesize($avatartarget) > $maxavatarsize) { @unlink($avatartarget); showmessage('profile_avatar_toobig'); } if(is_array($avatarextarray) && !in_array($avatarext, $avatarextarray)) { showmessage('profile_avatar_invalid'); } } elseif(($groupinfo['allowavatar'] == 2 || $groupinfo['allowavatar'] == 3) && $urlavatar) { if(!preg_match("/^(http:\/\/.+?)|(images\/avatars\/.+?)|(customavatars\/.+?)$/i", $urlavatar)) { showmessage('profile_avatar_invalid'); } $avatarimagesize = @getimagesize($urlavatar); $avatar = $urlavatar; } elseif(($groupinfo['allowavatar'] == 1 || $groupinfo['allowavatar'] == 2 || $groupinfo['allowavatar'] == 3) && $systemavatar) { if(!preg_match("/^(images\/avatars\/.+?)$/i", $systemavatar)) { showmessage('profile_avatar_invalid'); } $avatarimagesize = @getimagesize($systemavatar); $avatar = $systemavatar; } if($avatar) { if(!in_array(strtolower(fileext($avatar)), array('gif', 'jpg', 'png'))) { showmessage('profile_avatar_invalid'); } $avatar = dhtmlspecialchars(trim($avatar)); if($avatarwidth == '*' || $avatarheight == '*' || $avatarwidth == '' || $avatarheight == '') { $avatarwidth = $avatarheight = ($maxavatarpixel ? round($maxavatarpixel * 0.6) : 80); @list($avatarwidth, $avatarheight) = $avatarimagesize ? $avatarimagesize : array($avatarwidth, $avatarheight); } $maxsize = max($avatarwidth, $avatarheight); if($maxsize > $maxavatarpixel) { $avatarwidth = $avatarwidth * $maxavatarpixel / $maxsize; $avatarheight = $avatarheight * $maxavatarpixel / $maxsize; } } /* $query = $db->query("SELECT MAX(groupid) FROM {$tablepre}usergroups WHERE bbsid='$bbsid'"); $nowid = $db->result($query, 0); $nowid++; */ $db->query("INSERT INTO {$tablepre}bbs (domain,bbsname,realname,passport,regdate,regip,cid,frombbsid,available,credits) VALUES ('$domain','".mysql_escape_string(cutstr(dhtmlspecialchars($bbsname),20))."','".mysql_escape_string($realname)."','".mysql_escape_string($passport)."','$timestamp','$onlineip','".(int)$cid."','".(int)$ubbsid."',1,50)"); $bbsid = $db->insert_id(); $db->query("INSERT INTO {$tablepre}members (bbsid,uid,username, password, secques, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, posts, credits, extcredits1, extcredits2, extcredits3, extcredits4, extcredits5, extcredits6, extcredits7, extcredits8, email, bday, sigstatus, tpp, ppp, styleid, dateformat, timeformat, pmsound, showemail, newsletter, invisible, timeoffset) VALUES ('$bbsid','1','$username', '$password', '$secques', '$gendernew', '1', '1', '$onlineip', '$timestamp', '$timestamp', '$timestamp', '0', $initcredits, '$email', '$bday', '$sigstatus', '$tppnew', '$pppnew', '$styleidnew', '$dateformatnew', '$timeformatnew', '$pmsoundnew', '$showemail', '$newsletter', '$invisiblenew', '$timeoffsetnew')"); $uid = 1;//$db->insert_id(); $db->query("INSERT INTO {$tablepre}memberfields (bbsid,uid, nickname, site, icq, qq, yahoo, msn, taobao, alipay, location, bio, signature, sightml, customstatus, authstr, avatar, avatarwidth, avatarheight $fieldadd1) VALUES ('$bbsid','$uid', '$nickname', '$site', '$icq', '$qq', '$yahoo', '$msn', '$taobao', '$alipay', '$locationnew', '$bio', '$signature', '$sightml', '$cstatus', '$authstr', '$avatar', '$avatarwidth', '$avatarheight' $fieldadd2)"); /* if($regctrl || $regfloodctrl) { $db->query("DELETE FROM {$tablepre}regips WHERE dateline<='$timestamp'-".($regctrl > 72 ? $regctrl : 72)."*3600", 'UNBUFFERED'); if($regctrl) { $db->query("INSERT INTO {$tablepre}regips (bbsid,ip, count, dateline) VALUES ('$bbsid','$onlineip', '-1', '$timestamp')"); } } if($regverify == 2) { $db->query("REPLACE INTO {$tablepre}validating (bbsid,uid, submitdate, moddate, admin, submittimes, status, message, remark) VALUES ('$bbsid','$uid', '$timestamp', '0', '', '1', '0', '$regmessage', '')"); } */ /* if($welcomemsg && !empty($welcomemsgtxt)) { $welcomtitle = "Welcome to $bbname!"; $welcomtitle = addslashes($welcomtitle); $welcomemsgtxt = addslashes($welcomemsgtxt); $db->query("INSERT INTO {$tablepre}pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES ('System Message', '0', '$uid', 'inbox', '1', '$welcomtitle', '$timestamp','$welcomemsgtxt')"); $db->query("UPDATE {$tablepre}members SET newpm='1' WHERE uid='$uid'"); } if($fromuid) { updatecredits($fromuid, $creditspolicy['promotion_register']); dsetcookie('promotion', ''); } */ $discuz_uid = $uid; $discuz_user = $username; $discuz_userss = stripslashes($discuz_user); $discuz_pw = $password; $discuz_secques = $secques; $groupid = $groupinfo['groupid']; $styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid']; //$db->query("UPDATE {$tablepre}members SET bbsid='$bbsid',adminid='1',groupid='1' WHERE uid='$uid'"); $query = $db->query("SELECT * FROM {$tablepre}settings WHERE bbsid='0'"); while($setting = $db->fetch_array($query)) { if($setting['variable'] == 'onlinerecord') $setting['value'] ="1\t".$timestamp; if($setting['variable'] == 'bbname') $setting['value'] = dhtmlspecialchars($bbsname); $db->query("INSERT INTO {$tablepre}settings (variable, bbsid, value) VALUES ('".$setting['variable']."', '$bbsid', '".$setting['value']."')"); } $query = $db->query("SELECT * FROM {$tablepre}usergroups WHERE bbsid='0'"); while($usergroup = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}usergroups (`groupid`, `bbsid`, `radminid`, `type`, `system`, `grouptitle`, `creditshigher`, `creditslower`, `stars`, `color`, `groupavatar`, `readaccess`, `allowvisit`, `allowpost`, `allowreply`, `allowpostpoll`, `allowpostreward`, `allowposttrade`, `allowpostactivity`, `allowdirectpost`, `allowgetattach`, `allowpostattach`, `allowvote`, `allowmultigroups`, `allowsearch`, `allowavatar`, `allowcstatus`, `allowuseblog`, `allowinvisible`, `allowtransfer`, `allowsetreadperm`, `allowsetattachperm`, `allowhidecode`, `allowhtml`, `allowcusbbcode`, `allowanonymous`, `allownickname`, `allowsigbbcode`, `allowsigimgcode`, `allowviewpro`, `allowviewstats`, `disableperiodctrl`, `reasonpm`, `maxprice`, `maxpmnum`, `maxsigsize`, `maxattachsize`, `maxsizeperday`, `maxpostsperhour`, `attachextensions`, `raterange`, `tradetaxtype`, `tradetaxs`, `mintradeprice`, `maxtradeprice`, `minrewardprice`, `maxrewardprice`) VALUES ('".$usergroup['groupid']."', '".$bbsid."', '".$usergroup['radminid']."', '".$usergroup['type']."', '".$usergroup['system']."', '".$usergroup['grouptitle']."', '".$usergroup['creditshigher']."', '".$usergroup['creditslower']."', '".$usergroup['stars']."', '".$usergroup['color']."', '".$usergroup['groupavatar']."', '".$usergroup['readaccess']."', '".$usergroup['allowvisit']."', '".$usergroup['allowpost']."', '".$usergroup['allowreply']."', '".$usergroup['allowpostpoll']."', '".$usergroup['allowpostreward']."', '".$usergroup['allowposttrade']."', '".$usergroup['allowpostactivity']."', '".$usergroup['allowdirectpost']."', '".$usergroup['allowgetattach']."', '".$usergroup['allowpostattach']."', '".$usergroup['allowvote']."', '".$usergroup['allowmultigroups']."', '".$usergroup['allowsearch']."', '".$usergroup['allowavatar']."', '".$usergroup['allowcstatus']."', '".$usergroup['allowuseblog']."', '".$usergroup['allowinvisible']."', '".$usergroup['allowtransfer']."', '".$usergroup['allowsetreadperm']."', '".$usergroup['allowsetattachperm']."', '".$usergroup['allowhidecode']."', '".$usergroup['allowhtml']."', '".$usergroup['allowcusbbcode']."', '".$usergroup['allowanonymous']."', '".$usergroup['allownickname']."', '".$usergroup['allowsigbbcode']."', '".$usergroup['allowsigimgcode']."', '".$usergroup['allowviewpro']."', '".$usergroup['allowviewstats']."', '".$usergroup['disableperiodctrl']."', '".$usergroup['reasonpm']."', '".$usergroup['maxprice']."', '".$usergroup['maxpmnum']."', '".$usergroup['maxsigsize']."', '".$usergroup['maxattachsize']."', '".$usergroup['maxsizeperday']."', '".$usergroup['maxpostsperhour']."', '".$usergroup['attachextensions']."', '".$usergroup['raterange']."', '".$usergroup['tradetaxtype']."', '".$usergroup['tradetaxs']."', '".$usergroup['mintradeprice']."', '".$usergroup['maxtradeprice']."', '".$usergroup['minrewardprice']."', '".$usergroup['maxrewardprice']."')"); } $query = $db->query("SELECT * FROM {$tablepre}admingroups WHERE bbsid='0'"); while($admingroup = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}admingroups (`admingid`, `bbsid`, `alloweditpost`, `alloweditpoll`, `allowstickthread`, `allowmodpost`, `allowdelpost`, `allowmassprune`, `allowrefund`, `allowcensorword`, `allowviewip`, `allowbanip`, `allowedituser`, `allowmoduser`, `allowbanuser`, `allowpostannounce`, `allowviewlog`, `disablepostctrl`, `supe_allowpushthread`) VALUES ('".$admingroup['admingid']."', '".$bbsid."', '".$admingroup['alloweditpost']."', '".$admingroup['alloweditpoll']."', '".$admingroup['allowstickthread']."', '".$admingroup['allowmodpost']."', '".$admingroup['allowdelpost']."', '".$admingroup['allowmassprune']."', '".$admingroup['allowrefund']."', '".$admingroup['allowcensorword']."', '".$admingroup['allowviewip']."', '".$admingroup['allowbanip']."', '".$admingroup['allowedituser']."', '".$admingroup['allowmoduser']."', '".$admingroup['allowbanuser']."', '".$admingroup['allowpostannounce']."', '".$admingroup['allowviewlog']."', '".$admingroup['disablepostctrl']."', '".$admingroup['supe_allowpushthread']."')"); } $query = $db->query("SELECT * FROM {$tablepre}onlinelist WHERE bbsid='0'"); while($onlist = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}onlinelist (groupid, bbsid,displayorder ,title , url) VALUES ('".$onlist['groupid']."', '$bbsid','".$onlist['displayorder']."','".$onlist['title']."', '".$onlist['url']."')"); } $query = $db->query("SELECT * FROM {$tablepre}ranks WHERE bbsid='0'"); while($rank = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}ranks (`bbsid`, `ranktitle`, `postshigher`, `stars`, `color`) VALUES ('".$bbsid."', '".mysql_escape_string($rank['ranktitle'])."', '".$rank['postshigher']."', '".$rank['stars']."', '".$rank['color']."')"); } $query = $db->query("SELECT * FROM {$tablepre}smilies WHERE bbsid='0'"); while($smile = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}smilies (`bbsid`, `displayorder`, `type`, `code`, `url`) VALUES ('".$bbsid."', '".$smile['displayorder']."', '".$smile['type']."', '".mysql_escape_string($smile['code'])."', '".$smile['url']."')"); } $query = $db->query("SELECT * FROM {$tablepre}bbcodes WHERE bbsid='0'"); while($bbcode = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}bbcodes (`bbsid`, `available`, `tag`, `icon`, `replacement`, `example`, `explanation`, `params`, `nest`) VALUES ( '$bbsid', '".$bbcode['available']."', '".$bbcode['tag']."', '".$bbcode['icon']."', '".mysql_escape_string($bbcode['replacement'])."', '".$bbcode['example']."', '".$bbcode['explanation']."', '".$bbcode['params']."', '".$bbcode['nest']."')"); } $query = $db->query("SELECT * FROM {$tablepre}medals WHERE bbsid='0'"); while($medal = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}medals (bbsid,name ,available , image) VALUES ( '$bbsid','".$medal['name']."','".$medal['available']."', '".$medal['image']."')"); } $query = $db->query("SELECT * FROM {$tablepre}styles WHERE bbsid='0' AND styleid =1"); while($style = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}styles (styleid,bbsid,name ,available , templateid) VALUES ('".$style['styleid']."', '$bbsid','".$style['name']."','".$style['available']."', '".$style['templateid']."')"); } $query = $db->query("SELECT * FROM {$tablepre}stylevars WHERE bbsid='0' AND styleid =1 "); while($stylevar = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}stylevars (bbsid,styleid , variable ,substitute) VALUES ('$bbsid','".$stylevar['styleid']."' , '".$stylevar['variable']."', '".$stylevar['substitute']."')"); } $query = $db->query("SELECT * FROM {$tablepre}crons WHERE bbsid='0'"); while($cron = $db->fetch_array($query)) { $db->query("INSERT INTO {$tablepre}crons (bbsid,cronid,available,type,name,filename,lastrun,nextrun,weekday,day,hour,minute ) VALUES ('$bbsid','".$cron['cronid']."','".$cron['available']."','".$cron['type']."' , '".mysql_escape_string($cron['name'])."', '".$cron['filename']."', '".$cron['lastrun']."', '".$cron['nextrun']."', '".$cron['weekday']."', '".$cron['day']."', '".$cron['hour']."', '".$cron['minute']."')"); } $db->query("INSERT INTO {$tablepre}forums (bbsid,fid,type, name, status) VALUES ('$bbsid','1','group', 'Default Category', '1')"); $db->query("INSERT INTO {$tablepre}forumfields (bbsid,fid) VALUES ('$bbsid','1')"); //$db->query("INSERT INTO {$tablepre}forums (bbsid,fid,type, name, status) VALUES ('$bbsid','2','forum', 'Default Forum', '1')"); $db->query("INSERT INTO {$tablepre}forums (`bbsid`, `fid`, `fup`, `type`, `name`, `status`, `displayorder`, `styleid`, `threads`, `posts`, `todayposts`, `lastpost`, `allowsmilies`, `allowhtml`, `allowbbcode`, `allowimgcode`, `allowanonymous`, `allowshare`, `allowpostspecial`, `alloweditrules`, `recyclebin`, `modnewposts`, `jammer`, `disablewatermark`, `inheritedmod`, `autoclose`, `forumcolumns`, `threadcaches`, `allowpaytoauthor`) VALUES ('$bbsid', 2, 1, 'forum', '默认论坛', 1, 0, 0, 0, 0, 0, '', 1, 0, 1, 1, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)"); $db->query("INSERT INTO {$tablepre}forumfields (bbsid,fid) VALUES ('$bbsid','2')"); if($ubbsid != 0){ $db->query("UPDATE {$tablepre}bbs SET credits=credits+1 WHERE id='$ubbsid'"); } include template('getbbsok'); exit(); } ?>