📄 ads_addnum.php
字号:
<?
include_once("../adser/top.php");
$adsid=(!empty($_POST["hn_adsid"]))?$_POST["hn_adsid"]:$_REQUEST["adsid"];
$sql="select * from ads where username='$_SESSION[adser_username]' and own_type='1' and id='$adsid'";
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs);
$ads_stat=$row["ads_stat"];
if($ads_stat==3){
echo "不能增加投放量!此广告已撤消!如果您要继续投放,请新增广告!";
fun_alert("不能增加投放量!此广告已撤消!如果您要继续投放,请新增广告!");
fun_goto("ads_add.php");
exit();
}
$sqla="select * from advertizer where username='$_SESSION[adser_username]'";
$rsa=mysql_query($sqla);
$rowa=mysql_fetch_array($rsa);
if($row[ads_type]==3 || $row[ads_type]==4){
$maxpub=floor($rowa[balance]*1000/$row[price]);
}else{
$maxpub=floor($rowa[balance]*1000/($row[price]*((1+$row[rate]) * (1+$row[rate]) +0.1)));
}
if($_POST["Submit"]=="确认提交" && !empty($_POST["addnum"])){
if($row["ads_type"]==3 || $row["ads_type"]==4){
$totnum=round($_POST["addnum"] * $row[price]/1000 *100)/100;
}else{
$totnum=round($_POST["addnum"] * $row[price]/1000 * ((1+$row[rate]) * (1+$row[rate]) +0.1) * 100)/100;
}
if($totnum>$rowa[balance] || $_POST["addnum"]>$maxpub){
fun_alert("您请求增加的投放数量超出了您的帐户余额!\n最大可以增加的投放次数为 $maxpub 次!");
fun_back();
exit();
}
$upsql="update advertizer set balance=balance-$totnum where id='$rowa[id]'";
$upre=mysql_query($upsql);
$upsql="update ads set totpub=totpub+$addnum,spare=spare+$addnum,money=money+$totnum where id='$_POST[hn_adsid]'";
$upre=mysql_query($upsql);
if($upre){
fun_alert("增加广告投放量成功!");
fun_goto("./ads_stat.php");
}else{
fun_alert("增加广告投放量失败!");
fun_back();
}
exit();
}
?>
<script>
function check_sub(){
if(check_null("增加投放数量",document.addform.addnum)){return false;}
if(check_number("增加投放数量",document.addform.addnum)){return false;}
maxpub=Math.floor(document.addform.maxpub.value);
minpub=document.addform.minpub.value*1;
addnum=document.addform.addnum.value*1;
if(addnum>maxpub){
alert("您请求增加的投放数量超出了您的帐户余额!\n\n最大可以增加的投放次数为 "+maxpub+"次!");
document.addform.addnum.value=maxpub;
document.addform.addnum.focus();
return false;
}
if(addnum<minpub){
alert("最小可以增加的投放次数为 "+minpub+"次!");
document.addform.addnum.focus();
return false;
}
return true;
}
function counter(){
maxpub=Math.floor(document.addform.maxpub.value);
minpub=document.addform.minpub.value*1;
addnum=document.addform.addnum.value*1;
hn_price=document.addform.hn_price.value*1;
if(addnum>maxpub){
alert("您请求增加的投放数量超出了您的帐户余额!\n 最大可以增加的投放次数为 "+maxpub+"次!");
document.addform.addnum.value=maxpub;
document.addform.addnum.focus();
return false;
}
if(document.addform.hnads_type.value==3 || document.addform.hnads_type.value==4){
totnum=Math.round(addnum * hn_price /10)/100;
}else if(document.addform.hnads_type.value==2){
totnum=Math.round(addnum * hn_price /10 * 1.1)/100;
}else{
hn_rate=document.addform.hn_rate.value*1;
totnum=Math.round(addnum * hn_price /1000 * ((1 + hn_rate) * (1 + hn_rate) + 0.1) * 100)/100;
}
document.addform.totnum.value=totnum;
return true;
}
</script>
<table width="1001" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f7f7f7">
<tr>
<td width="200" height="323" valign="top" bgcolor="#E8EEF4">
<?
include("menu.php");
?></td>
<td align="center" valign="top" class="bgconn">
<table width="98%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td height="40" class="orange_text">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="left" valign="middle"><img src="../image/addadamo.gif" width="150" height="20"></td>
</tr>
<tr>
<td align="center" valign="middle">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="left" valign="middle"> 在此增加广告的投放数量。</td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" align="left" valign="middle">
<table width="50%" border="0" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td width="5%"><img src="../image/bot14.gif" width="16" height="16"></td>
<td width="52%" align="left"><a href="message_add.php?tit=增加广告投放量"><span class="bluetext">关于本问题给我们留言</span></a></td>
<td width="6%"><img src="../image/bot13.gif" width="16" height="16"></td>
<td width="37%" align="left">电话:
<?=$cfg_phone?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="4" bgcolor="#556D85" ></td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="1" cellpadding="6" class="listtable">
<form name="addform" method="post" action="" onsubmit="return check_sub()">
<tr align="center" class="listbody">
<td colspan="2" class="listtbhd"><div align="center" >增加广告投放数量</div></td>
</tr>
<tr class="listbody">
<td width="22%"> <div align="right">项目名称/链接文字:</div></td>
<td width="78%"><? echo $row[link_tit];?> <input name="hn_adsid" type="hidden" id="hn_adsid" value="<?=$_REQUEST["adsid"]?>"></td>
</tr>
<tr class="listbody">
<td><div align="right">当前总投放量:</div></td>
<td><? echo $row[totpub];?> 次 </td>
</tr>
<tr class="listbody">
<td><div align="right">当前剩余投放:</div></td>
<td><? echo $row[spare];?> 次 </td>
</tr>
<tr class="listbody">
<td><div align="right">当前投放单价:</div></td>
<td>
<? echo $row[price];?>
元/1000次
<input name="hn_price" type="hidden" id="hn_price" value="<?=$row["price"]?>"></td>
</tr>
<? if($row[ads_type]==1){?>
<tr class="listbody">
<td><div align="right">最高点/弹比例:</div></td>
<td>
<? $rate=$row[rate]*100;echo $rate;?>%
<input name="hn_rate" type="hidden" id="hn_rate" value="<?=$row["rate"]?>"></td>
</tr>
<? }?>
<tr class="listbody">
<td><div align="right">当前帐户余额:</div></td>
<td><? echo (empty($rowa[balance]))?"0":$rowa[balance];?> 元
<input name="maxpub" type="hidden" id="maxpub" value="<? echo $maxpub;?>">
<input name="minpub" type="hidden" id="minpub" value="<? echo $cfg_adsaddnum;?>">
<input name="hn_balance" type="hidden" id="hn_balance" value="<?=$rowa[balance]?>">
<input name="hnads_type" type="hidden" id="hnads_type" value="<?=$row[ads_type]?>">
</td>
</tr>
<tr class="listbody">
<td><div align="right">增加投放数量:</div></td>
<td><div align="left">
<input name="addnum" type="text" id="addnum" size="8" maxlength="11" class="text" onKeyUp="counter()">
次(最少<? echo $cfg_adsaddnum;?>次)</div></td>
</tr>
<tr class="listbody">
<td><div align="right">金 额:</div></td>
<td><div align="left">
<input name="totnum" type="text" id="totnum" size="8" maxlength="11" class="text" readonly="">
元</div></td>
</tr>
<tr class="listbody">
<td> </td>
<td><input name="Submit" type="submit" value="确认提交" class="subbt"> <input type="button" name="Submit2" value="返回上页" onClick="history.go(-1)" class="subbt"></td>
</tr></form>
</table>
<p> </p></td>
</tr>
</table>
<?
include("../adser/foot.php");
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -