⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 savepost.php

📁 make project on java
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
include'include/begin.php';
include'include/savepost.php';
nowuser();
userp1();

$annextypepost = 0;
$thumb = 0;
$jmoney = 0;
$filetype = array();
$thumb_dir = array();
$addannex = array();
$delid = array();
$delcode = array();
$delcontent = array();

$fid = (int)$_POST['fid'];
$hid=(int)$_POST['hid'];
$id = (int)$_POST['id'];
$type = $_POST['type'];
$annexdel = $_POST['delid'];
$adownnum = $_POST['downid'];


jsign($_POST['sign'])?$sign = $_POST['sign']:echoerror(0);
$wauthor = ka($_POST['wauthor'], 20);
$wid = (int)$_POST['wid'];

$f = $_POST['f'];

$wtpl=(int)$_POST['wtpl'];
$wtpl>9?$wtpl=0:NULL;

$title = $_POST['subject'];

$title = str_replace("|", '', $title);
$title = str_replace("\t", '', $title);
$subhtml = $_POST['subhtml'];
$note = $_POST['note'];
$autoimg=$_POST['autoimg'] && $userp1[13]?true:false;

$html[0] = $_POST['htmlon'] == 1?1:0;
$html[1] = $_POST['parseurloff'] == 1?1:0;
$html[2] = $_POST['smileyoff'] == 1?1:0;
$html[3] = $_POST['bbcodeoff'] == 1?1:0;
$html[4] = $_POST['signoff'] == 1?1:0;

ksort($html);
reset($html);

$titlefont = is_numeric($_POST['titlefont'])?$_POST['titlefont']:0;
$lock = $_POST['lock'];
$elite = $_POST['elite'];
$updown = $_POST['updown'];
$money = (int)$_POST['money'];
$moneytype = $_POST['moneytype'] == 0?0:1;
$title = trim($title);
$content = trim($_POST['message']);
$content_strlen = bstrlen($content);
$content_strlen < $pols_min?echoerror(81):null;
$content_strlen > $pols_max?echoerror(82):null;

