Members share a destoon7.0 product supply module + module publishing interface, we want to help!
? <PHP @set_time_limit (0); DEFINE ( 'DT_ADMIN', to true); DEFINE ( 'DT_MEMBER', to true); the require 'common.inc.php'; . the require DT_ROOT '/ ADMIN / global.func.php'; DT_ROOT the require '/ the include / post.func.php';. . require_once DT_ROOT '/ the include / cache.func.php'; require_once DT_ROOT '/ the include / module.func.php';. . the require DT_ROOT '/ Module1 / Member /member.class.php '; the require DT_ROOT.' / Module1 / Sell / sell.class.php '; the require DT_ROOT.' /include/remote.class.php '; / *********** ***** configuration information gorgeous dividing line *************** / $ config = Array ( 'registered e-mail suffix' => 'qq.com ||| 126.com | || 163.com ', // plurality of divided by ||| 'Registered user name' => 'a_123456 c_123456 ||| ||| ||| b_123456 e_123456 d_123456 ||| ||| ||| f_123456 g_123456', * Get a list Industry Classification * / IF (isset (the GET $ _ [ 'the getList'])) { // release the user name, the user name want to act as a release put here, separated by |||, user names do not already exist in the system, if not automatically registered // format can not have the same system with Chinese characters, the user name should be lowercase letters (az), numbers (0-9), underscore (_), the dash (-) a combination of 'user password' => '', // new user password 'user password parameter' => 'jksdjfs', // user encryption parameters recommended free to modify the 'separator' => '|||', // tag collection cycle delimiter ); / ************* *** configuration information gorgeous dividing line *************** / / ** * password authentication interfaces * / $ PW = '123456'; // default password for the interface, this interface put when the server for your server security please change this password parameter IF (strcmp ($ _ GET [ 'pw'], $ pw)) { Exit ( 'interfaces wrong password!'); } / ** * / $ do = new new Member; echo category_select ( 'list', 'select Classification', 0,. 5); Exit; } // Die; / ** * registered enterprise user } the else { $ user = explode ($ config [ ' separator'], $ config [ 'registered username']); ! $ username = empty ($ _ POST [ 'username']) $ _POST [ 'username']: ''? ; IF (empty ($ username)) { $ $ = username User [RAND (0, COUNT ($ User) -1)] substr (MD5 (Time ()), 1,6);. } IF ($ DO- > username_exists ($ username)) { echo ( 'the user name already exists!'); } {the else IF ($ DO-> is_username ($ username!)) { Exit ( 'user name is not valid!'); } $ md5 = md5 ($ username $ config [ ' user encryption parameters'].); IF (empty ($ config [ 'user password'])!) { $ password = $ config [ 'user password'];])){ $mail_ext = '@126.com'; }else{ password = substr $ ($ MD5, 20 is); } IF (empty ($ config [ 'Register message suffix'])) { $ = mail_arr the explode ( '|||', $ config [ 'Register message suffix']); . $ mail_ext = '@' $ mail_arr [RAND (0, COUNT ($ mail_arr) -1)]; } ! $ In Email = empty ($ _ the POST [ 'In Email']) $ _POST [ 'In Email']: ''? ; IF (empty ($ In email)) { $ In email = substr ($ MD5, 0,. 6) $ mail_ext;. } (! $ DO-> is_email ($ In email)) {IF Exit ( 'invalid mailbox!') ; } IF ($ DO-> email_exists ($ In email)) { Exit ( 'the mailbox is already registered'); } !? $ Company = empty ($ _ the POST [ 'Company']) $ _POST [ 'Company']: ''; if(empty($company)) { $ company = 'Information Technology Co., Ltd. Hefei' .substr (MD5 (Time ()), 0,6); } IF (empty ($ Company)) { Exit ( 'non-empty company name!'); } IF (! $ DO-> is_company ($ Company)) Exit ( 'The company name is not valid!'); IF ($ DO-> company_exists ($ company)) Exit ( 'company name already exists, replace it!'); $ dsession the session = new new (); $ _SESSION [ 'regemail'] = MD5 (MD5 ($ In Email DT_KEY $ DT_IP)..); $ Member = Array (); $ _POST [ 'RegID'] =. 6; $ Data = $ _POST; $ Member [ 'Mobile'] = isset ($ Data ? [ 'Mobile']) $ Data [ 'Mobile']: ''; $ Member [ 'QQ'] = isset ($ Data [ 'QQ']) $ Data? [ 'QQ']: ''; $ Member [ 'groupId'] = $ Data [ 'RegID']; $ Member [ 'Passport'] = $member['username'] = $username; $member['email'] = $email; $member['password'] = $member['cpassword'] = $password; $member['edittime'] = $DT_TIME; $member['inviter'] = $username; $member['truename'] = !empty($data['truename']) ? $data['truename'] : $username; $member['gender'] = !empty($data['gender']) ? (strcmp($data['gender'],'男') ? 0: 1 ) : 1; $member['areaid'] = 1; $member['company'] = $company; $member['type'] = !empty($data['type']) ? $data['type'] : '企业单位'; $member['catid'] = ',3,'; $member['business'] = !empty($data['business']) ? $data['business'] : '制造业'; $member['business'] = '人民币'; $member['regyear'] = !empty($data['regyear '?]) $ the Data [' regyear ']:' 2010 '; $ Member [' address '!] = empty ($ the Data [' address '?]) $ the Data [' address ']:' The company address is empty '; !? Member $ [ 'Telephone'] = empty ($ Data [ 'Telephone']) Data $ [ 'Telephone']: '0551-62864156-606'; ! $ Member [ 'introduce'] = empty ($ Data [ 'introduce']) $ data [ 'introduce']:? ' my company after years of development, gradually become the industry leader in the development of enterprise'; $ MFD = cache_read ( 'Fields-member.php'); $ CFD = cache_read ( 'Fields-company.php'); isset ($ post_fields) or $ post_fields = Array (); IF ($ $ the MFD || the CFD) the require DT_ROOT '/include/fields.func.php';. IF ($ the MFD ) fields_check (post_fields $, $ the MFD); IF ($ the CFD) fields_check (post_fields $, $ the CFD); $ the MOD [ 'introduce_length'] = 0; $ UID $ = DO-> the Add ($ Member); IF ($ uid) { echo 'businesses registered successfully! '; //echo category_select('category[parentid]', '请选择行业分类', 0, 5); if(!empty($_POST['cid'])){ $pid = $_POST['cid']; } if(!empty($_POST['catname'])) { $do = new category(5,0); $table = $DT_PRE . 'category'; $cat_arr = $_POST['catname']; $catArr = explode('|||', $cat_arr); $pid = 0; foreach($catArr as $catname) { if (!$catname) exit('分类名不能为空'); isset($catname) or $catname = ''; if (!$catname || strpos($catname, "\n") !== false) exit(''); IF ( strtoupper (DT_CHARSET)! = 'UTF-8') $catname = convert($catname, 'UTF-8', DT_CHARSET); $catdir = $do->get_letter($catname, false); if ($do->getcatdir ($ deliver)) { $ catgory = array (); $ catgory [ 'the catname'] = $ the catname; $ catgory [ 'catdir'] = $ catdir; $ catgory [ 'Letter'] = substr ($ catdir, 0,. 1); $ catgory [ 'parentId'] = $ PID ; $ pid = categoryAdd ($ catgory, $ the Table); . echo $ catname 'classified Add this industry success! '; } The else { $ catList ARR = (); the foreach (Key $ $ ARR AS) { IF (strcmp (Key $ [' the catname '], $ the catname) == 0) { $ PID = Key $ [' CATID ' ]; BREAK; } } echo 'already exists in this Category! '; /** * 图片上传处理 */ if(!empty($_POST['remotePic'])) { $remotePic = explode('|||', $_POST['remotePic']); $num = count($remotePic); $remoteUrl = array(); if ($num > 0) { $i = 0; for ($i; $i < $num; $i++) { $remote = isset($remotePic[$i]) ? trim($remotePic[$i]) : ''; $uploaddir = 'file/upload/' . timetodate($DT_TIME, $DT['uploaddir']) . '/'; $from = 'album'; is_dir(DT_ROOT . '/' . $uploaddir) or dir_create(DT_ROOT . '/' . $uploaddir); if ($remote && strlen($remote) > 17 && strpos($remote, '://') !== false) { $do = new remote($remote, $uploaddir); if ($do->save()) { $session = new dsession(); $limit = intval($MG['uploadlimit']); $total = isset($_SESSION['uploads']) ? count($_SESSION['uploads']) : 0; if ($limit && $total > $limit - 1) { file_del(DT_ROOT . '/' . $do->saveto); $errmsg = 'Error(5)' . lang('message->upload_limit', array($limit)); if ($swfupload) exit(convert($errmsg, DT_CHARSET, 'utf-8')); dalert($errmsg, '', $errjs); } $img_info = @getimagesize(DT_ROOT . '/' . $do->saveto); if (in_array($do->ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp', 'swf'))) { $upload_bad = 0; if ($img_info) { $upload_mime = array('jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'swf' => 'application/x-shockwave-flash'); if ($img_info['mime'] != $upload_mime[$do->ext]) $upload_bad = 1; } else { $upload_bad = 1; } if ($upload_bad) { file_del(DT_ROOT . '/' . $do->saveto); $errmsg = 'Error(6)' . lang('message->upload_bad'); if ($swfupload) exit(convert($errmsg, DT_CHARSET, 'utf-8')); dalert($errmsg, '', $errjs); } } if (in_array($do->ext, array('jpg', 'jpeg')) && $img_info['channels'] == 4) { file_del(DT_ROOT . '/' . $do->saveto); $errmsg = 'Error(7)' . lang('message->upload_cmyk'); if ($swfupload) exit(convert($errmsg, DT_CHARSET, 'utf-8')); dalert($errmsg, '', $errjs); } $img_w = $img_h = 0; if ($do->image) { require DT_ROOT . '/include/image.class.php'; if ($do->ext == 'gif' && in_array($from, array('thumb', 'album', 'photo'))) { if (!function_exists('imagegif') || !function_exists('imagecreatefromgif')) { file_del(DT_ROOT . '/' . $do->saveto); $errmsg = 'Error(8)' . lang('message->upload_jpg'); if ($swfupload) exit(convert($errmsg, DT_CHARSET, 'utf-8')); dalert($errmsg, '', $errjs); } } if ($DT['bmp_jpg'] && $do->ext == 'bmp') { require DT_ROOT . '/include/bmp.func.php'; $bmp_src = DT_ROOT . '/' . $do->saveto; $bmp = imagecreatefrombmp($bmp_src); if ($bmp) { $do->saveto = str_replace('.bmp', '.jpg', $do->saveto); $do->ext = 'jpg'; imagejpeg($bmp, DT_ROOT . '/' . $do->saveto); file_del($bmp_src); if (DT_CHMOD) @chmod(DT_ROOT . '/' . $do->saveto, DT_CHMOD); } } $img_w = $img_info[0]; $img_h = $img_info[1]; if ($DT['max_image'] && in_array($from, array('editor', 'album', 'photo'))) { if ($img_w > $DT['max_image']) { $img_h = intval($DT['max_image'] * $img_h / $img_w); $img_w = $DT['max_image']; $image = new image(DT_ROOT . '/' . $do->saveto); $image->thumb($img_w, $img_h); } } if ($from == 'thumb') { if ($width && $height) { $image = new image(DT_ROOT . '/' . $do->saveto); $image->thumb($width, $height, $DT['thumb_title']); $img_w = $width; $img_h = $height; $do->file_size = filesize(DT_ROOT . '/' . $do->saveto); } } else if ($from == 'album' || $from == 'photo') { $saveto = $do->saveto; $do->saveto = $do->saveto . '.thumb.' . $do->ext; file_copy(DT_ROOT . '/' . $saveto, DT_ROOT . '/' . $do->saveto); $middle = $saveto . '.middle.' . $do->ext; file_copy(DT_ROOT . '/' . $saveto, DT_ROOT . '/' . $middle); if ($DT['water_type'] == 2) { $image = new image(DT_ROOT . '/' . $saveto); $image->waterimage(); } else if ($DT['water_type'] == 1) { $image = new image(DT_ROOT . '/' . $saveto); $image->watertext(); } if ($DT['water_type'] && $DT['water_com'] && $_groupid > 5) { $image = new image(DT_ROOT . '/' . $saveto); $image->text = $_company; $image->pos = 5; $image->watertext(); } if ($from == 'photo') $DT['thumb_album'] = 0; $image = new image(DT_ROOT . '/' . $do->saveto); $image->thumb($width, $height, $DT['thumb_album']); $image = new image(DT_ROOT . '/' . $middle); $image->thumb($DT['middle_w'], $DT['middle_h'], $DT['thumb_album']); if ($DT['water_middle'] && $DT['water_type']) { if ($DT['water_type'] == 2) { $image = new image(DT_ROOT . '/' . $middle); $image->waterimage(); } else if ($DT['water_type'] == 1) { $image = new image(DT_ROOT . '/' . $middle); $image->watertext(); } } } else if ($from == 'editor') { if ($_groupid == 1 && !isset($watermark)) $DT['water_type'] = 0; if ($DT['water_type']) { $image = new image(DT_ROOT . '/' . $do->saveto); if ($DT['water_type'] == 2) { Image- $> waterimage (); $ POST [ 'typeid'] = empty ($ _ POST [ 'typeid']) $ _POST [ 'typeid']:!? 0; } else if ($DT['water_type'] == 1) { Image- $> watertext (); } } } } $ remoteUrl [$ I] = linkURL ($ DO-> saveto); echo 'Picture success! '; } } } } } // print_r ($ remoteUrl); // Die; / ** ***** Picture end / / ** * Post offer processing * / $ do = new new Sell (5); $ POST [ 'catid'] = $ pid; $ POST [ 'Level'] = 1; $ POST [ 'title'] = empty ($ _ POST [ 'title']) $ _POST [ 'title']:!? ' supply test title '; $post['brand'] = !empty($_POST['brand']) ? $_POST['brand'] : ''; $post['content'] = !empty($_POST['content']) ? $_POST['content'] : ''; $post['thumb'] = isset($remoteUrl[0]) ? $remoteUrl[0] : ''; $post['thumb1'] = isset($remoteUrl[1]) ? $remoteUrl[1] : ''; $post['thumb2'] = isset($remoteUrl[2]) ? $remoteUrl[2] : ''; $post['totime'] = '';//过期时间 $post['n1'] = !empty($_POST['n1']) ? $_POST['n1'] : ''; $post['v1'] = !empty($_POST['n1']) && !empty($_POST['v1']) ? $_POST['v1'] : ''; $post['n2'] = !empty($_POST['n2']) ? $_POST['n2'] : ''; $post['v2'] = !empty($_POST['n2']) && !empty($_POST['v2']) ? $_POST['v2'] : ''; $post['n3'] = !empty($_POST['n3']) ? $_POST['n3'] : ''; $post['v3'] = !empty($_POST['n3']) && !empty($_POST['v3']) ? $_POST['v3'] : ''; $post['username'] = $username; $post['elite'] = !empty($_POST['elite']) ? $_POST['elite'] : 1; $post['fee'] = !empty($_POST['fee']) ? (is_numeric($_POST['fee'])? $_POST['fee'] :0) : 0; $post['unit'] = !empty($_POST['unit']) ? $_POST['unit'] : ''; if(!empty($_POST['unit'])){ $post['price'] = !empty($_POST['price']) ? $_POST['price'] : ''; $post['minamount'] = !empty($_POST['minamount']) ? $_POST['minamount'] : ''; $post['amount'] = !empty($_POST['amount']) ? $_POST['amount'] : ''; $post['days'] = !empty($_POST['days']) ? $_POST['days'] : ''; } $post['status'] = 3; POST $ [ 'AddTime'] = DATE ( 'Ymd H: I: S', Time ()); class category { if($do->pass($post)) { $do->table = $DT_PRE . 'sell_5'; DO- $> = moduleId. 5; $ DO-> = $ DT_PRE table_search 'sell_search_5';. $ the MOD [ 'Split'] =. 1; $ DO-> the Add ($ POST); $ Update = ''; $ Update. = "= Hits '2'"; $ linkURL = 'show.php itemid =?' "$ DO-> itemid";. $ = Update ", linkURL = '$ linkURL'";. $ DO-> db-> Query (. "{$ the UPDATE DO-> Table the SET}" $ Update "the WHERE ItemID = $ DO-> ItemID."); IF ($ DO-> ItemID) { Exit ( 'offer successfully posted!'); } {the else Exit ( 'supply information distribution failure. 1!'); } } {the else Exit ( 'Post supply failure!'); } /** * Class category */ var $moduleid; var $catid; var $category = array(); var $db; var $table; function category($moduleid = 1, $catid = 0) { global $db, $DT_PRE, $CATEGORY; $this->moduleid = $moduleid; $this->catid = $catid; if(!isset($CATEGORY)) $CATEGORY = cache_read('category-'.$this->moduleid.'.php'); $this->category = $CATEGORY; $this->table = $DT_PRE.'category'; $this->db = &$db; } function add($category) { $category['moduleid'] = 5; $category['letter'] = preg_match("/^[a-z]{1}+$/i", $category['letter']) ? strtolower($category['letter']) : ''; $category['group_list'] = '3,5,6,7'; $category['group_show'] = '3,5,6,7'; } else { $catdir = $category['catdir'] ? $category['catdir'] : $this->catid; $this->db->query("UPDATE {$this->table} SET listorder=$this->catid,catdir='$catdir',arrparentid='$arrparentid' WHERE catid=$this->catid"); return $this->catid; } function edit($category) { $category['letter'] = preg_match("/^[a-z]{1}+$/i", $category['letter']) ? strtolower($category['letter']) : ''; if($category['parentid']) { $category['catid'] = $this->catid; $this->category[$this->catid] = $category; $category['arrparentid'] = $this->get_arrparentid($this->catid, $this->category); } else { $category['arrparentid'] = 0; } foreach(array('group_list', 'group_show', 'group_add') as $v) { $category[$v] = isset($category[$v]) ? implode(',', $category[$v]) : ''; } $category['linkurl'] = ''; $sql = ''; foreach($category as $k=>$v) { $sql .= ",$k='$v'"; } $sql = substr($sql, 1); $this->db->query("UPDATE {$this->table} SET $sql WHERE catid=$this->catid"); return true; } function delete($catids) { if(is_array($catids)) { foreach($catids as $catid) { if(isset($this->category[$catid])) $this->delete($catid); } } else { $catid = $catids; if(isset($this->category[$catid])) { $this->db->query("DELETE FROM {$this->table} WHERE catid=$catid"); $arrchildid = $this->category[$catid]['arrchildid'] ? $this->category[$catid]['arrchildid'] : $catid; $this->db->query("DELETE FROM {$this->table} WHERE catid IN ($arrchildid)"); if($this->moduleid > 4) $this->db->query("UPDATE ".get_table($this->moduleid)." SET status=0 WHERE catid IN (".$arrchildid.")"); } } return true; } function update($category) { if(!is_array($category)) return false; foreach($category as $k=>$v) { if(!$v['catname']) continue; $v['parentid'] = intval($v['parentid']); if($k == $v['parentid']) continue; if($v['parentid'] > 0 && !isset($this->category[$v['parentid']])) continue; $v['listorder'] = intval($v['listorder']); $v['level'] = intval($v['level']); $v['letter'] = preg_match("/^[a-z0-9]{1}+$/i", $v['letter']) ? strtolower($v['letter']) : ''; $v['catdir'] = $this->get_catdir($v['catdir'], $k); if(!$v['catdir']) $v['deliver '] = $ k; $this->db->query("UPDATE {$this->table} SET catname='$v[catname]',parentid='$v[parentid]',listorder='$v[listorder]',style='$v[style]',level='$v[level]',letter='$v[letter]',catdir='$v[catdir]' WHERE catid=$k "); } return true; } function repair() { $query = $this->db->query("SELECT * FROM {$this->table} WHERE moduleid='$this->moduleid' ORDER BY listorder,catid"); $CATEGORY = array(); while($r = $this->db->fetch_array($query)) { $CATEGORY[$r['catid']] = $r; } $childs = array(); foreach($CATEGORY as $catid => $category) { $CATEGORY[$catid]['arrparentid'] = $arrparentid = $this->get_arrparentid($catid, $CATEGORY); $CATEGORY[$catid]['catdir'] = $catdir = preg_match("/^[0-9a-z_\-\/]+$/i", $category['catdir']) ? $category['catdir'] : $catid; $sql = "catdir='$ Deliver ', arrparentid =' $ arrparentid ' "; if(!$category['linkurl']) { $CATEGORY[$catid]['linkurl'] = listurl($category); $sql .= ",linkurl='$category[linkurl]'"; } $this->db->query("UPDATE {$this->table} SET $sql WHERE catid=$catid"); if($arrparentid) { $arr = explode(',', $arrparentid); foreach($arr as $a) { if($a == 0) continue; isset($childs[$a]) or $childs[$a] = ''; $childs[$a] .= ','.$catid; } } } foreach($CATEGORY as $catid => $category) { if(isset($childs[$catid])) { $CATEGORY[$catid]['arrchildid'] = $arrchildid = $catid.$childs[$catid]; $CATEGORY[$catid]['child'] = 1; $this->db->query("UPDATE {$this->table} SET arrchildid='$arrchildid',child=1 WHERE catid='$catid'"); } else { $CATEGORY[$catid]['arrchildid'] = $catid; $CATEGORY[$catid]['child'] = 0; $this->db->query("UPDATE {$this->table} SET arrchildid='$catid',child=0 WHERE catid='$catid'"); } } $this->cache($CATEGORY); return true; } function get_arrparentid($catid, $CATEGORY) { if($CATEGORY[$catid]['parentid'] && $CATEGORY[$catid]['parentid'] != $catid) { $parents = array(); $cid = $catid; while($catid) { if($CATEGORY[$cid]['parentid']) { $parents[] = $cid = $CATEGORY[$cid]['parentid']; } else { break; } } $parents[] = 0; return implode(',', array_reverse($parents)); } else { return '0'; } } function get_arrchildid($catid, $CATEGORY) { $arrchildid = ''; foreach($CATEGORY as $category) { return ''; } } function get_letter($catname, $letter = true) { return $letter ? strtolower(substr(gb2py($catname), 0, 1)) : str_replace(' ', '', gb2py($catname)); } function cache($data = array()) { cache_category($this->moduleid, $data); } } function categoryAdd($category = array(),$table){ require 'common.inc.php'; global $db; $CATEGORY = cache_read('category-5.php'); $do = new category(5,0); if(!$category['catname']) msg('分类名不能为空'); $category['catname'] = trim($category['catname']); $childs = ''; $catids = array(); if(strpos($category['catname'], "\n") === false) { $category['catdir'] = $do->get_catdir($category['catdir']); $do->add($category); $childs .= ','.$do->catid; $catids[] = $do->catid; } else { $catnames = explode("\n", $category['catname']); foreach($catnames as $catname) { $catname = trim($catname); if(!$catname) continue; $category['catname'] = $catname; $category['catdir'] = ''; $category['letter'] = ''; $category['seo_title'] = ''; $category['seo_keywords'] = ''; $category['seo_description'] = ''; $do->add($category); $childs .= ','.$do->catid; $catids[] = $do->catid; } } if($category['parentid']) { $parents = array(); $cid = $category['parentid']; $parents[] = $cid; while(1) { if($CATEGORY[$cid]['parentid']) { $parents[] = $cid = $CATEGORY[$cid]['parentid']; } else { break; } } foreach($parents as $catid) { $arrchildid = $CATEGORY[$catid]['child'] ? $CATEGORY[$catid]['arrchildid'].$childs : $catid.$childs; $db->query("UPDATE {$table} SET child=1,arrchildid='$arrchildid' WHERE catid=$catid"); } } foreach($catids as $catid) { $CATEGORY[$catid] = $db->get_one("SELECT * FROM {$table} WHERE catid=$catid"); update_category($CATEGORY[$catid]); } return $do->catid; } function catList(){ global $db; $condition ="moduleid=5"; $result = $db->query("SELECT catid,catname,parentid FROM {$db->pre}category WHERE $condition ORDER BY listorder,catid ASC"); $arr = array(); $i = 0; while($c = $db->fetch_array($result)) { $arr[$i++] = $c; } return $arr; }