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

📄 leads_add.php

📁 VIP信息处理系统源码
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?
include_once("../adser/top.php");

if($_POST["hnsubmit"]=="1"){
	if($_POST["totpub"]<$cfg_adsmintextpub){
		echo "广告投放量最低不能小于 $cfg_adsmintextpub 次!";
		fun_alert("广告投放量最低不能小于 $cfg_adsmintextpub 次!");
		fun_back();
		exit();
	}
	
	if($_POST["hnscnum"]>=60 && $_POST["price"]<$_POST["hnminp"]){
		fun_alert("您定制的单价小于系统中文字广告队列中最小值,您发布的广告将无法显示在文字广告中,请重新填写!");
		fun_back();
		exit();
	}
	
	$money=round($_POST["totpub"] * $_POST["price"]/10)/100;
	$minnum=$cfg_adsmintextpub*$_POST["price"]/1000;
	$totnum=$_POST["totnum"];
	if($money < $minnum){
		echo "您的广告投放量太少或您的投放单价太小!请重新提交!$money $minnum $_POST[totnum]";
		fun_alert("您的广告投放量太少或您的投放单价太小!请重新提交!");
		fun_back();
		exit();
	}
	
	$sqladz="select * from advertizer where username='$_SESSION[adser_username]'";
	$rsadz=mysql_query($sqladz);
	$rowadz=mysql_fetch_array($rsadz);
	
	$rate=$_POST["rate"]/100;
	if($_POST["over_y"]=="-" || $_POST["over_m"]=="-" || $_POST["over_d"]=="-"){
		$overtime="0000-00-00 00:00:00";
	}else{
		$overtime=$_POST["over_y"]."-".$_POST["over_m"]."-".$_POST["over_d"]." 23:59:59";
	}

	if(empty($_POST["hn_edit_id"])){
		if($money > $rowadz["balance"]){
			echo "投放数量超出了您的帐户余额!";
			fun_alert("投放数量超出了您的帐户余额!");
			fun_back();
			exit();
		}
		
		if($_POST["ads_form_id"]=="open"){
			$ads_form_id=0;
			$ads_type=2;
		}else{
			$ads_form_id=$_POST["ads_form_id"];
			$ads_type=1;
		}
		$alert_num=empty($_POST["alert_num"])?500:$_POST["alert_num"];

		$profit=$rowadz["profit"];
		$sql="INSERT INTO `ads` ( `adser_id` , `username` , `own_type` , `ads_type` , `ads_form_id` , `price` , `totpub` , `spare` , `money`, `url` ,  `link_tit` , `conn` , `time` , `overtime` ,`alert_num`, `profit`, `admin_stat`) 
						VALUES ('$_SESSION[adser_userid]','$_SESSION[adser_username]','1','3','0','$_POST[price]','$_POST[totpub]','$_POST[totpub]','$money','$_POST[url]','$_POST[link_tit]','$_POST[conn]','$datetime','$overtime','$alert_num','$profit','1')";

		$rsu=mysql_query($sql);
		//echo "$rsu = <br> $sql";
		if($rsu){
			$sql_u="UPDATE `advertizer` SET `balance` = `balance`- $money where username='$_SESSION[adser_username]'";
			$rsu=mysql_query($sql_u);
		}
		$str_mes="添加";
	}else{
		$sql="select * from ads where username='$_SESSION[adser_username]' and own_type='1' and id='$_POST[hn_edit_id]'";
		$rs=mysql_query($sql);
		$row=mysql_fetch_array($rs);
		$old_money=$row["money"];
		
		if($money-$old_money > $rowadz["balance"]){
			echo "投放数量超出了您的帐户余额!";
			fun_alert("投放数量超出了您的帐户余额!");
			fun_back();
			exit();
		}

		if(empty($file_name)){
			$picname=$row["picname"];
		}
		
		if($row["ads_stat"]=="0" && $row["admin_stat"]=="1"){
			$sql="update `ads` set  `price`= '$_POST[price]', `totpub`= '$_POST[totpub]', `spare`= '$_POST[totpub]', `money`='$money', `url` ='$_POST[url]', `link_tit`='$_POST[link_tit]' , `conn`='$_POST[conn]' ,`time`='$datetime' , `overtime` ='$overtime',`alert_num`='$alert_num', `admin_stat`=1 where id='$_POST[hn_edit_id]' and username='$_SESSION[adser_username]'";
			$rsu=mysql_query($sql);
			//echo "$rsu = <br> $sql";
		}
		if($rsu){
			$sql_u="UPDATE `advertizer` SET `balance` = `balance`- $money + $old_money where username='$_SESSION[adser_username]'";
			$rsu=mysql_query($sql_u);
		}
		$str_mes="修改";
	}
	if($rsu){
		fun_alert("广告".$str_mes."成功!");
		fun_goto("../adser/ads_stat.php");
	}else{
		fun_alert("广告".$str_mes."失败!");
		fun_back();
	}
	exit();
}

$sql="select * from advertizer where username='$_SESSION[adser_username]'";
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs);
$balance=$row["balance"];
$profit=(empty($row["profit"]))?0.8:$row["profit"];

if(!empty($_REQUEST["edit_id"])){
	$sql="select * from ads where username='$_SESSION[adser_username]' and own_type='1' and id='$_REQUEST[edit_id]'";
	$rs=mysql_query($sql);
	$rowe=mysql_fetch_array($rs);
	$ads_stat=$rowe["ads_stat"];
	$admin_stat=$rowe["admin_stat"];
	$picurl=$rowe["picname"];
	$overtime=$rowe["overtime"];
	$oy=substr($overtime,0,4);
	$om=substr($overtime,5,2);
	$od=substr($overtime,8,2);
	if($oy=="0000"){$oy="-";}
	if($om=="00"){$oy="-";}
	if($od=="00"){$oy="-";}
	if(!($ads_stat=="0" && $admin_stat=="1")){
		echo "修改广告失败!";
		fun_alert("修改广告失败!");
		fun_back();
	}
	$picurl=$rowe["picname"];
	$balance=$balance+$rowe["money"];
}

include_once("../ads_letter/scfile.php");
$scnum=count($arr_price);
$maxp=max($arr_price);
$minp=min($arr_price);

if(!empty($maxp) || !empty($minp)){
	$maxprice=empty($maxp)?"&nbsp;":"当前系统中最高单价:<span class=\"orange_text\">$maxp</span>元/千次";
	$minprice=empty($minp)?"&nbsp;":"当前系统中最低单价:<span class=\"orange_text\">$minp</span>元/千次";
	$str_vprice=$maxprice." ".$minprice;
}else{
	$str_vprice="$cfg_leadsrecom 元/1000次";
}
?>
<script>
<!--
function check_sub(){
	if(document.form1.balance.value=="0"){
		alert("您的当前帐户余额不足,请先充值!");
		return false;
	}
	
	if(check_null("广告项目名称/广告链接文字",document.form1.link_tit)){return false;}
	if(check_number("投放量",document.form1.totpub)){return false;}
	if(check_number("单价",document.form1.price)){return false;}
	
	var price=document.form1.price.value*1;
	var hnscnum=document.form1.hnscnum.value*1;
	var hnminp=document.form1.hnminp.value*1;
	if(hnscnum>=60 && price<hnminp){
		alert("您定制的单价小于系统中文字广告队列中最小值,您发布的广告将无法显示在文字广告中,请重新填写!");
		document.form1.price.focus();
		return false;
	}
	
	var totpub=document.form1.totpub.value*1;
	var minpub=document.form1.hn_minpub.value*1;
	if(totpub<minpub){
		alert("投放次数不能低于"+minpub+"次!");
		return false;
	}
	
	if(check_null("点击链接地址",document.form1.url)){return false;}
	if(check_siteurl("点击链接地址",document.form1.url)){return false;}
	if(check_null("广告简介",document.form1.conn)){return false;}
	document.form1.submit();
}

function counter(){
	var totpub=document.form1.totpub.value*1;
	var price=document.form1.price.value*1;
	var hn_balance=document.form1.hn_balance.value*1;
	var hn_profit=document.form1.hn_profit.value*1;

	var totnum=totpub*price/10;
	tot_num=Math.round(totnum);
	totnum=tot_num/100;
	document.form1.totnum.value=totnum;
	if(totnum>hn_balance){
		var totpub=Math.floor(hn_balance*1000/price);
		alert("投放数量超出了您的帐户余额!\n\n最大可以投放数量为 "+totpub+"次!");
		document.form1.totnum.value=hn_balance;

⌨️ 快捷键说明

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