if ($type == 'newtopic' && $wid > 0) {

if (!$userp2[9]) {
 echoerror(143);       
    } 

    
	$title_strlen = bstrlen($title);

    $title_strlen < $title_min?echoerror(79):null;
    $title_strlen > $title_max?echoerror(80):null;

if (isset($whype[$wid])) {
$userp3=NULL;
$menufile = 'wmenu' . $wid;
    wstyle($t4[$wid]);
    include language();
    $pagename_n = $wname[$wid];
	$pagename_m = $_pagename[11];
$webnav=$wups[$wid]>0?$wname[$wups[$wid]]:$wname[$wid];		
} else {
    echoerror(70);
} 	
	
	
    $_posttime = $time - $user["posttime"];
    if ($_posttime > 0) {
        if (($userp1[6] - $_posttime) > 0) echoerror(3);
    } else {
        echoerror(3);
    } 

    $subhtml = 0;
    $titlefont = 0;
    $lock = 0;
    $elite = 0;
    $updown = 0;

    $html[0] = $html[0] == 1?1:0;
    $fre = (int)$_POST['fre'];

    $freval = 0;

    if ($fre == 2 || $fre == 3) $freval = $fre;
    $money = 0;
    $result = mysql_query("select * from {$db_prefix}annex where sign='$sign'", $myconn);
    while ($row = mysql_fetch_array($result)) {
        if ($row['tid'] > 0) echoerror(137);

        if (@in_array($row['id'], $annexdel)) {
            $delid[] = $row['id'];
            $delcode[$row['id']] = $row['code'];
            $delcontent[$row['id']] = $row['content'];
            continue;
        } 

        $addannex[$row['id']] = $row['id'];
        $filetype[$row['id']] = $row['filetype'];
        $annexdir[$row['id']] = $row['content'];

        $annextypepost = 1; 
    } 
	$taddannex=$addannex;
    while (list (, $did) = @each($delid)) {
        if ($delcode[$did] == 'file') {
            @unlink("$softdir/uploads/" . $delcontent[$did]);
        } 
        mysql_query("delete from {$db_prefix}annex where id='$did'", $myconn);
    } 

if ($userp1[8]) {
foreach($addannex as $nid) {
$val=(int)$adownnum[$nid];
if ($val>0 && $val<9999999)  mysql_query("update {$db_prefix}annex set downnum='$val' where id='$nid'", $myconn);
}
}


    formatpost();
    $htmls = implode('|', $html);
    if ($_POST['wforum'] && isset($forumnames[$_POST['wforum']])) {
        $wadmin = $username;
        $fid = $_POST['wforum'];
        $wposttime = $time;
		
    } else {
	$wtpl=0;
        $wadmin = '';
        $wauthor = '';
        $fid = 0;
		$wposttime = 0;
    } 

    mysql_query("insert into {$db_prefix}posts (tid,author, authorid,state,posttime,content,postip,sign,html,annex) values('0','$username', '$user[id]','1','$time','$content','$_SERVER[REMOTE_ADDR]','$sign','$htmls','$annextypepost')", $myconn);
    $insert_id = mysql_insert_id();
    if ($annextypepost == 1) {
        mysql_query("update {$db_prefix}annex set tid='$insert_id',fix='1' where sign='$sign'", $myconn);
    } 
    mysql_query("update {$db_prefix}posts set  tid='$insert_id' where id='$insert_id'", $myconn);
    mysql_query("insert into {$db_prefix}title (fid,cid,wid,tpl,titlefont,author,wadmin,title,locks,elite,updown,posttime,posttimeup,lastposttime,html,money,moneytype,thumb,recommend,wauthor,wposttime) values('$fid','$insert_id','$wid','$wtpl','$titlefont','$username','$wadmin','$title','$lock','$elite','$updown','$time','$time','$time','$subhtml','$money','$moneytype','$thumb','$freval','$wauthor','$wposttime')", $myconn) or die(mysql_error());
    if ($fid>0){
	$content = substrs(str_replace("\t", "", $content), 24, 'sql');
    $title = substrs(str_replace("\t", "", $title), 24, 'sql');
    $consdf = "$username\t$time\tread.php?tid=$insert_id\t$title\t\t$content";
    ka($consdf, 100);
    mysql_query("update {$db_prefix}forums set  lastpost='$consdf',tcount=tcount+1,count=count+1,pcount=pcount+1 where fid='$fid'", $myconn);
   }
    $userrank = rank($user["postnum"], $user["a"], $user["b"], $user["c"]);
    $rankco = $vp * $userrank + 1.0;
    if ($userp2[10]) $money = 0;
    $a = number_format($tvp[0] * $rankco) - $money;
    $b = number_format($tvp[1] * $rankco);
    $c = number_format($tvp[2] * $rankco);

    @mysql_query("update {$db_prefix}members set a=a+'$a',b=b+'$b',c=c+'$c',posttime='$time',postnum=postnum+'1' where id='$user[id]'", $myconn);
    if ($thumb >0) {
        if ($freval > 0) @unlink('cache/new.twt');

        $updir = $softdir . '/thumbs/' . floor($insert_id / 10000);
        if (!is_dir($updir)) {
            if (@mkdir($updir, 0777) == false) echoerror(9);
        } 

        makethumb($softdir . '/uploads/' . $thumb_dir, $updir . '/' . $insert_id . '.jpg', $thumb_type, $freval, $updir . '/' . $insert_id . '_m.jpg');
    } 
    $reurl = 'vread.php?tid=' . $insert_id;

    echoioy(1);
}else if ($type == 'newtopic' && $fid > 0) {
    
    $title_strlen = bstrlen($title);

    $title_strlen < $title_min?echoerror(79):null;
    $title_strlen > $title_max?echoerror(80):null;

    forumpurview();
    include language();
    $_posttime = $time - $user["posttime"];
    if ($_posttime > 0) {
        if (($userp1[6] - $_posttime) > 0) echoerror(3);
    } else {
        echoerror(3);
    } 

    $userp3[3]?null:echoerror(78);
    $userp3[4]?null:echoerror(11);
    $subhtml = $userp3[32] && $subhtml == 1?1:0;
    $titlefont = $userp3[30]?$titlefont:0;
    $lock = $userp3[20] && $lock == 1?1:0;
    $elite = $userp3[21] && $elite == 1?1:0;
    $updown == 1 && $userp3[23] || $updown == 2 && $userp3[24] || $updown == 3 && $userp3[25] || $updown == 4 && $userp3[26] || $updown == 5 && $userp3[27] || $updown == 6 && $userp3[28]?null:$updown = 0;

    if ($updown) @unlink('./cache/updown.php');

    $html[0] = $userp3[33] && $html[0] == 1?1:0;
    $fre = (int)$_POST["fre"];

    $freval = 0;
    if ($fre == 1 && $userp3[10]) $freval = 1;
    if (($fre == 2 || $fre == 3) && $userp2[9]) $freval = $fre;
    if ($money > 0) {
        if ($money < 10) echoerror(114);
        if (!$userp2[10]) $money = $money <= $user['a']?$money:0;
        if ($money > 65000) echoerror(142);
    } else {
        $money = 0;
    } 
    $result = mysql_query("select * from {$db_prefix}annex where sign='$sign'", $myconn);
    while ($row = mysql_fetch_array($result)) {
        if ($row['tid'] > 0) echoerror(137);

        if (@in_array($row['id'], $annexdel)) {
            $delid[] = $row['id'];
            $delcode[$row['id']] = $row['code'];
            $delcontent[$row['id']] = $row['content'];
            continue;
        } 

        $addannex[$row['id']] = $row['id'];
        $filetype[$row['id']] = $row['filetype'];
        $annexdir[$row['id']] = $row['content'];

        $annextypepost = 1; 
    } 
	$taddannex=$addannex;
    while (list (, $did) = @each($delid)) {
        if ($delcode[$did] == 'file') {
            @unlink("$softdir/uploads/" . $delcontent[$did]);
        } 
        mysql_query("delete from {$db_prefix}annex where id='$did'", $myconn);
    } 

if ($userp1[8]) {
foreach($addannex as $nid) {
$val=(int)$adownnum[$nid];
if ($val>0 && $val<9999999)  mysql_query("update {$db_prefix}annex set downnum='$val' where id='$nid'", $myconn);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -