function EditAd($add, $titlefont, $titlecolor, $userid, $username) { global $empire, $time, $dbtbpre; $add[adid] = (int) $add[adid]; if (!$add[classid] || !$add[title] || !$add[adtype] || !$add[adid]) { printerror("EmptyAd", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "ad"); $add[htmlcode] = AddAddsData(RepPhpAspJspcodeText($add[htmlcode])); $add[reptext] = AddAddsData(RepPhpAspJspcodeText($add[reptext])); $ttitlefont = TitleFont($titlefont, 'no'); //重置 if ($add[reset]) { $a = ",onclick=0"; } //变量处理 $add['title'] = hRepPostStr($add['title'], 1); $add[pic_width] = (int) $add[pic_width]; $add[pic_height] = (int) $add[pic_height]; $add[classid] = (int) $add[classid]; $add[adtype] = (int) $add[adtype]; $add[t] = (int) $add[t]; $add[ylink] = (int) $add[ylink]; $add['filepass'] = (int) $add['filepass']; $sql = $empire->query("update {$dbtbpre}enewsad set picurl='{$add['picurl']}',url='{$add['url']}',pic_width={$add['pic_width']},pic_height={$add['pic_height']},classid={$add['classid']},adtype={$add['adtype']},title='{$add['title']}',target='{$add['target']}',alt='{$add['alt']}',starttime='{$add['starttime']}',endtime='{$add['endtime']}',adsay='{$add['adsay']}',titlefont='{$ttitlefont}',titlecolor='{$titlecolor}',htmlcode='{$add['htmlcode']}',t={$add['t']},ylink={$add['ylink']},reptext='{$add['reptext']}'" . $a . " where adid='{$add['adid']}'"); UpdateTheFileEditOther(3, $add['adid'], 'other'); GetAdJs($add[adid]); if ($sql) { //操作日志 insert_dolog("adid=" . $add[adid] . "<br>title=" . $add[title]); printerror("EditAdSuccess", "ListAd.php?time={$time}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditClass($add, $userid, $username) { global $empire, $class_r, $dbtbpre; //修改外部栏目 if ($add[ecmsclasstype]) { EditWbClass($add, $userid, $username); } $add[classid] = (int) $add[classid]; $add[classpath] = trim($add[classpath]); $checkclasspath = $add['classpath']; if ($add['oldclasspath'] != $add['pripath'] . $add['oldcpath']) { $add[classpath] = $add['oldcpath']; } if (!$add[classname] || !$add[classpath] || !$add[modid] || !$add[classid]) { printerror("EmptyClass", ""); } if ($add[islast] && (!$add[newstempid] || !$add[listtempid])) { printerror("LastMustChange", ""); } //操作权限 CheckLevel($userid, $username, $classid, "class"); $add = DoPostClassVar($add); $add[oldmodid] = (int) $add[oldmodid]; //改变目录 $classpath = $add[pripath] . $add[classpath]; if ($add[oldclasspath] != $classpath && $checkclasspath == $add['oldcpath']) { if (file_exists("../../" . $classpath)) { //检测目录是否存在 printerror("ReClasspath", ""); } } //取得表名 $tabler = GetModTable($add[modid]); $tabler[tid] = (int) $tabler[tid]; //修改大栏目 if (!$add[islast]) { //改变大栏目 if ($add[bclassid] != $add[oldbclassid]) { //转到主栏目 if (empty($add[bclassid])) { $sonclass = ""; $featherclass = ""; //取得本栏目的子栏目 $r = $empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //改变父栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($o = $empire->fetch($osql)) { $newsonclass = str_replace($r[sonclass], "|", $o[sonclass]); $uosql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$o['classid']}'"); } //修改子栏目的父栏目 $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "%|'"); while ($o = $empire->fetch($osql)) { $newclasspath = str_replace($r[classpath] . "/", $classpath . "/", $o[classpath]); $newfeatherclass = str_replace($r[featherclass], "|", $o[featherclass]); $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$o['classid']}'"); } } else { //大栏目跟原栏目相同 if ($add[classid] == $add[bclassid]) { printerror("BclassIsself", ""); } //取得现在大栏目的值 $b = $empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'"); //检测大栏目是否为终级栏目 if ($b[islast]) { printerror("BclassNotLast", ""); } if ($b[wburl]) { printerror("BclassNotWb", ""); } //是否非法父栏目 if ($b[featherclass]) { $c_nb_r = explode("|" . $add[classid] . "|", $b[featherclass]); if (count($c_nb_r) != 1) { printerror("BclassIssmall", ""); } } if (empty($b[featherclass])) { $b[featherclass] = "|"; } $featherclass = $b[featherclass] . $add[bclassid] . "|"; //取得现在栏目本身的值 $o = $empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //修改子栏目的父栏目 $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "|%'"); while ($or = $empire->fetch($osql)) { $newclasspath = str_replace($o[classpath] . "/", $classpath . "/", $or[classpath]); if (empty($o[featherclass])) { $newfeatherclass = $b[featherclass] . $add[bclassid] . $or[featherclass]; } else { $newfeatherclass = str_replace($o[featherclass], $featherclass, $or[featherclass]); } $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$or['classid']}'"); } //改变旧大栏目的所有子栏目 $owhere = ReturnClass($o[featherclass]); if (empty($owhere)) { $owhere = "classid=0"; } $oosql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $owhere); while ($oo = $empire->fetch($oosql)) { $newsonclass = str_replace($o[sonclass], "|", $oo[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$oo['classid']}'"); } //改变新大栏目的子栏目 $where = ReturnClass($featherclass); if (empty($where)) { $where = "classid=0"; } $nbsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($nb = $empire->fetch($nbsql)) { if (empty($nb[sonclass])) { $nb[sonclass] = "|"; } $newsonclass = $nb[sonclass] . substr($o[sonclass], 1); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'"); } } $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'"; } //绑定域名应用于子栏目 if ($add['UrlToSmall']) { UpdateSmallClassDomain($add['classid'], $add['classurl'], $classpath); } //wap模板应用于子栏目 if ($add['wapstylesclass']) { $empire->query("update {$dbtbpre}enewsclass set wapstyleid='{$add['wapstyleid']}' where featherclass like '%|" . $add[classid] . "|%'"); } //修改数据库资料 $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',islist={$add['islist']},listtempid={$add['listtempid']},lencord={$add['lencord']},searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},openadd={$add['openadd']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}',repagenum='{$add['repagenum']}',keycid='{$add['keycid']}'" . $change . " where classid='{$add['classid']}'"); //副表 $ret_cr = ReturnClassAddF($add, 1); $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . eaddslashes2($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'"); //更新附件 UpdateTheFileEditOther(1, $add['classid'], 'other'); GetClass(); //生成栏目文件 if ($add[islist] == 0 || $add[islist] == 2) { $classtemp = $add[islist] == 2 ? GetClassText($add[classid]) : GetClassTemp($add['classtempid']); NewsBq($add[classid], $classtemp, 0, 1); } elseif ($add[islist] == 3) { ReClassBdInfo($add[classid]); } if ($add[islist] == 2) { //删除动态模板缓存文件 DelOneTempTmpfile('classpage' . $add[classid]); } } else { if ($add[modid] != $add[oldmodid]) { $chmtbr = GetModTable($add[oldmodid]); if ($chmtbr[tid] != $tabler[tid] && $chmtbr[tbname]) { $chmchecknum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $chmtbr[tbname] . "_index where classid='{$add['classid']}'"); if ($chmchecknum) { printerror("ClassChangeModHaveInfo", "history.go(-1)"); } } } //改变大栏目 if ($add[bclassid] != $add[oldbclassid]) { //转到主栏目 if (empty($add[bclassid])) { $sonclass = ""; $featherclass = ""; //取得栏目原本的大栏目 $r = $empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //改变原本大栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($bsql)) { $newsonclass = str_replace("|" . $add[classid] . "|", "|", $br[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'"); } } else { //取得现在大栏目的值 $b = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'"); //检测大栏目是否为终级栏目 if ($b[islast]) { printerror("BclassNotLast", ""); } if ($b[wburl]) { printerror("BclassNotWb", ""); } if (empty($b[featherclass])) { $b[featherclass] = "|"; } $featherclass = $b[featherclass] . $add[bclassid] . "|"; //改变新大栏目的子栏目 $where = ReturnClass($featherclass); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($nb = $empire->fetch($bsql)) { if (empty($nb[sonclass])) { $nb[sonclass] = "|"; } $newsonclass = $nb[sonclass] . $add[classid] . "|"; $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'"); } //改变旧大栏目的子栏目 $o = $empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); $where = ReturnClass($o[featherclass]); if (empty($where)) { $where = "classid=0"; } $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($ob = $empire->fetch($osql)) { $newsonclass = str_replace("|" . $add[classid] . "|", "|", $ob[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$ob['classid']}'"); } } $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'"; } //应用于已生成的信息 if ($add['tobetempinfo']) { UpdateAllDataTbField($tabler['tbname'], "newstempid='{$add['newstempid']}'", " where classid='{$add['classid']}'", 1); } //文件前缀 $add[filename_qz] = RepFilenameQz($add[filename_qz]); $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',link_num={$add['link_num']},lencord={$add['lencord']},newstempid={$add['newstempid']},listtempid={$add['listtempid']},newspath='{$add['newspath']}',filename={$add['filename']},filetype='{$add['filetype']}',openpl={$add['openpl']},openadd={$add['openadd']},newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},addinfofen={$add['addinfofen']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},checkqadd={$add['checkqadd']},qaddlist={$add['qaddlist']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['smallbdinfoid']}',repagenum='{$add['repagenum']}',keycid='{$add['keycid']}'" . $change . " where classid='{$add['classid']}'"); //副表 $ret_cr = ReturnClassAddF($add, 1); $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . eaddslashes2($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'"); //更新附件 UpdateTheFileEditOther(1, $add['classid'], 'other'); GetClass(); } //移动目录 if ($add[bclassid] != $add[oldbclassid] || $add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath']) { $opath = "../../" . $add[oldclasspath]; $newpath = "../../" . $classpath; MovePath($opath, $newpath); $opath = "../../data/" . $add[oldclasspath]; $npath = "../../data/" . $classpath; CopyPath($opath, $npath); } else { if ($add['oldcpath'] != $add['classpath']) { AlterClassPath($add['classid'], $add['islast'], $add['oldclasspath'], $classpath); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'"); GetClass(); } } //删除缓存文件 $cache_mid = 0; $cache_oldmid = 0; if ($add[oldclassname] != $add[classname] || $add[bclassid] != $add[oldbclassid]) { DelListEnews(); //GetSearch($add[modid]); DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='{$add['modid']}')"); $cache_mid = $add[modid]; } else { if ($add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath'] || $add[listdt] != $add[oldlistdt]) { DelListEnews(); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'"); } if ($add[openadd] != $add[oldopenadd] || $add[modid] != $add[oldmodid]) { //GetSearch($add[modid]); DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='{$add['modid']}'"); $cache_mid = $add[modid]; if ($add[modid] != $add[oldmodid]) { //GetSearch($add[oldmodid]); DelFiletext("../data/js/js/addinfo" . $add[oldmodid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='{$add['oldmodid']}'"); $cache_oldmid = $add[oldmodid]; } } } //修改栏目扩展名 if ($add[oldclasstype] != $add[classtype]) { $todaytime = date("Y-m-d H:i:s"); if ($add[islast]) { $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where classid='{$add['classid']}'"; $lencord = $add[oldlencord]; $num = $empire->gettotal($query); } else { $lencord = $add[oldlencord]; if ($add[oldislist] == 1) { $where = ReturnClass($class_r[$add[classid]][sonclass]); $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where (" . $where . ")"; $num = $empire->gettotal($query); } else { $num = 1; } } RenameListfile($add[classid], $lencord, $num, $add[oldclasstype], $add[classtype], $classpath); } //来源 if ($add['from']) { $returnurl = "ListPageClass.php"; } else { $returnurl = "ListClass.php"; } TogNotReClass(1); if ($sql) { insert_dolog("classid=" . $add[classid] . "<br>classname=" . $add[classname]); //操作日志 $cache_enews = 'doclass,doinfo,douserinfo,domod,dostemp'; $cache_ecmstourl = urlencode($returnurl . hReturnEcmsHashStrHref2(1)); $cache_mess = 'EditClassSuccess'; $cache_url = "CreateCache.php?enews={$cache_enews}&mid={$cache_mid}&oldmid={$cache_oldmid}&ecmstourl={$cache_ecmstourl}&mess={$cache_mess}" . hReturnEcmsHashStrHref2(0); //printerror("EditClassSuccess",$returnurl); echo '<meta http-equiv="refresh" content="0;url=' . $cache_url . '">'; db_close(); $empire = null; exit; } else { printerror("DbError", "history.go(-1)"); } }
function EditSpInfo($add, $userid, $username) { global $empire, $dbtbpre; $spid = (int) $add[spid]; $sid = (int) $add['sid']; if (!$spid) { printerror('ErrorUrl', ''); } //验证 $spr = CheckSpInfoLevel($spid); if ($spr[sptype] == 1) { $log = EditSpInfo1($spid, $spr, $sid, $add); } elseif ($spr[sptype] == 2) { $log = EditSpInfo2($spid, $spr, $sid, $add); } elseif ($spr[sptype] == 3) { $log = EditSpInfo3($spid, $spr, $sid, $add); } else { printerror('ErrorUrl', ''); } //删除多余碎片信息 DelMoreSpInfo($spid, $spr); //更新附件 UpdateTheFileEditOther(7, $spid, 'other'); //操作日志 insert_dolog($log); printerror("EditSpInfoSuccess", "ListSpInfo.php?spid={$spid}" . hReturnEcmsHashStrHref2(0)); }
function admin_EditMember($add, $logininid, $loginin) { global $empire, $dbtbpre; if (!trim($add[userid]) || !trim($add[email]) || !trim($add[username]) || !$add[groupid]) { printerror("EmptyEmail", "history.go(-1)"); } CheckLevel($logininid, $loginin, $classid, "member"); //验证权限 //变量 $add[userid] = (int) $add[userid]; $add[checked] = (int) $add[checked]; $add[username] = RepPostVar($add[username]); $add[oldusername] = RepPostVar($add[oldusername]); $add[password] = RepPostVar($add[password]); $add[email] = RepPostStr($add[email]); $dousername = $add[username]; $dooldusername = $add[oldusername]; //修改密码 $add1 = ''; if ($add[password]) { $salt = eReturnMemberSalt(); $add[password] = eDoMemberPw($add[password], $salt); $add1 = "," . egetmf('password') . "='{$add['password']}'," . egetmf('salt') . "='{$salt}'"; } //修改用户名 if ($add[oldusername] != $add[username]) { $num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$add['username']}' and " . egetmf('userid') . "<>" . $add[userid] . " limit 1"); $add1 .= "," . egetmf('username') . "='{$add['username']}'"; if ($num) { printerror("ReUsername", "history.go(-1)"); } } //包月 $add[zgroupid] = (int) $add[zgroupid]; if ($add[userdate] > 0) { $userdate = time() + $add[userdate] * 24 * 3600; } else { $add[zgroupid] = 0; } //变量 $add[groupid] = (int) $add[groupid]; $add[userfen] = (int) $add[userfen]; $userdate = (int) $userdate; $add[money] = (double) $add[money]; $add[spacestyleid] = (int) $add[spacestyleid]; //验证附加表必填项 $addr = $empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='{$add['userid']}'"); $fid = GetMemberFormId($add[groupid]); if (empty($addr[userid])) { $mr['add_filepass'] = $add['userid']; $member_r = ReturnDoMemberF($fid, $_POST, $mr, 0, $dousername, 1); } else { $addr['add_filepass'] = $add['userid']; $member_r = ReturnDoMemberF($fid, $_POST, $addr, 1, $dousername, 1); } $sql = $empire->query("update " . eReturnMemberTable() . " set " . egetmf('email') . "='{$add['email']}'," . egetmf('groupid') . "='{$add['groupid']}'," . egetmf('userfen') . "='{$add['userfen']}'," . egetmf('money') . "='{$add['money']}'," . egetmf('userdate') . "='{$userdate}'," . egetmf('zgroupid') . "='{$add['zgroupid']}'," . egetmf('checked') . "='{$add['checked']}'" . $add1 . " where " . egetmf('userid') . "='{$add['userid']}'"); //更改用户名 if ($add[oldusername] != $add[username]) { //短消息 $empire->query("update {$dbtbpre}enewsqmsg set to_username='******' where to_username='******'"); $empire->query("update {$dbtbpre}enewsqmsg set from_username='******' where from_username='******'"); //收藏 $empire->query("update {$dbtbpre}enewsfava set username='******' where userid='{$add['userid']}'"); //购买记录 $empire->query("update {$dbtbpre}enewsbuybak set username='******' where userid='{$add['userid']}'"); //下载记录 $empire->query("update {$dbtbpre}enewsdownrecord set username='******' where userid='{$add['userid']}'"); //信息表 $tbsql = $empire->query("select tbname from {$dbtbpre}enewstable"); while ($tbr = $empire->fetch($tbsql)) { $empire->query("update {$dbtbpre}ecms_" . $tbr['tbname'] . " set username='******' where userid='{$add['userid']}' and ismember=1"); $empire->query("update {$dbtbpre}ecms_" . $tbr['tbname'] . "_check set username='******' where userid='{$add['userid']}' and ismember=1"); } } //附加表 if (empty($addr[userid])) { $sql1 = $empire->query("insert into {$dbtbpre}enewsmemberadd(userid,spacestyleid" . $member_r[0] . ") values({$add['userid']},{$add['spacestyleid']}" . $member_r[1] . ");"); } else { $sql1 = $empire->query("update {$dbtbpre}enewsmemberadd set spacestyleid={$add['spacestyleid']}" . $member_r[0] . " where userid='{$add['userid']}'"); } //更新附件 UpdateTheFileEditOther(6, $add['userid'], 'member'); if ($sql) { insert_dolog("userid=" . $add[userid] . "<br>username="******"EditMemberSuccess", "ListMember.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function EditInfo($post) { global $empire, $dbtbpre, $public_r; $user_r = islogin(); //是否登陆 $userid = $user_r[userid]; $username = $user_r[username]; $dousername = $username; $rnd = $user_r[rnd]; $groupid = $user_r[groupid]; if (!$userid || !$username) { printerror("NotEmpty", "history.go(-1)", 1); } //验证附加表必填项 $addr = $empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='{$userid}'"); $user_r = $empire->fetch1("select " . eReturnSelectMemberF('groupid') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}'"); $fid = GetMemberFormId($user_r['groupid']); if (empty($addr[userid])) { $mr['add_filepass'] = $userid; $member_r = ReturnDoMemberF($fid, $post, $mr, 0, $dousername); } else { $addr['add_filepass'] = $userid; $member_r = ReturnDoMemberF($fid, $post, $addr, 1, $dousername); } //附加表 if (empty($addr[userid])) { //IP $regip = egetip(); $regipport = egetipport(); $lasttime = time(); $sql = $empire->query("insert into {$dbtbpre}enewsmemberadd(userid,regip,lasttime,lastip,loginnum,regipport,lastipport" . $member_r[0] . ") values('{$userid}','{$regip}','{$lasttime}','{$regip}',1,'{$regipport}','{$regipport}'" . $member_r[1] . ");"); } else { $sql = $empire->query("update {$dbtbpre}enewsmemberadd set userid='{$userid}'" . $member_r[0] . " where userid='{$userid}'"); } //更新附件 UpdateTheFileEditOther(6, $userid, 'member'); if ($sql) { printerror("EditInfoSuccess", "../member/EditInfo/", 1); } else { printerror("DbError", "history.go(-1)", 1); } }
function EditSp($add, $userid, $username) { global $empire, $dbtbpre; $add['varname'] = RepPostVar($add['varname']); $spid = (int) $add[spid]; if (!$spid || !$add[spname] || !$add[varname]) { printerror("EmptySp", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "sp"); $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssp where varname='{$add['varname']}' and spid<>{$spid} limit 1"); if ($num) { printerror("HaveSp", "history.go(-1)"); } $add[sptype] = (int) $add[sptype]; $add[cid] = (int) $add[cid]; $add[classid] = (int) $add[classid]; $add[tempid] = (int) $add[tempid]; $add[maxnum] = (int) $add[maxnum]; $sptime = time(); $groupid = ReturnSpGroup($add[groupid]); $userclass = ReturnSpGroup($add[userclass]); $username = '******' . $add[username] . ','; $add[isclose] = (int) $add[isclose]; $add[cladd] = (int) $add[cladd]; $add['refile'] = (int) $add['refile']; $add['spfile'] = DoRepFileXg($add['spfile']); $add['oldspfile'] = DoRepFileXg($add['oldspfile']); $add['spfileline'] = (int) $add['spfileline']; $add['spfilesub'] = (int) $add['spfilesub']; $add['filepass'] = (int) $add['filepass']; $sql = $empire->query("update {$dbtbpre}enewssp set spname='{$add['spname']}',varname='{$add['varname']}',sppic='{$add['sppic']}',spsay='{$add['spsay']}',sptype='{$add['sptype']}',cid='{$add['cid']}',classid='{$add['classid']}',tempid='{$add['tempid']}',maxnum='{$add['maxnum']}',groupid='{$groupid}',userclass='{$userclass}',username='******',isclose='{$add['isclose']}',cladd='{$add['cladd']}',refile='{$add['refile']}',spfile='{$add['spfile']}',spfileline='{$add['spfileline']}',spfilesub='{$add['spfilesub']}' where spid='{$spid}'"); //更新附件 UpdateTheFileEditOther(7, $spid, 'other'); //生成碎片文件 if ($add['refile']) { //旧文件 if ($add['spfile'] != $add['oldspfile']) { DelSpReFile($add['oldspfile']); } DoSpReFile($add, 0); } if ($sql) { //操作日志 insert_dolog("spid=" . $spid . "<br>spname=" . $add[spname]); printerror("EditSpSuccess", "ListSp.php?cid={$add['fcid']}&fclassid={$add['fclassid']}&fsptype={$add['fsptype']}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }