| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622 |
- <?php
- function post_cat_info($catid)
- {
- global $db;
- global $db_mymps;
- return $db->getRow('SELECT a.catid,a.modid,a.if_upimg,a.catname,b.catid as parentid,a.if_mappoint,b.catname as parentname FROM `' . $db_mymps . 'category` AS a LEFT JOIN `' . $db_mymps . 'category` AS b ON a.parentid = b.catid WHERE a.catid = \'' . $catid . '\'');
- }
- define('IN_SMT', true);
- define('CURSCRIPT', 'post');
- define('IN_MYMPS', true);
- define('IN_MANAGE', true);
- require_once dirname(__FILE__) . '/include/global.php';
- require_once dirname(__FILE__) . '/data/config.php';
- require_once MYMPS_DATA . '/config.db.php';
- require_once MYMPS_INC . '/db.class.php';
- require_once MYMPS_INC . '/upfile.fun.php';
- require_once MYMPS_DATA . '/config.inc.php';
- ifsiteopen();
- $authcodesettings = read_static_cache('authcodesettings');
- !in_array($action, array('input', 'edit', 'ok')) && ($action = 'input');
- $action = isset($action) ? trim($action) : '';
- if ($action != 'ok') {
- $ip = '';
- $ip = GetIP();
- $ip2area = ip2area($ip);
- }
- if ($act == 'dopost') {
- if (!$mixcode || $mixcode != md5($cookiepre)) {
- exit('FORBIDDEN');
- exit();
- }
- empty($areaid) && write_msg('请选择您要发布的地区!');
- empty($title) && write_msg('请输入信息标题!');
- empty($content) && write_msg('您还没有输入信息描述!');
- empty($tel) && write_msg('联系电话不能为空!');
- empty($contact_who) && write_msg('联系人不能为空!');
- mymps_check_upimage('mymps_img_');
- $lat = isset($lat) ? (double) $lat : '';
- $lng = isset($lng) ? (double) $lng : '';
- $id = $action == 'edit' ? intval($id) : '';
- $userid = isset($userid) ? mhtmlspecialchars($userid) : '';
- $manage_pwd = isset($manage_pwd) ? trim($manage_pwd) : '';
- $catid = intval($catid);
- if (empty($catid)) {
- write_msg('您未指定发布的信息栏目');
- }
- $areaid = intval($areaid);
- $streetid = intval($streetid);
- $title = trim(mhtmlspecialchars($title));
- $content = $mymps_global['cfg_post_editor'] == 1 ? $content : textarea_post_change($content);
- $begintime = $timestamp;
- $activetime = $endtime = intval($endtime);
- $endtime = $endtime == 0 ? 0 : $endtime * 3600 * 24 + $begintime;
- $ismember = intval($ismember);
- $mappoint = isset($mappoint) ? trim(mhtmlspecialchars($mappoint)) : '';
- $tel = isset($tel) ? trim(mhtmlspecialchars($tel)) : '';
- $qq = isset($qq) ? trim(mhtmlspecialchars($qq)) : '';
- $web_address = trim(mhtmlspecialchars($web_address));
- $email = isset($email) ? trim(mhtmlspecialchars($email)) : '';
- $result = verify_badwords_filter($mymps_global['cfg_if_info_verify'], $title, $content);
- $title = $result['title'];
- $content = $result['content'];
- $content = preg_replace('/<a[^>]+>(.+?)<\\/a>/i', '$1', $content);
- $info_level = $result['level'];
- unset($result);
- $extra = isset($extra) ? $extra : '';
- $d = $db->getRow('SELECT catname,dir_typename,modid,gid FROM `' . $db_mymps . 'category` WHERE catid = \'' . $catid . '\'');
- if ($action == 'input') {
- if (!empty($mymps_global['cfg_allow_post_area']) && !empty($ip2area)) {
- $i = 1;
- $allow_post_area = array();
- $allow_post_area = explode('=', $mymps_global['cfg_allow_post_area']);
- $allow_post_areas = explode(',', $allow_post_area[0]);
- foreach ($allow_post_areas as $k => $v) {
- if (strstr($ip2area, $v)) {
- $i = $i + 1;
- }
- }
- if ($allow_post_area[1] == '-1' && $i == 1) {
- write_msg('系统判断您的IP并非<b style=\'color:red\'>' . $allow_post_area[0] . '</b>本地IP!<br />如果您要继续操作,请联系客服。');
- exit();
- }
- else {
- if ($allow_post_area[1] == 0 && $i == 1) {
- $info_level = 0;
- }
- }
- unset($allow_post_area);
- unset($address);
- unset($ipdata);
- unset($allow_post_areas);
- unset($i);
- }
- $checkquestion = isset($checkquestion) ? $checkquestion : '';
- $data = '';
- @include MYMPS_DATA . '/caches/checkanswer_settings.php';
- if (is_array($data)) {
- $whenpost = $data['whenpost'];
- $result = read_static_cache('checkanswer');
- if ($whenpost == 1 && is_array($result)) {
- if (!is_array($checkquestion) || empty($checkquestion['answer']) || empty($checkquestion['id'])) {
- write_msg('您还没有输入验证问题!');
- exit();
- }
- if ($result[$checkquestion['id']]['answer'] != $checkquestion['answer']) {
- write_msg('您输入的验证问题答案不正确,请重新输入!');
- }
- }
- $result = $checkquestion = $whenpost = $data = NULL;
- }
- $img_count = upload_img_num('mymps_img_');
- if (!empty($mymps_global['cfg_disallow_post_tel']) && !empty($tel)) {
- $disallow_tel = array();
- $disallow_tel = explode('=', $mymps_global['cfg_disallow_post_tel']);
- $disallow_telarray = explode(',', $disallow_tel[0]);
- if ($disallow_tel[1] == -1) {
- in_array($tel, $disallow_telarray) && write_msg('您的电话号码<b style=\'color:red\'>' . $tel . '</b> 已被管理员加入黑名单!<br />如果您要继续操作,请联系客服。');
- }
- else if ($disallow_tel[1] == 0) {
- in_array($tel, $disallow_telarray) && ($info_level = 0);
- }
- unset($disallow_tel);
- unset($disallow_telarray);
- }
- if ($yet = $db->getOne('SELECT begintime FROM `' . $db_mymps . 'information` WHERE title=\'' . $title . '\' AND tel = \'' . $tel . '\' ORDER BY id DESC')) {
- if ($timestamp - $yet < 3600 * 24) {
- write_msg('请勿重复发布信息!', '?action=input&catid=' . $catid);
- }
- unset($yet);
- }
- if (empty($ismember)) {
- if ($mymps_global['cfg_if_nonmember_info'] != 1) {
- write_msg('对不起,您还没有登录!请您登录后再发布信息!');
- }
- if ($mymps_global['cfg_if_nonmember_info'] == 1 && 0 < $mymps_global['cfg_nonmember_perday_post']) {
- $count = mymps_count('information', 'WHERE ip = \'' . $ip . '\' AND begintime > \'' . mktime(0, 0, 0) . '\' AND ismember = \'0\'');
- $mymps_global[cfg_nonmember_perday_post] <= $count && write_msg('很抱歉!游客每天只能发布 <b style=\'color:red\'>' . $mymps_global[cfg_nonmember_perday_post] . '</b> 条信息<br />如果您要继续操作,请联系客服。');
- }
- empty($manage_pwd) && write_msg('请输入您的管理密码!以便于以后对该信息的修改和删除');
- empty($contact_who) && write_msg('请填写联系人!');
- $manage_pwd = md5($manage_pwd);
- if ($authcodesettings['post'] == 1 && !($randcode = mymps_chk_randcode($checkcode))) {
- write_msg('验证码输入错误,请返回重新输入');
- }
- $sql = 'INSERT INTO `' . $db_mymps . 'information` (title,content,gid,catid,catname,dir_typename,areaid,begintime,activetime,endtime,manage_pwd,ismember,ip,ip2area,info_level,qq,email,tel,contact_who,img_count,mappoint,latitude,longitude)VALUES(\'' . $title . '\',\'' . $content . '\',\'' . $d['gid'] . '\',\'' . $catid . '\',\'' . $d['catname'] . '\',\'' . $d['dir_typename'] . '\',\'' . $areaid . '\',\'' . $begintime . '\',\'' . $activetime . '\',\'' . $endtime . '\',\'' . $manage_pwd . '\',\'' . $ismember . '\',\'' . $ip . '\',\'' . $ip2area . '\',\'' . $info_level . '\',\'' . $qq . '\',\'' . $email . '\',\'' . $tel . '\',\'' . $contact_who . '\',\'' . $img_count . '\',\'' . $mappoint . '\',\'' . $lat . '\',\'' . $lng . '\')';
- }
- else if ($ismember == 1) {
- $s_uid = $status = '';
- require_once MYMPS_INC . '/member.class.php';
- if (!$member_log->chk_in()) {
- write_msg('对不起,您还没有登录!');
- }
- $memberinfo = $member_log->get_info();
- $status = $memberinfo['status'];
- $face = $memberinfo['prelogo'];
- if (empty($status)) {
- write_msg('您的账号 [<b>' . $s_uid . '</b>] 目前处于<font color=red>待审状态</font>!<br>请进入邮箱查收验证邮件或等待客服人员开通账号!');
- exit();
- }
- $per = $db->getRow('SELECT a.money_own,b.perday_maxpost,b.info_maxpost FROM `' . $db_mymps . 'member` AS a LEFT JOIN `' . $db_mymps . 'member_level` AS b ON a.levelid = b.id WHERE a.userid = \'' . $s_uid . '\'');
- $perday_maxpost = $per['perday_maxpost'];
- if (!empty($perday_maxpost)) {
- $count = mymps_count('information', 'WHERE userid LIKE \'' . $s_uid . '\' AND begintime > \'' . mktime(0, 0, 0) . '\'');
- $perday_maxpost <= $count && write_msg('很抱歉!您当前的会员级别每天只能发布 <b style=\'color:red\'>' . $perday_maxpost . '</b> 条信息<br />如果您要继续操作,请联系客服。');
- }
- if ($per[info_maxpost]) {
- $count = mymps_count('information', 'WHERE userid = \'' . $s_uid . '\'');
- $per[info_maxpost] <= $count && write_msg('很抱歉!您已超出发布数量总量限制<br />如果您要继续发布信息,请升级会员。');
- }
- if (!empty($perpost_money_cost)) {
- if ($per['money_own'] < $perpost_money_cost) {
- write_msg('您当前金币余额不足,发布一条信息需要支付' . $perpost_money_cost . '个金币!');
- exit();
- }
- }
- chk_member_purview('purview_info');
- $perpost_money_cost = $mymps_global['cfg_member_perpost_consume'] ? $mymps_global['cfg_member_perpost_consume'] : 0;
- $userid = trim($s_uid);
- if ($userid) {
- $row = $db->getRow('SELECT per_certify,com_certify FROM `' . $db_mymps . 'member` WHERE userid = \'' . $userid . '\'');
- if ($row['per_certify'] == 1 || $row['com_certify'] == 1) {
- $certify = 1;
- }
- else {
- $certify = 0;
- }
- unset($row);
- }
- if ($authcodesettings['memberpost'] == 1 && !($randcode = mymps_chk_randcode($checkcode))) {
- write_msg('验证码输入错误,请返回重新输入');
- }
- $sql = 'INSERT INTO `' . $db_mymps . 'information` (title,content,begintime,activetime,endtime,gid,catid,catname,dir_typename,areaid,userid,ismember,ip,ip2area,info_level,qq,email,tel,contact_who,img_count,mappoint,certify,latitude,longitude,face) Values (\'' . $title . '\',\'' . $content . '\',\'' . $begintime . '\',\'' . $activetime . '\',\'' . $endtime . '\',\'' . $d['gid'] . '\',\'' . $catid . '\',\'' . $d['catname'] . '\',\'' . $d['dir_typename'] . '\',\'' . $areaid . '\',\'' . $userid . '\',\'' . $ismember . '\',\'' . $ip . '\',\'' . $ip2area . '\',\'' . $info_level . '\',\'' . $qq . '\',\'' . $email . '\',\'' . $tel . '\',\'' . $contact_who . '\',\'' . $img_count . '\',\'' . $mappoint . '\',\'' . $certify . '\',\'' . $lat . '\',\'' . $lng . '\',\'' . $face . '\')';
- $score_change = get_credit_score();
- $score_changer = $score_change['score']['rank']['information'];
- $score_changer = $score_changer == 0 ? '+0' : $score_changer;
- if ($score_changer) {
- $db->query('UPDATE `' . $db_mymps . 'member` SET score = score' . $score_changer . (' WHERE userid = \'' . $userid . '\''));
- }
- $score_change = $score_changer = NULL;
- if (!empty($perpost_money_cost)) {
- $db->query('UPDATE `' . $db_mymps . 'member` SET money_own = money_own-\'' . $perpost_money_cost . '\' WHERE userid = \'' . $userid . '\'');
- }
- }
- else {
- exit('Access Denied!');
- }
- $db->query($sql);
- $id = $db->insert_id();
- $k = $v = NULL;
- if (is_array($extra) && 1 < $d['modid']) {
- foreach ($extra as $k => $v) {
- $v = is_array($v) ? implode(',', $v) : $v;
- $sql1 .= ',`' . $k . '`';
- $sql2 .= ',\'' . $v . '\'';
- }
- $sql = '(id.' . $sql1 . ')VALUES(\'' . $id . '\',\'\',\'\')';
- $db->query('INSERT INTO `' . $db_mymps . 'information_' . $d[modid] . '` (`id`' . $sql1 . ')VALUES(\'' . $id . '\'' . $sql2 . ')');
- unset($sql1);
- unset($sql2);
- }
- if (0 < $img_count) {
- $img_path = '';
- for ($i = 0; $i < $img_count; $i++) {
- $name_file = 'mymps_img_' . $i;
- if ($_FILES[$name_file]['name']) {
- $destination = '/information/' . date('Ym') . '/';
- $mymps_image = start_upload($name_file, $destination, $mymps_global['cfg_upimg_watermark'], $mymps_mymps['cfg_information_limit']['width'], $mymps_mymps['cfg_information_limit']['height']);
- $db->query('INSERT INTO `' . $db_mymps . 'info_img` (image_id,path,prepath,infoid,uptime) VALUES (\'' . $i . '\',\'' . $mymps_image[0] . '\',\'' . $mymps_image[1] . '\',\'' . $id . '\',\'' . $timestamp . '\')');
- }
- if ($i === 0) {
- $img_path = $mymps_image[1];
- }
- }
- if ($img_path) {
- $db->query('UPDATE `' . $db_mymps . 'information` SET img_path = \'' . $img_path . '\' WHERE id = \'' . $id . '\'');
- }
- }
- write_msg('', '?action=ok&id=' . $id . '&title=' . urlencode($title) . '&level=' . $info_level . '&filepath=' . $infopath);
- }
- else if ($action == 'edit') {
- if (is_array($_FILES)) {
- for ($i = 0; $i < count($_FILES); $i++) {
- $name_file = 'mymps_img_' . $i;
- if ($_FILES[$name_file]['name']) {
- $destination = '/information/' . date('Ym') . '/';
- $mymps_image = start_upload($name_file, $destination, $mymps_global['cfg_upimg_watermark'], $mymps_mymps['cfg_information_limit']['width'], $mymps_mymps['cfg_information_limit']['height']);
- if ($row = $db->getRow('SELECT path,prepath FROM `' . $db_mymps . 'info_img` WHERE infoid = \'' . $id . '\' AND image_id = \'' . $i . '\'')) {
- @unlink(MYMPS_ROOT . $row['path']);
- @unlink(MYMPS_ROOT . $row['prepath']);
- $db->query('UPDATE `' . $db_mymps . 'info_img` SET image_id = \'' . $i . '\' , path = \'' . $mymps_image[0] . '\' , prepath = \'' . $mymps_image[1] . '\' , uptime = \'' . $timestamp . '\' WHERE image_id = \'' . $i . '\' AND infoid = \'' . $id . '\'');
- }
- else {
- $db->query('INSERT INTO `' . $db_mymps . 'info_img` (image_id,path,prepath,infoid,uptime) VALUES (\'' . $i . '\',\'' . $mymps_image[0] . '\',\'' . $mymps_image[1] . '\',\'' . $id . '\',\'' . $timestamp . '\')');
- }
- if ($i === 0 && $mymps_image[1]) {
- $db->query('UPDATE `' . $db_mymps . 'information` SET img_path = \'' . $mymps_image[1] . '\' WHERE id = \'' . $id . '\'');
- }
- }
- }
- }
- if (is_array($delinfoimg)) {
- $img_path = $db->getOne('SELECT img_path FROM `' . $db_mymps . 'information` WHERE id = \'' . $id . '\'');
- foreach ($delinfoimg as $key => $val) {
- if ($val == 'on') {
- $infoimgrow = $db->getRow('SELECT id,path,prepath FROM `' . $db_mymps . 'info_img` WHERE image_id = \'' . $key . '\' AND infoid = \'' . $id . '\'');
- if ($infoimgrow) {
- @unlink(MYMPS_ROOT . $infoimgrow['path']);
- @unlink(MYMPS_ROOT . $infoimgrow['prepath']);
- mymps_delete('info_img', 'WHERE id = \'' . $infoimgrow['id'] . '\'');
- if ($infoimgrow['prepath'] == $img_path) {
- $db->query('UPDATE `' . $db_mymps . 'information` SET img_path = \'\' WHERE id = \'' . $id . '\'');
- }
- }
- unset($infoimgrow);
- }
- }
- }
- $sql = $k = $v = NULL;
- if (is_array($extra) && 1 < $d['modid']) {
- foreach ($extra as $k => $v) {
- $sql .= is_array($v) ? '`' . $k . '` = \'' . implode(',', $v) . '\',' : '`' . $k . ('` = \'' . $v . '\',');
- }
- $sql = $sql ? substr($sql, 0, -1) : NULL;
- if ($sql) {
- $db->query('UPDATE `' . $db_mymps . 'information_' . $d[modid] . '` SET ' . $sql . ' WHERE id = \'' . $id . '\'');
- unset($sql);
- }
- }
- $manage_pwd = empty($manage_pwd) ? '' : 'manage_pwd=\'' . md5($manage_pwd) . '\',';
- $userid = empty($userid) ? '' : 'userid=\'' . $userid . '\',';
- $img_count = mymps_count('info_img', 'WHERE infoid = \'' . $id . '\'');
- $img_path = $mymps_image[1] ? $mymps_image[1] : '';
- $d = $db->getRow('SELECT catname,dir_typename FROM `' . $db_mymps . 'category` WHERE catid = \'' . $catid . '\'');
- $sql = 'UPDATE `' . $db_mymps . 'information` SET ' . $manage_pwd . ' ' . $userid . ' title = \'' . $title . '\',content = \'' . $content . '\',catid = \'' . $catid . '\', areaid = \'' . $areaid . '\', activetime = \'' . $activetime . '\', endtime = \'' . $endtime . '\', ismember = \'' . $ismember . '\' , ip = \'' . $ip . '\' , ip2area = \'' . $ip2area . '\' , info_level = \'' . $info_level . '\' , qq = \'' . $qq . '\' , email = \'' . $email . '\' , tel = \'' . $tel . '\' , contact_who = \'' . $contact_who . '\' , img_count = \'' . $img_count . '\' , mappoint = \'' . $mappoint . '\',catname=\'' . $d['catname'] . '\',dir_typename=\'' . $d['dir_typename'] . '\' WHERE id = \'' . $id . '\'';
- $db->query($sql);
- $editlimit = mgetcookie('editlimit');
- $editlimit = $editlimit + 1;
- msetcookie('editlimit', $editlimit, 3600 * 24);
- write_msg('操作成功!您已经成功修改该信息!<br />若信息内容无变化请刷新浏览器!', Rewrite('info', array('id' => $id, 'dir_typename' => $d['dir_typename'])));
- }
- }
- else {
- $catid = isset($catid) ? intval($catid) : '';
- if ($action == 'input') {
- if ($catname && !$catid) {
- $catid = $db->getOne('SELECT catid FROM `' . $db_mymps . 'category` WHERE catname = \'' . $catname . '\'');
- }
- if (!$catid) {
- $loc = get_location('post', '', '选择分类-发布信息');
- $page_title = $loc['page_title'];
- globalassign();
- $categories = get_categories_tree(0, 'category');
- include mymps_tpl('info_post');
- }
- else {
- if (!empty($mymps_global['cfg_allow_post_area']) && !empty($ip2area)) {
- $i = 1;
- $allow_post_area = array();
- $allow_post_area = explode('=', $mymps_global['cfg_allow_post_area']);
- $allow_post_areas = explode(',', $allow_post_area[0]);
- foreach ($allow_post_areas as $k => $v) {
- if (strstr($ip2area, $v)) {
- $i = $i + 1;
- }
- }
- if ($allow_post_area[1] == '-1' && $i == 1) {
- write_msg('系统判断您的IP并非<b style=\'color:red\'>' . $allow_post_area[0] . '</b>本地IP!<br />如果您要继续操作,请联系客服。');
- exit();
- }
- else {
- if ($allow_post_area[1] == 0 && $i == 1) {
- $info_level = 0;
- }
- }
- unset($allow_post_area);
- unset($ip2area);
- unset($address);
- unset($ipdata);
- unset($allow_post_areas);
- unset($i);
- }
- if (!empty($mymps_global['cfg_forbidden_post_ip'])) {
- foreach (explode(',', $mymps_global['cfg_forbidden_post_ip']) as $ctrlip) {
- if (preg_match('/^(' . preg_quote($ctrlip = trim($ctrlip), '/') . ')/', $ip)) {
- $ctrlip = $ctrlip . '%';
- write_msg('您当前的IP <b style=\'color:red\'>' . $ip . '</b> 已被管理员加入黑名单,不允许发布信息!');
- exit();
- }
- }
- }
- $cat = post_cat_info($catid);
- if ($cat['parentid'] == 0) {
- $loc = get_location('post', '', '选择分类-发布' . $cat[catname] . '信息');
- $page_title = $loc['page_title'];
- $categories = get_categories_tree($catid, 'category');
- globalassign();
- include mymps_tpl('info_post');
- exit();
- }
- else if ($db->getOne('SELECT COUNT(catid) FROM `' . $db_mymps . 'category` WHERE parentid = \'' . $catid . '\'')) {
- $cat_option = $db->getAll('SELECT catid,catname FROM `' . $db_mymps . 'category` WHERE parentid = \'' . $catid . '\' ORDER BY catorder ASC');
- }
- require_once MYMPS_DATA . '/info_lasttime.php';
- require_once MYMPS_DATA . '/info.type.inc.php';
- require_once MYMPS_INC . '/member.class.php';
- if ($log = $member_log->chk_in()) {
- chk_member_purview('purview_info');
- }
- if ($mymps_global['cfg_post_editor'] == 1) {
- $acontent = get_editor('content', 'Member', '', '350px', '300px', 'include/kindeditor');
- }
- else {
- $acontent = '<textarea name="content" style="width:400px;height:300px;" class="input" require="true" datatype="limit" msg="请填写信息内容描述"></textarea>';
- }
- $post = array();
- if ($log) {
- $memberinfo = $member_log->get_info();
- $his_money = $memberinfo['money_own'];
- $status = $memberinfo['status'];
- $sj_certify = $memberinfo['sj_certify'];
- if ($status < 1) {
- write_msg('您的会员账号尚未通过审核,不能发布信息!');
- exit();
- }
- if ($sj_certify == 0 && $mymps_global['cfg_member_verify'] == 4) {
- write_msg('还差最后一步,填写手机号码认证通过后就可以发布信息啦 ^_^', 'member/index.php?m=certify&ac=sjrz');
- }
- $his_money - $mymps_global['cfg_member_perpost_consume'] < 0 && write_msg('您的用户余额 <font color=red><b>' . $his_money . '</b></font>过低 不能再发布信息,请联系管理员充值', '/member/index.php?m=pay');
- $per = $db->getRow('SELECT b.perday_maxpost,b.info_maxpost FROM `' . $db_mymps . 'member` AS a LEFT JOIN `' . $db_mymps . 'member_level` AS b ON a.levelid = b.id WHERE a.userid = \'' . $s_uid . '\'');
- $perday_maxpost = $per[perday_maxpost];
- if (!empty($perday_maxpost)) {
- $count = mymps_count('information', 'WHERE userid = \'' . $s_uid . '\' AND begintime > \'' . mktime(0, 0, 0) . '\'');
- $perday_maxpost <= $count && write_msg('很抱歉!您当前的会员级别每天只能发布' . $perday_maxpost . '条信息');
- }
- if ($per[info_maxpost]) {
- $count = mymps_count('information', 'WHERE userid = \'' . $s_uid . '\'');
- $per[info_maxpost] <= $count && write_msg('很抱歉!您已超出发布数量总量限制<br />如果您要继续发布信息,请升级会员。');
- }
- $onload = '';
- $post['mobile'] = $memberinfo['mobile'];
- $post['qq'] = $memberinfo['qq'];
- $post['email'] = $memberinfo['email'];
- $post['userid'] = $memberinfo['userid'];
- $post['contact_who'] = $memberinfo['cname'];
- $post['ismember'] = 1;
- $post['manage_pwd'] = '';
- $post['imgcode'] = $authcodesettings['memberpost'] == 1 ? 1 : '';
- }
- else {
- if (!empty($mymps_global['cfg_nonmember_perday_post'])) {
- $count = mymps_count('information', 'WHERE ip = \'' . $ip . '\' AND begintime > \'' . mktime(0, 0, 0) . '\' AND ismember = \'0\'');
- $mymps_global[cfg_nonmember_perday_post] <= $count && write_msg('很抱歉!游客每天只能发布' . $mymps_global[cfg_nonmember_perday_post] . '条信息');
- }
- $mymps_global['cfg_if_nonmember_info'] == '0' && write_msg('对不起,您还没有登录!请您登录后再发布信息!', $mymps_global['cfg_member_logfile'] . '?url=' . urlencode(getUrl()));
- $onload = '';
- $post['manage_pwd'] = 1;
- $post['ismember'] = 0;
- $post['imgcode'] = $authcodesettings['post'] == 1 ? 1 : '';
- }
- $post['mymps_extra_value'] = return_category_info_options($cat['modid']);
- $post['upload_img'] = $cat['if_upimg'] == 1 ? get_upload_image_view(1, $id) : '';
- $post['GetInfoLastTime'] = GetInfoLastTime();
- $post['action'] = 'input';
- $post['submit'] = '提交发布';
- $post['ip'] = $ip;
- $post['catid'] = $catid;
- $post['mixcode'] = md5($cookiepre);
- $post['select_where_option'] = cat_list('area');
- $loc = get_location('post', '', '发布' . $cat[catname] . '信息-发布信息');
- $page_title = $loc['page_title'];
- $whenpost = '';
- $whenpost = $db->getOne('SELECT value FROM `' . $db_mymps . 'config` WHERE description = \'whenpost\' AND type = \'checkanswe\'');
- if ($whenpost == '1' && ($checkanswer = read_static_cache('checkanswer'))) {
- $checkquestion['id'] = $randid = array_rand($checkanswer, 1);
- $checkquestion['question'] = $checkanswer[$randid]['question'];
- $checkquestion['answer'] = $checkanswer[$randid]['answer'];
- }
- globalassign();
- include mymps_tpl('info_post_write');
- }
- }
- else if ($action == 'edit') {
- $page_title = '修改信息-' . $mymps_global['SiteName'];
- require_once MYMPS_DATA . '/info_lasttime.php';
- require_once MYMPS_DATA . '/info.type.inc.php';
- require_once MYMPS_INC . '/member.class.php';
- $editlimit = mgetcookie('editlimit');
- if (30 < $editlimit) {
- write_msg('您今天修改的信息太多了,休息一下吧 ^_^');
- }
- $id = intval($id);
- if (!($post = is_member_info($id))) {
- write_msg('操作失败!你所指定的信息不存在或者已被删除!');
- }
- $catid = $post['catid'];
- $areaid = $post['areaid'];
- $cat = $db->getRow('SELECT a.if_upimg,a.modid,b.catid FROM `' . $db_mymps . 'category` AS a LEFT JOIN `' . $db_mymps . 'category` AS b ON a.parentid = b.catid WHERE a.catid = \'' . $catid . '\'');
- if ($post['ismember'] == 1) {
- if (!($log = $member_log->chk_in())) {
- write_msg('', $mymps_global['SiteUrl'] . '/' . $mymps_global['cfg_member_logfile'] . '?url=' . urlencode($mymps_global['SiteUrl'] . '/' . $mymps_global['cfg_postfile'] . '?action=edit&id=' . $id));
- }
- else {
- if ($log && $s_uid != $post['userid']) {
- write_msg('操作失败!该信息不是您发布的!', 'information.php?id=' . $id);
- }
- }
- $nav_bar = '<a href="info.php?id=' . $id . '">' . $post['title'] . '</a> » 修改信息';
- }
- else {
- if ($post[ismember] == 0 && !empty($manage_pwd)) {
- if (mymps_count('information', 'WHERE id = \'' . $id . '\' AND manage_pwd = \'' . md5($manage_pwd) . '\' AND ismember = 0') == 0) {
- write_msg('操作失败!您输入的管理密码不正确!');
- }
- $post['manage_pwd'] = '<tr><td class="tdr">管理密码:</td><td><input type="password" name="manage_pwd" class="text"/>
- 如不修改,请留空</td></tr>';
- $post[ismember] = 0;
- $nav_bar = '<a href="info.php?id=' . $id . '">' . $post['title'] . '</a> » <a href="../member/info.php?part=edit&id=' . $id . '">输入管理密码</a> » 修改信息';
- }
- else {
- if ($post[ismember] == 0 && empty($manage_pwd)) {
- $action = '修改';
- $title = '输入管理密码-' . $action . '信息-' . $post[title];
- $nav_bar = '<a href="../information.php?id=' . $id . '">' . $post[title] . '</a> » 输入管理密码 » ' . $action . '信息</li>';
- $post['part'] = $part;
- globalassign();
- include mymps_tpl('info_write_pwd');
- exit();
- }
- }
- }
- $post['mobile'] = $post['tel'];
- if ($mymps_global['cfg_post_editor'] == 1) {
- $acontent = get_editor('content', 'Member', $post[content], '350px', '300px', 'include/kindeditor');
- }
- else {
- $acontent = '<textarea name="content" style=\'width:400px;height:300px;\'>' . de_textarea_post_change($post[content]) . '</textarea>';
- }
- $title = '修改信息内容-' . $post['title'];
- $post['GetInfoLastTime'] = GetInfoLastTime($post['activetime']);
- $post['mymps_extra_value'] = return_category_info_options($cat['modid'], $id);
- $post['mymps_extra_value'] = is_array($post['mymps_extra_value']) ? $post['mymps_extra_value'] : array();
- $post['upload_img'] = get_upload_image_edit($cat['if_upimg'], $id);
- $post['action'] = 'edit';
- $post['submit'] = '保存修改';
- $post['select_where_option'] = cat_list('area', 0, $post[areaid]);
- $post['mixcode'] = md5($cookiepre);
- $cat = post_cat_info($catid);
- globalassign();
- include mymps_tpl('info_post_write');
- }
- else if ($action == 'ok') {
- $ok['id'] = intval($id);
- $ok['filepath'] = trim(mhtmlspecialchars($filepath));
- $ok['title'] = trim(mhtmlspecialchars($title));
- $ok['level'] = intval($level);
- $r = $db->getRow('SELECT a.dir_typename,a.userid FROM `' . $db_mymps . 'information` AS a WHERE a.id = \'' . $ok['id'] . '\'');
- $ok['info_uri'] = Rewrite('info', array('id' => $ok['id'], 'dir_typename' => $r['dir_typename']));
- if (!$title || !$id) {
- exit('Access Denied!');
- }
- $nav_bar = '信息发布状态提示';
- globalassign();
- include mymps_tpl('info_post_write_ok');
- }
- }
- is_object($db) && $db->Close();
- ?>
|