<?php
error_reporting(0);
session_start();
header("content-type:text/html;charset=utf-8");
date_default_timezone_set("PRC");
include "../sql.php";
if(isset($_SESSION['admin_name'])){$username=$_SESSION['admin_name'];}else{header("location:../index.php");exit;}

$fabu_add_tmp=$_FILES['dianji_tupian']['tmp_name'];
$fabu_add_name=$_FILES['dianji_tupian']['name'];
$fabu_add_exp=explode(".",$fabu_add_name);
$fabu_add_ext=array_pop($fabu_add_exp);
$fabu_add_old=date("YmdHis",time()).mt_rand().'.'.$fabu_add_ext;
$fabu_add_newfile="../../image/wenzhangimage/".$fabu_add_old;
$fabu_add_username=$_POST['dianji_username'];

$dianji_baioti=isset($_POST['dianji_baioti'])?$_POST['dianji_baioti']:null;
$dianji_wangzhi=isset($_POST['dianji_wangzhi'])?$_POST['dianji_wangzhi']:null;
$dianji_tiaozhuan=isset($_POST['dianji_tiaozhuan'])?$_POST['dianji_tiaozhuan']:null;
$dianji_neirong_old=isset($_POST['dianji_neirong'])?$_POST['dianji_neirong']:null;
$dianji_neirong=htmlspecialchars($dianji_neirong_old);
$shurujiner=isset($_POST['dianji_jiner'])?$_POST['dianji_jiner']:null;
$dianji_meige=isset($_POST['dianji_meige'])?$_POST['dianji_meige']:null;
$dianji_geshu=isset($_POST['dianji_geshu'])?$_POST['dianji_geshu']:null;
$dianji_jilian=isset($_POST['dianji_jilian'])?$_POST['dianji_jilian']:null;
move_uploaded_file($fabu_add_tmp,$fabu_add_newfile);

if($shurujiner!="" || $dianji_meige!=""){
    $fabu_add_sql="insert into user_renwu(biaoti,wangzhi,tiaozhuan,neirong,image,jiner,yuer,meijian,jianshu,jilian,shengyu,jieshu,username,time) values('{$dianji_baioti}','{$dianji_wangzhi}','{$dianji_tiaozhuan}','{$dianji_neirong}','{$fabu_add_old}','{$shurujiner}','{$shurujiner}','{$dianji_meige}','{$dianji_geshu}','{$dianji_jilian}','{$dianji_geshu}','0','{$username}',".time().")";
    mysql_query($fabu_add_sql);
    echo "<script>alert('发布成功！');</script>";
    echo "<script>location='../index.php';</script>";

}else{
        echo "金额不允许为空";
}
 
?>