PHP 源码
<?php
require ‘includes/common.inc.php‘;
session_start();
if ( !isset($_SESSION[‘username‘]) ) {
_location(‘请先登录!‘,‘login.php‘);
}
define(‘SCRIPT‘,‘picadvert‘);
if ( @$_GET[‘action‘] == ‘add‘ ) {
$_clean = array();
$_clean[‘weizi‘] = _check($_POST[‘weizi‘]);
$_clean[‘picName‘] = _check($_POST[‘picName‘]);
$_clean[‘picImg‘] = _check($_POST[‘picImg‘]);
$_clean[‘picLink‘] = _check($_POST[‘picLink‘]);
$_clean[‘isFreeze‘] = _check($_POST[‘isFreeze‘]);
$_sqlAdd = "INSERT INTO tb_picadvert VALUES (null,‘{$_clean[‘weizi‘]}‘,0,‘{$_clean[‘picName‘]}‘,‘{$_clean[‘picImg‘]}‘,‘{$_clean[‘picLink‘]}‘,‘{$_clean[‘isFreeze‘]}‘)";
_query($_sqlAdd);
if ( _affected_rows() == 1 ) {
_close();
_alert_back(‘添加成功!‘);
} else {
_close();
_alert_back(‘添加失败!‘);
}
}
?>
<?php
global $_pagesize,$_pagenum;
if ( !isset($_GET[‘weizi‘])) {
_page(‘SELECT id FROM tb_picadvert‘,10);
$_sql = "SELECT * FROM tb_picadvert LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 0 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 0‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 0 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 1 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 1‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 1 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 2 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 2‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 2 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 3 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 3‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 3 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 4 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 4‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 4 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 5 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 5‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 5 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 6 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 6‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 6 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 7 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 7‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 7 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 8 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 8‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 8 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 9 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 9‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 9 LIMIT $_pagenum,$_pagesize";
} elseif ( @$_GET[‘weizi‘] == 10 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 10‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 10 LIMIT $_pagenum,$_pagesize";
}
elseif ( @$_GET[‘weizi‘] == 11 ) {
_page(‘SELECT id FROM tb_picadvert WHERE weizi = 11‘,10);
$_sql = "SELECT * FROM tb_picadvert WHERE weizi = 11 LIMIT $_pagenum,$_pagesize";
}
$_result = _query($_sql);
if ( isset($_GET[‘id‘]) && $_GET[‘action‘] = ‘delete‘ ) {
$_sql1 = "DELETE FROM tb_picadvert WHERE id = ‘{$_GET[‘id‘]}‘";
_query($_sql1);
if ( _affected_rows() == 1 ) {
_close();
_alert_back(‘删除成功!‘);
} else {
_close();
_alert_back(‘删除失败!‘);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<script>
function test()
{
if(document.admin.weizi.value==‘‘)
{
alert(‘请选择位置‘);
return false;
}
if(document.admin.picName.value==‘‘)
{
alert(‘请输入广告名称‘);
return false;
}
}
</script>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
<td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
<tr>
<td height="31"><div class="titlebt">广告管理</div></td>
</tr>
</table></td>
<td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
</tr>
<tr>
<td height="71" valign="middle" background="images/mail_leftbg.gif"> </td>
<td valign="top" bgcolor="#F7F8F9"><div>
<!---->
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"><div style="font-size:12px;line-height:20px;">查看:
<a href=‘picadvert.php‘>全部</a>
<a href="?weizi=0">会员后台</a> |
<a href="?weizi=1">网站首页轮播广告</a> |
<a href="?weizi=2">点就赚首页轮播广告 </a> |
<a href="?weizi=3">疯狂秒杀轮播广告</a>|
<a href="?weizi=4">疯狂秒杀左下部广告</a>|
<a href="?weizi=5">来就赚首页轮播广告</a>|
<a href="?weizi=6">易币商城轮播广告</a>|
<a href="?weizi=7">易币商城左下部广告</a>|
<a href="?weizi=8">特惠区轮播广告</a>|
<a href="?weizi=9">特惠区左下部广告</a>|
<a href="?weizi=10">快捷导航</a>|
<a href="?weizi=11">易得App首页轮播</a>
<div style="border-right:50" align="center"> </div>
</div>
</td>
</tr>
<tr>
<td><table width="100%" height="104" border:"solid 2px #CCC" cellpadding="0" cellspacing="0" class="nowtable">
<tr align="center" >
<td bgcolor="#F2F2F2" class="left_txt2"> 用户ID</td>
<td bgcolor="#F2F2F2" class="left_txt2"> 广告位置</td>
<td width="15%" bgcolor="#F2F2F2" class="left_txt2" >广告名称</td>
<td width="14%" bgcolor="#F2F2F2" class="left_txt2">连接地址</td>
<td width="17%" bgcolor="#F2F2F2" class="left_txt2" >图片</td>
<td bgcolor="#F2F2F2" class="left_txt2">状态</td>
<td bgcolor="#F2F2F2" class="left_txt2" >操作</td>
</tr>
<form name="admin" id="admin" method="POST" action="?action=add" onsubmit="return test();">
<tr align="center" bgcolor="#F2F2F2" class="left_txt2">
<td width="15%" class="left_txt2" ></td>
<td width="15%" class="left_txt2" >
<select id="weizi" name="weizi" >
<option value="">请选择广告位置</option>
<option value="0">会员后台</option>
<option value="1">网站首页轮播广告</option>
<option value="2">点就赚首页轮播广告 </option>
<option value="3">疯狂秒杀轮播广告</option>
<option value="4">疯狂秒杀左下部广告</option>
<option value="5">悬赏令左下部广告</option>
<option value="6">易币商城轮播广告</option>
<option value="7">易币商城左下部广告</option>
<option value="8">特惠区轮播广告</option>
<option value="9">特惠区左下部广告</option>
<option value="10">快捷导航</option>
</select></td>
<td class="left_txt2"><input name="picName" type="text" id="picName" size="15" /></td>
<td class="left_txt2"><input name="picImg" type="text" id="picImg" size="15" /></td>
<td class="left_txt2"><input type="text" name="picLink" id="picLink" size="15" />
<input type="button" value="上传" onClick="window.open(‘../admin/upload.php?formname=admin&editname=adImage‘,‘‘,‘status=no,scrollbars=no,top=35,width=650,height=350‘)"/></td>
<td width="9%" class="left_txt2"><select id="isFreeze" name="isFreeze">
<option value="1">显示</option>
<option value="0">隐藏</option>
</select></td>
<td width="15%" class="left_txt2"><input type="submit" name="button" id="button" value="添加" /></td>
</tr>
</form>
<?php
$_row = _num_rows($_result);
if ( $_row > 0 ) {
while ( $_rows = _fetch_array($_result) ) {
$_html = array();
$_html[‘id‘] = $_rows[‘id‘];
$_html[‘weizi‘] = $_rows[‘weizi‘];
$_html[‘picName‘] = $_rows[‘picName‘];
$_html[‘picImg‘] = $_rows[‘picImg‘];
$_html[‘picLink‘] = $_rows[‘picLink‘];
switch ( $_rows[‘userid‘] ) {
case 0:
$_html[‘userid‘] = ‘易得网发布‘;
break;
default:
$_html[‘userid‘] = $_rows[‘userid‘];
}
switch ( $_rows[‘weizi‘] ) {
case 0:
$_html[‘weizi‘] = ‘会员后台‘;
break;
case 1:
$_html[‘weizi‘] = ‘网站首页轮播广告‘;
break;
case 2:
$_html[‘weizi‘] = ‘点就赚首页轮播广告‘;
break;
case 3:
$_html[‘weizi‘] = ‘疯狂秒杀轮播广告‘;
break;
case 4:
$_html[‘weizi‘] = ‘疯狂秒杀左下部广告‘;
break;
case 5:
$_html[‘weizi‘] = ‘来就赚首页轮播广告‘;
break;
case 6:
$_html[‘weizi‘] = ‘易币商城轮播广告‘;
break;
case 7:
$_html[‘weizi‘] = ‘易币商城左下部广告‘;
break;
case 8:
$_html[‘weizi‘] = ‘特惠区轮播广告‘;
break;
case 9:
$_html[‘weizi‘] = ‘特惠区左下部广告‘;
break;
case 10:
$_html[‘weizi‘] = ‘快捷导航‘;
break;
case 11:
$_html[‘weizi‘] = ‘易得网Android App首页轮播‘;
break;
}
switch ( $_rows[‘isFreeze‘] ) {
case 0:
$_html[‘isFreeze‘] = ‘隐藏‘;
break;
case 1:
$_html[‘isFreeze‘] = ‘显示‘;
break;
}
$_html = _html($_html);
?>
<tr class="left_txt2" align="center" >
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘userid‘]?></td>
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘weizi‘]?></td>
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picName‘]?></td>
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picImg‘]?></td>
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picLink‘]?></td>
<td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘isFreeze‘]?></td>
<td width="15%" bgcolor="#F2F2F2" class="left_txt2">
<a href=‘?action=delete&id=<?php echo $_html[‘id‘]?>‘>删除</a> |
<a href=‘picadvert_edit.php?id=<?php echo $_html[‘id‘]?>‘>修改</a></td>
</tr>
<?php
}
_free_result($_result);
_close();
?>
<?php
} else {
echo "<tr><td colspan=‘7‘><div style=‘text-align:center;color:red;font-size:16px;‘>暂无广告位广告</div></td></tr>";
}
?>
</table></td>
</tr>
</table>
<?php
_paging(2);
?>
</div></td>
<td background="images/mail_rightbg.gif"> </td>
</tr>
<tr>
<td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
<td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
<td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
</tr>
</table>
</body>
</html>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。