Ejemplo n.º 1
0
function WriteMenu($siteid, $siteurl, $sitetarget, $a, $Display, $AdminDisplay)
{
    $DbLink2 = new DB();
    $DbLink2->query("SELECT id,url,target FROM " . C_PAGE_TBL . " Where parent = '" . cleanQuery($siteid) . "' and active='1' and ((display='{$Display}') or (display='2') " . $AdminDisplay . ") ORDER BY rank ASC ");
    if ($siteurl != "") {
        if ($sitetarget == '_self') {
            if ($_GET[btn] == $siteid) {
                echo "<li><a href=\"#\"><span>{$a[$siteid]}</span></a>";
                if ($DbLink2->num_rows() > 0) {
                    echo "<ul>";
                    while (list($siteid2, $siteurl2, $sitetarget2) = $DbLink2->next_record()) {
                        WriteMenu($siteid2, $siteurl2, $sitetarget2, $a, $Display, $AdminDisplay);
                    }
                    echo "</ul>";
                }
                echo "</li>";
            } else {
                echo "<li><a href=\"{$siteurl}&btn={$siteid}\"><span>{$a[$siteid]}</span></a>";
                if ($DbLink2->num_rows() > 0) {
                    echo "<ul>";
                    while (list($siteid2, $siteurl2, $sitetarget2) = $DbLink2->next_record()) {
                        WriteMenu($siteid2, $siteurl2, $sitetarget2, $a, $Display, $AdminDisplay);
                    }
                    echo "</ul>";
                }
                echo "</li>";
            }
        } else {
            if ($sitetarget == '_external') {
                echo "<li><a href=\"{$siteurl}\"><span>{$a[$siteid]}</span></a>";
                if ($DbLink2->num_rows() > 0) {
                    echo "<ul>";
                    while (list($siteid2, $siteurl2, $sitetarget2) = $DbLink2->next_record()) {
                        WriteMenu($siteid2, $siteurl2, $sitetarget2, $a, $Display, $AdminDisplay);
                    }
                    echo "</ul>";
                }
                echo "</li>";
            } else {
                echo "<li><a href=\"#\" onclick=\"window.open('{$siteurl}','mywindow','')\"><span>{$a[$siteid]}</span></a>";
                if ($DbLink2->num_rows() > 0) {
                    echo "<ul>";
                    while (list($siteid2, $siteurl2, $sitetarget2) = $DbLink2->next_record()) {
                        WriteMenu($siteid2, $siteurl2, $sitetarget2, $a, $Display, $AdminDisplay);
                    }
                    echo "</ul>";
                }
                echo "</li>";
            }
        }
    } else {
        echo "<li><a href=\\index.php?&page=smodul&id={$siteid}&btn={$siteid}\"><span>{$a[$siteid]}</span></a></li>";
    }
}
Ejemplo n.º 2
0
function my_member_validate($uid, $email, $role_id = '', $new = 0, $check_allow = 1)
{
    if (1 > ($uid = (int) $uid)) {
        return false;
    }
    if (!($email = trim($email))) {
        return false;
    }
    $sys_config = jconf::get();
    if ($new == 0 && !$sys_config['reg_email_verify']) {
        return false;
    }
    if ($check_allow && jdisallow($uid)) {
        return false;
    }
    $sql = "select * from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}' order by `regdate` asc";
    $query = DB::query($sql);
    $data = array();
    if (DB::num_rows($query) > 0) {
        DB::query("delete from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}'");
    }
    $data['uid'] = $uid;
    $data['email'] = $email;
    $data['role_id'] = (int) ($role_id > 0 ? $role_id : $sys_config['normal_default_role_id']);
    $data['key'] = substr(md5(md5($uid . $email . $role_id) . md5(uniqid(mt_rand(), true))), 3, 16);
    $data['status'] = $data['verify_time'] = '0';
    $data['regdate'] = TIMESTAMP;
    $data['type'] = 'email';
    jtable('member_validate')->insert($data);
    $email_message = "您好:\r\n您收到此邮件是因为在 {$sys_config['site_url']} 用户注册中使用了该 Email,\r\n如果您没有进行上述操作,请忽略这封邮件。\r\n------------------------------------------------------\r\n帐号激活说明:\r\n为避免垃圾邮件或您的Email地址被滥用,我们需要对您的email有效性进行验证,\r\n您只需点击下面的链接即可激活您的帐号,并享有真正会员权限:\r\n{$sys_config['site_url']}/index.php?mod=member&code=verify&uid={$data['uid']}&key={$data['key']}&from=reg\r\n\r\n(如果上面不是链接形式,请将地址手工粘贴到浏览器地址栏再访问)\r\n感谢您的访问,祝您使用愉快!\r\n\r\n此致,\r\n{$sys_config['site_name']} 管理团队.\r\n";
    $send_result = send_mail($email, " [{$sys_config['site_name']}]Email地址验证", $email_message, $sys_config['site_name'], $sys_config['site_admin_email'], array(), 3, false);
    return $send_result;
}
Ejemplo n.º 3
0
 function piclens_gallery()
 {
     $item_id = EClassApi::getParam('item_id');
     $entry = '';
     if ($item_id) {
         $sql = 'select id, original_image_url, title, position from item_image where item_id = ' . intval($item_id) . ' ORDER BY position ';
         DB::query($sql);
         if (DB::num_rows()) {
             $entry = '';
             while ($rows = DB::fetch_row()) {
                 $rows['title'] = $rows['title'] ? $rows['title'] : "Image {$rows['position']}";
                 $rows['title'] = trim(XMLLib::_xml_encode_attribute($rows['title']));
                 if (ereg('/', $rows['original_image_url'])) {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['original_image_url']}"));
                 } else {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['original_image_url']}"));
                 }
                 $entry .= "\n\t\t \t \t<item>\n\t\t \t \t\t\t<title>" . stripslashes($rows['title']) . "</title>\n\t\t\t\t\t\t<link>{$url}</link>\n\t\t\t\t\t\t<guid>Image {$rows['position']}</guid>\n\t\t\t\t\t\t<media:thumbnail url=\"{$url}\" />\n\t\t\t\t\t\t<media:content url=\"{$url}\" />\n\t\t\t\t</item>\n\t\t \t \t";
             }
             @header("Content-type: text/xml");
             echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\t\t\t <rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">\n\t\t\t <channel>\t\t\t\n\t\t\t <title>Enbac.com</title>\n\t\t\t <link>http://www.chonmon.vn/</link>\n\t\t\t <description>Enbac.com - </description>\n\t\t\t <logo url=\"style/images/logo.piclens.png\" />\n\t\t\t";
             echo $entry;
             echo "\n\t\t \t </channel>\n\t\t\t </rss>\n\t\t\t";
         } else {
             die("no_info");
         }
     } else {
         die("no_info");
     }
 }
Ejemplo n.º 4
0
    public function update($id, $name, $teacherId, $year, $month, $imgFileName, $videoFileName, $content, $uploadTime) {
        $query = DB::query('select * from '.DB::table('book_video').' where year='.$year.' and month='.$month.' and id <> '.$id);
        if(DB::num_rows($query) > 0) {
            return "视频信息修改失败,存在".$year."年".$month."月的视频!";
        } else {
            //当前时间
            $time = date("Y-m-d H:i:s");
            DB::update( $this->_table,
                array(
                    'name' => $name,
                    'teacherId' => $teacherId,
                    'year' => $year,
                    'month' => $month,
                    'imgFileName' => $imgFileName,
                    'videoFileName' => $videoFileName,
                    'content' => $content,
                    'uploadTime' => $uploadTime,
                    'updateTime' => $time

                ),
                array('id'=> $id)
            );
            return "视频信息修改成功!";
        }
    }
Ejemplo n.º 5
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`skey` varchar(255) NOT NULL default '',\n\t\t\t`svalue` text NOT NULL,\n\t\t\tPRIMARY KEY  (`skey`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         if (DB::num_rows($query)) {
             DB::query('DROP TABLE ' . DB::table($this->_table));
         }
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 6
0
 function flash_view_gallery()
 {
     $user_id = (int) Url::get('user_id');
     if ($user_id) {
         $sql = 'select id, original_image_url, des FROM item_image WHERE user_id = ' . $user_id . ' AND root_id=0 ORDER BY id DESC LIMIT 0,200';
         DB::query($sql);
         if (DB::num_rows()) {
             $entry = '';
             while ($rows = DB::fetch_row()) {
                 $rows['des'] = $rows['des'] ? $rows['des'] : "Image {$rows['id']}";
                 $rows['des'] = trim(XMLLib::_xml_encode_attribute($rows['des']));
                 if (eregi('/', $rows['original_image_url'])) {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['original_image_url']}"));
                 } else {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['original_image_url']}"));
                 }
                 $entry .= "\n\t\t\t\t\t\t\t<photo imageurl=\"{$url}\" linkurl=\"http://chonmon.vn\">\n\t\t\t\t\t\t\t\t<title>{$rows['des']}</title>\n\t\t\t\t\t\t\t</photo>\t\t \t \t\n\t\t\t\t \t \t";
             }
             @header("Content-type: text/xml");
             echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?" . '>';
             echo "<tiltviewergallery><photos>";
             echo $entry;
             echo "</photos></tiltviewergallery>";
         } else {
             die("no_info");
         }
     } else {
         die("no_info");
     }
 }
Ejemplo n.º 7
0
 public function update($id, $name, $code) {
     $query = DB::query('select * from '.DB::table('book_college').' where (name=\''.$name.'\' or code=\''.$code.'\') and id<>'.$id);
     if(DB::num_rows($query) > 0) {
         return "学院修改失败,存在同名或者同代号的学院!";
     } else {
         DB::update($this->_table, array('name'=>$name,'code'=>$code), array('id'=> $id));
         return "学院修改成功!";
     }
 }
Ejemplo n.º 8
0
function build_cache_smilies_js()
{
    global $_G;
    $query = DB::query("SELECT typeid, name, directory FROM " . DB::table('forum_imagetype') . " WHERE type='smiley' AND available='1' ORDER BY displayorder");
    $fastsmiley = (array) unserialize(DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='fastsmiley'"));
    $return_type = 'var smilies_type = new Array();';
    $return_array = 'var smilies_array = new Array();var smilies_fast = new Array();';
    $spp = $_G['setting']['smcols'] * $_G['setting']['smrows'];
    $fpre = '';
    while ($type = DB::fetch($query)) {
        $return_data = array();
        $return_datakey = '';
        $squery = DB::query("SELECT id, code, url FROM " . DB::table('common_smiley') . " WHERE type='smiley' AND code<>'' AND typeid='{$type['typeid']}' ORDER BY displayorder");
        if (DB::num_rows($squery)) {
            $i = 0;
            $j = 1;
            $pre = '';
            $return_type .= 'smilies_type[\'_' . $type['typeid'] . '\'] = [\'' . str_replace('\'', '\\\'', $type['name']) . '\', \'' . str_replace('\'', '\\\'', $type['directory']) . '\'];';
            $return_datakey .= 'smilies_array[' . $type['typeid'] . '] = new Array();';
            while ($smiley = DB::fetch($squery)) {
                if ($i >= $spp) {
                    $return_data[$j] = 'smilies_array[' . $type['typeid'] . '][' . $j . '] = [' . $return_data[$j] . '];';
                    $j++;
                    $i = 0;
                    $pre = '';
                }
                if ($size = @getimagesize(DISCUZ_ROOT . './static/image/smiley/' . $type['directory'] . '/' . $smiley['url'])) {
                    $smiley['code'] = str_replace('\'', '\\\'', $smiley['code']);
                    $smileyid = $smiley['id'];
                    $s = smthumb($size, $_G['setting']['smthumb']);
                    $smiley['w'] = $s['w'];
                    $smiley['h'] = $s['h'];
                    $l = smthumb($size);
                    $smiley['lw'] = $l['w'];
                    unset($smiley['id'], $smiley['directory']);
                    $return_data[$j] .= $pre . '[\'' . $smileyid . '\', \'' . $smiley['code'] . '\',\'' . str_replace('\'', '\\\'', $smiley['url']) . '\',\'' . $smiley['w'] . '\',\'' . $smiley['h'] . '\',\'' . $smiley['lw'] . '\']';
                    if (is_array($fastsmiley[$type['typeid']]) && in_array($smileyid, $fastsmiley[$type['typeid']])) {
                        $return_fast .= $fpre . '[\'' . $type['typeid'] . '\',\'' . $j . '\',\'' . $i . '\']';
                        $fpre = ',';
                    }
                    $pre = ',';
                }
                $i++;
            }
            $return_data[$j] = 'smilies_array[' . $type['typeid'] . '][' . $j . '] = [' . $return_data[$j] . '];';
        }
        $return_array .= $return_datakey . implode('', $return_data);
    }
    $cachedir = DISCUZ_ROOT . './data/cache/';
    if (@($fp = fopen($cachedir . 'common_smilies_var.js', 'w'))) {
        fwrite($fp, 'var smthumb = \'' . $_G['setting']['smthumb'] . '\';' . $return_type . $return_array . 'var smilies_fast=[' . $return_fast . '];');
        fclose($fp);
    } else {
        exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .');
    }
}
 public function fetch_list_by_search($condition, $orders = '', $type = 0, $start = 0, $limit = 0)
 {
     if ($type == 1) {
         $result = DB::fetch_all("SELECT * FROM %t WHERE 1%i {$orders} LIMIT {$start},{$limit}", array($this->_table, $condition));
     } else {
         $n = DB::query("SELECT * FROM " . DB::table($this->_table) . " WHERE 1{$condition} {$orders}");
         $result = DB::num_rows($n);
     }
     return $result;
 }
Ejemplo n.º 10
0
function getmagic($magicid, $magicnum, $weight, $totalweight, $uid, $maxmagicsweight, $force = 0)
{
    if ($weight + $totalweight > $maxmagicsweight && !$force) {
        showmessage('magics_weight_range_invalid', '', array('less' => $weight + $totalweight - $maxmagicsweight));
    } else {
        $query = DB::query("SELECT magicid FROM " . DB::table('common_member_magic') . " WHERE uid='{$uid}' AND magicid='{$magicid}'");
        if (DB::num_rows($query)) {
            DB::query("UPDATE " . DB::table('common_member_magic') . " SET num=num+'{$magicnum}' WHERE uid='{$uid}' AND magicid='{$magicid}'");
        } else {
            DB::query("INSERT INTO " . DB::table('common_member_magic') . " (uid, magicid, num) VALUES ('{$uid}', '{$magicid}', '{$magicnum}')");
        }
    }
}
Ejemplo n.º 11
0
 public function create($sortid, $fields, $dbcharset)
 {
     if (!$sortid || !$fields || !$dbcharset) {
         return;
     }
     $sortid = intval($sortid);
     $this->_table = 'forum_optionvalue' . $sortid;
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $dbcharset);
         DB::query($create_table_sql);
     }
 }
Ejemplo n.º 12
0
function build_cache_smileycodes()
{
    $data = array();
    $query = DB::query("SELECT typeid, directory FROM " . DB::table('forum_imagetype') . " WHERE type='smiley' AND available='1' ORDER BY displayorder");
    while ($type = DB::fetch($query)) {
        $squery = DB::query("SELECT id, code, url FROM " . DB::table('common_smiley') . " WHERE type='smiley' AND code<>'' AND typeid='{$type['typeid']}' ORDER BY displayorder");
        if (DB::num_rows($squery)) {
            while ($smiley = DB::fetch($squery)) {
                if ($size = @getimagesize('./static/image/smiley/' . $type['directory'] . '/' . $smiley['url'])) {
                    $data[$smiley['id']] = $smiley['code'];
                }
            }
        }
    }
    save_syscache('smileycodes', $data);
}
Ejemplo n.º 13
0
function build_cache_ipbanned()
{
    DB::query("DELETE FROM " . DB::table('common_banned') . " WHERE expiration<'" . TIMESTAMP . "'");
    $data = array();
    $query = DB::query("SELECT ip1, ip2, ip3, ip4, expiration FROM " . DB::table('common_banned'));
    if (DB::num_rows($query)) {
        $data['expiration'] = 0;
        $data['regexp'] = $separator = '';
    }
    while ($banned = DB::fetch($query)) {
        $data['expiration'] = !$data['expiration'] || $banned['expiration'] < $data['expiration'] ? $banned['expiration'] : $data['expiration'];
        $data['regexp'] .= $separator . ($banned['ip1'] == '-1' ? '\\d+\\.' : $banned['ip1'] . '\\.') . ($banned['ip2'] == '-1' ? '\\d+\\.' : $banned['ip2'] . '\\.') . ($banned['ip3'] == '-1' ? '\\d+\\.' : $banned['ip3'] . '\\.') . ($banned['ip4'] == '-1' ? '\\d+' : $banned['ip4']);
        $separator = '|';
    }
    save_syscache('ipbanned', $data);
}
Ejemplo n.º 14
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`cardcatid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`cardcatname` char(50) character set gbk NOT NULL,\n\t\t\t`cardcatdescription` text character set gbk NOT NULL,\n\t\t\t`cardjine` int(10) unsigned NOT NULL,\n\t\t\t`cardpice` int(10) unsigned NOT NULL,\n\t\t\t`cardyouxiaoqi` int(10) unsigned NOT NULL,\n\t\t\t`carddzyouxiaoqi` char(10) character set gbk NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`cardcatico` varchar(255) character set gbk NOT NULL,\n\t\t\t`cardkaishi` int(10) unsigned NOT NULL,\n\t\t\t`cardtype` char(20) character set gbk NOT NULL,\n\t\t\t`cardjifen` int(10) NOT NULL,\n\t\t\t`cardqingling` varchar(255) character set gbk NOT NULL,\n\t\t\t`shopid` mediumint(8) NOT NULL,\n\t\t\tPRIMARY KEY  (`cardcatid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Ejemplo n.º 15
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`yktbindid` smallint(6) NOT NULL,\n\t\t\tPRIMARY KEY  (`yktbindid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Ejemplo n.º 16
0
 function sqldumptable($table, $startfrom = 0, $currsize = 0)
 {
     //备分当前表的所有数据
     global $_G, $startrow;
     $offset = 10000;
     $size = 1024;
     $tabledump = '';
     $tablefields = array();
     $query = DB::query("SHOW FULL COLUMNS FROM {$table}", 'SILENT');
     while ($fieldrow = DB::fetch($query)) {
         $tablefields[] = $fieldrow;
     }
     $tabledumped = 0;
     $numrows = $offset;
     $firstfield = $tablefields[0];
     while ($currsize + strlen($tabledump) + 500 < $size * 1000 && $numrows == $offset) {
         //$selectsql = "SELECT * FROM $table WHERE $firstfield[Field] > $startfrom ORDER BY $firstfield[Field] LIMIT $offset"; //主键大于0
         $selectsql = "SELECT * FROM {$table} ORDER BY {$firstfield['Field']} LIMIT {$offset}";
         $tabledumped = 1;
         $rows = DB::query($selectsql);
         $numfields = $this->db->num_fields($rows);
         $numrows = DB::num_rows($rows);
         while ($row = $this->db->fetch_row($rows)) {
             $comma = $t = '';
             for ($i = 0; $i < $numfields; $i++) {
                 $t .= '\'' . mysql_escape_string($row[$i]) . '\',';
                 $comma = ',';
             }
             $t = trim($t, ',');
             if (strlen($t) + $currsize + strlen($tabledump) + 500 < $size * 1000) {
                 if ($firstfield['Extra'] == 'auto_increment') {
                     $startfrom = $row[0];
                 } else {
                     $startfrom++;
                 }
                 $tabledump .= "INSERT INTO {$table} VALUES ({$t});\n";
             } else {
                 $complete = FALSE;
                 break 2;
             }
         }
     }
     $startrow = $startfrom;
     $tabledump .= "\n";
     return $tabledump;
 }
Ejemplo n.º 17
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`cardnoid` mediumint(8) unsigned NOT NULL auto_increment,\n\t\t\t`cardcatid` smallint(3) NOT NULL,\n\t\t\t`cardpici` smallint(3) NOT NULL,\n\t\t\t`cardno` char(20) character set gbk NOT NULL,\n\t\t\t`cardpass` char(32) character set gbk NOT NULL,\n\t\t\t`cardtype` tinyint(1) NOT NULL,\n\t\t\t`uid` mediumint(8) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`maketime` int(10) unsigned NOT NULL,\n\t\t\t`bindtime` int(10) unsigned NOT NULL,\n\t\t\t`fafanguid` mediumint(8) default NULL,\n\t\t\tPRIMARY KEY  (`cardnoid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Ejemplo n.º 18
0
 public function update($id, $name, $petName, $number, $email, $phone, $collegeId, $desc) {
     $query = DB::query('select * from '.DB::table('book_teacher').' where number=\''.$number.'\' and id <> '.$id);
     if(DB::num_rows($query) > 0) {
         return "教师信息修改失败,存在同工号的教师!";
     } else {
         DB::update( $this->_table,
                     array(  'name'=>$name,
                             'petName'=>$petName,
                             'number'=>$number,
                             'email'=>$email,
                             'phone'=>$phone,
                             'collegeId'=>$collegeId,
                             'desc'=>$desc),
                     array('id'=> $id)
                   );
         return "教师信息修改成功!";
     }
 }
Ejemplo n.º 19
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t`mokuaiclassid` mediumint(8) NOT NULL auto_increment,\n\t\t`mokuaiclassname` char(20) NOT NULL,\n\t\t`mokuaiclasstitle` char(40) NOT NULL,\n\t\tPRIMARY KEY  (`mokuaiclassid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 20
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t\t`mokuaiid` smallint(6) NOT NULL auto_increment,\n\t\t\t`available` tinyint(1) NOT NULL default '0',\n\t\t\t`name` varchar(40) NOT NULL default '',\n\t\t\t`biaoshi` varchar(40) NOT NULL default '',\n\t\t\t`version` varchar(20) NOT NULL default '',\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\t`price` int(10) NOT NULL,\n\t\t\t`description` varchar(255) NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`mokuaiid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 21
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t  `siteid` smallint(6) NOT NULL,\n\t\t  `updatetime` int(10) unsigned NOT NULL,\n\t\t  PRIMARY KEY  (`siteid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 22
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t\t`siteid` smallint(6) NOT NULL auto_increment,\n\t\t\t`siteurl` varchar(255) NOT NULL,\n\t\t\t`salt` char(6) NOT NULL,\n\t\t\t`charset` char(20) NOT NULL,\n\t\t\t`clientip` char(15) NOT NULL,\n\t\t\t`version` char(50) NOT NULL,\n\t\t\t`sitekey` char(32) NOT NULL,\n\t\t\t`sitegroup` text(0) NOT NULL,\n\t\t\t`mokuais` text(0) NOT NULL,\n\t\t\t`installtime` int(10) unsigned NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`siteid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     $type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 23
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`goodssortid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`upmokuai` smallint(6) NOT NULL,\n\t\t\t`sortname` char(20) character set gbk NOT NULL,\n\t\t\t`sorttitle` char(20) character set gbk NOT NULL,\n\t\t\t`sortlevel` smallint(6) NOT NULL,\n\t\t\t`sortupid` smallint(6) NOT NULL,\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\t`upids` text character set gbk NOT NULL,\n\t\t\tPRIMARY KEY  (`goodssortid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 24
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`fieldid` smallint(6) NOT NULL auto_increment,\n\t\t\t`name` char(40) NOT NULL,\n\t\t\t`title` char(40) NOT NULL,\n\t\t\t`type` char(20) NOT NULL,\n\t\t\t`unit` char(10) NOT NULL,\n\t\t\t`infotype` char(20) NOT NULL,\n\t\t\t`available` tinyint(1) NOT NULL,\n\t\t\t`required` tinyint(1) NOT NULL,\n\t\t\t`unchangeable` tinyint(1) NOT NULL,\n\t\t\t`listdisplay` tinyint(1) NOT NULL,\n\t\t\t`search` tinyint(1) NOT NULL,\n\t\t\t`description` char(255) NOT NULL,\n\t\t\t`expiration` text NOT NULL,\n\t\t\t`protect` text NOT NULL,\n\t\t\t`rules` text NOT NULL,\n\t\t\t`permprompt` text NOT NULL,\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\tPRIMARY KEY  (`fieldid`)listdisplay\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 25
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`menuid` smallint(6) NOT NULL auto_increment,\n\t\t\t`type` enum('yiqixueba','member','admincp') NOT NULL,\n\t\t\t`upid` smallint(6) NOT NULL,\n\t\t\t`name` char(10) NOT NULL,\n\t\t\t`title` char(20) NOT NULL,\n\t\t\t`link` char(20) NOT NULL,\n\t\t\t`level` tinyint(1) NOT NULL,\n\t\t\t`modfile` varchar(255) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`displayorder` smallint(3) NOT NULL,\n\t\t\tPRIMARY KEY  (`menuid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 26
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`shopid` mediumint(8) unsigned NOT NULL auto_increment,\n\t\t\t`shopname` char(50) character set gbk NOT NULL,\n\t\t\t`shopalias` char(40) character set gbk NOT NULL,\n\t\t\t`shopvideo` varchar(255) character set gbk NOT NULL,\n\t\t\t`shoplocation` char(40) character set gbk NOT NULL,\n\t\t\t`dist` char(50) character set gbk NOT NULL,\n\t\t\t`comy` char(50) character set gbk NOT NULL,\n\t\t\t`shopintroduction` varchar(255) character set gbk NOT NULL,\n\t\t\t`shopinformation` text character set gbk NOT NULL,\n\t\t\t`shoprecommend` smallint(3) NOT NULL,\n\t\t\t`shoplevel` smallint(3) NOT NULL,\n\t\t\t`uid` mediumint(8) NOT NULL,\n\t\t\t`shopdianyuan` text character set gbk NOT NULL,\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\t`renlingtime` int(10) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`shopsort` smallint(3) NOT NULL,\n\t\t\t`shoplogo` varchar(100) character set gbk NOT NULL,\n\t\t\t`address` varchar(100) character set gbk NOT NULL,\n\t\t\t`phone` varchar(20) character set gbk NOT NULL,\n\t\t\t`lianxiren` varchar(20) character set gbk NOT NULL,\n\t\t\t`qq` varchar(20) character set gbk NOT NULL,\n\t\t\t`upmokuai` varchar(255) NOT NULL,\n\t\t\t`businessid` mediumint(8) unsigned NOT NULL,\n\t\t\t`upshopid` mediumint(8) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`shopid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 27
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`jiashizhengid` smallint(6) NOT NULL auto_increment,\n\t\t\t`jiashizhengname` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengtitle` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengsort` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengimages` varchar(40) NOT NULL default '',\n\t\t\t`description` text NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL default '0',\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`jiashizhengid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 28
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`shopgroupid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`shopgroupname` char(50) character set gbk NOT NULL,\n\t\t\t`inshoufei` int(10) unsigned NOT NULL,\n\t\t\t`inshoufeiqixian` int(10) unsigned NOT NULL,\n\t\t\t`shopgroupdescription` varchar(255) character set gbk NOT NULL,\n\t\t\t`cardfeiyong` int(10) NOT NULL,\n\t\t\t`cardpice` int(10) unsigned NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`shopgroupico` varchar(255) character set gbk NOT NULL,\n\t\t\t`xiaofei` varchar(255) character set gbk NOT NULL,\n\t\t\t`zhanghaoyue` int(10) NOT NULL,\n\t\t\t`zhanghaojifen` int(10) NOT NULL,\n\t\t\t`xiaofeitypeshenhe` tinyint(1) NOT NULL,\n\t\t\t`dianyuanshenhe` tinyint(1) NOT NULL,\n\t\t\t`dianzhang` varchar(255) character set gbk NOT NULL,\n\t\t\t`caiwu` varchar(255) character set gbk NOT NULL,\n\t\t\t`shouyin` varchar(255) character set gbk NOT NULL,\n\t\t\t`enfendian` tinyint(1) NOT NULL,\n\t\t\t`enshopnum` int(10) NOT NULL,\n\t\t\t`contractsample` char(100) character set gbk NOT NULL,\n\t\t\t`isshop` varchar(255) NOT NULL,\n\t\t\tPRIMARY KEY  (`shopgroupid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Ejemplo n.º 29
0
    exit('Access Denied');
}
if (empty($_G['gp_do']) || $_G['gp_do'] == 'tradeinfo') {
    if ($_G['gp_do'] == 'tradeinfo') {
        $_G['gp_pid'] = intval($_G['gp_pid']);
        $tradelistadd = "AND pid = '{$_G['gp_pid']}'";
    } else {
        $tradelistadd = '';
        !$tradenum && ($allowpostreply = FALSE);
    }
    $query = DB::query("SELECT * FROM " . DB::table('forum_trade') . " WHERE tid='{$_G['tid']}' {$tradelistadd} ORDER BY displayorder");
    $trades = $tradesstick = array();
    $tradelist = 0;
    if (empty($_G['gp_do'])) {
        $sellerid = 0;
        $listcount = DB::num_rows($query);
        $tradelist = $tradenum - $listcount;
    }
    $tradesaids = $tradespids = array();
    while ($trade = DB::fetch($query)) {
        if ($trade['expiration']) {
            $trade['expiration'] = ($trade['expiration'] - TIMESTAMP) / 86400;
            if ($trade['expiration'] > 0) {
                $trade['expirationhour'] = floor(($trade['expiration'] - floor($trade['expiration'])) * 24);
                $trade['expiration'] = floor($trade['expiration']);
            } else {
                $trade['expiration'] = -1;
            }
        }
        $tradesaids[] = $trade['aid'];
        $tradespids[] = $trade['pid'];
Ejemplo n.º 30
0
 if ($_G['cache']['ipctrl']['ipregctrl']) {
     foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
         if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
             $ctrlip = $ctrlip . '%';
             $_G['setting']['regctrl'] = 72;
             break;
         } else {
             $ctrlip = $_G['clientip'];
         }
     }
 } else {
     $ctrlip = $_G['clientip'];
 }
 if ($_G['setting']['regctrl']) {
     $query = DB::query("SELECT ip FROM " . DB::table('common_regip') . " WHERE ip LIKE '{$ctrlip}' AND count='-1' AND dateline>{$_G['timestamp']}-'" . $_G['setting']['regctrl'] . "'*3600 LIMIT 1");
     if (DB::num_rows($query)) {
         showmessage('register_ctrl', NULL, array('regctrl' => $_G['setting']['regctrl']));
     }
 }
 $regipsql = '';
 if ($_G['setting']['regfloodctrl']) {
     if ($regattempts = DB::result_first("SELECT count FROM " . DB::table('common_regip') . " WHERE ip='{$_G['clientip']}' AND count>'0' AND dateline>'{$_G['timestamp']}'-86400")) {
         if ($regattempts >= $_G['setting']['regfloodctrl']) {
             showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $_G['setting']['regfloodctrl']));
         } else {
             $regipsql = "UPDATE " . DB::table('common_regip') . " SET count=count+1 WHERE ip='{$_G['clientip']}' AND count>'0'";
         }
     } else {
         $regipsql = "INSERT INTO " . DB::table('common_regip') . " (ip, count, dateline)\r\n\t\t\t\tVALUES ('{$_G['clientip']}', '1', '{$_G['timestamp']}')";
     }
 }