首页 > 代码库 > 广告管理

广告管理

<?php    require includes/common.inc.php;    session_start();    if ( !isset($_SESSION[username]) ) {        _location(请先登录!,login.php);    }// 添加    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]);    $_clean[sort] = _check($_POST[sort]);    $_sqlAdd = "INSERT INTO tb_picadvert VALUES (null,‘{$_clean[‘weizi‘]}‘,‘{$_clean[‘picName‘]}‘,‘{$_clean[‘picImg‘]}‘,‘{$_clean[‘picLink‘]}‘,‘{$_clean[‘isFreeze‘]}‘,0,‘{$_clean[‘sort‘]}‘)";    _query($_sqlAdd);        if ( _affected_rows() == 1 ) {        _close();        _alert_back(添加成功!);    } else {        _close();        _alert_back(添加失败!);    }}//删除    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=http://www.mamicode.com/"images/skin.css" rel="stylesheet" type="text/css" /></head><script>function test(){    if(document.admin.weizi.value=http://www.mamicode.com/=‘‘)    {        alert(请选择位置);        return false;    }        if(document.admin.picName.value=http://www.mamicode.com/=‘‘)    {        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=http://www.mamicode.com/"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=http://www.mamicode.com/"images/nav-right-bg.gif" width="16" height="29" /></td>  </tr>  <tr>    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</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=http://www.mamicode.com/picadvert.php>全部</a> <a href=http://www.mamicode.com/"?weizi=0">会员后台</a> | <a href=http://www.mamicode.com/"?weizi=1">网站首页</a> | <a href=http://www.mamicode.com/"?weizi=2">点就赚首</a> | <a href=http://www.mamicode.com/"?weizi=3">来就赚首页</a>| <a href=http://www.mamicode.com/"?weizi=4">来秒杀首页</a>| <a href=http://www.mamicode.com/"?weizi=5">抢特惠首页</a>| <a href=http://www.mamicode.com/"?weizi=6">来兑换首页</a>| <a href=http://www.mamicode.com/"?weizi=10">快捷导航</a>| <a href=http://www.mamicode.com/"?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" bgcolor="#F2F2F2">                  <td class="left_txt2"> 用户ID</td>                  <td class="left_txt2"> 广告位置</td>                  <td width="12%" class="left_txt2" >广告名称</td>                  <td width="19%" class="left_txt2" >图片</td>                  <td width="13%" class="left_txt2">连接地址</td>                  <td width="9%" class="left_txt2">排序</td>                  <td class="left_txt2">状态</td>                  <td 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="8%" class="left_txt2" ></td>                    <td width="17%" class="left_txt2" >                    <select id="weizi" name="weizi" >                        <option value=http://www.mamicode.com/"">请选择广告位置</option>                        <option value=http://www.mamicode.com/"0">会员后台</option>                        <option value=http://www.mamicode.com/"1">网站首页banner</option>                        <option value=http://www.mamicode.com/"2">点就赚首页banner</option>                        <option value=http://www.mamicode.com/"3">来就赚首页banner</option>                        <option value=http://www.mamicode.com/"4">来秒杀首页banner</option>                        <option value=http://www.mamicode.com/"5">抢特惠首页banner</option>                        <option value=http://www.mamicode.com/"6">来兑换首页banner</option>                        <option value=http://www.mamicode.com/"10">快捷导航</option>                        <option value=http://www.mamicode.com/"11">易得App首页轮播</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" />                     <input type="button" value=http://www.mamicode.com/"上传" onClick="window.open(‘upload.php?formname=admin&editname= picImg&imageUrl=images/picadvert/‘,‘‘,‘status=no,scrollbars=no,top=35,width=650,height=350‘)"/>                    </td>                    <td class="left_txt2"><input type="text" name="picLink" id="picLink" size="15"  />                    <td class="left_txt2"><input type="text" name="sort" id="sort" size="10"  />                    </td>                    <td width="11%" class="left_txt2"><select id="isFreeze" name="isFreeze">                        <option value=http://www.mamicode.com/"1">显示</option>                        <option value=http://www.mamicode.com/"0">隐藏</option>                      </select></td>                    <td width="11%" class="left_txt2"><input type="submit" name="button" id="button" value=http://www.mamicode.com/"添加" /></td>                  </tr>                </form>                <?php                           define(SCRIPT,picadvert);                global $_pagesize,$_pagenum;                if ($_GET[weizi]=="") {                    _page(SELECT id FROM tb_picadvert,10);                    $_sql = "SELECT * FROM tb_picadvert LIMIT $_pagenum,$_pagesize";                    }else{                    _page("SELECT id FROM tb_picadvert WHERE weizi = ‘{$_GET[‘weizi‘]}‘",10);                    $_sql = "SELECT * FROM tb_picadvert WHERE weizi = ‘{$_GET[‘weizi‘]}‘ LIMIT $_pagenum,$_pagesize";                        }                                $_result = _query($_sql);                    $_row = _num_rows($_result);                    if ( $_row > 0 ) {                    while ( $_rows = _fetch_array($_result) ) {                        $_html = array();                        $_html[id] = $_rows[id];                        $_html[picName] = $_rows[picName];                        $_html[picImg] = $_rows[picImg];                        $_html[picLink] = $_rows[picLink];                        $_html[sort] = $_rows[sort];                                                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] = 网站首页banner;                                break;                            case 2:                                $_html[weizi] = 点就赚首页banner ;                                break;                            case 3:                                $_html[weizi] = 来就赚首页banner;                                break;                            case 4:                                $_html[weizi] = 来秒杀首页banner;                                break;                            case 5:                                $_html[weizi] = 抢特惠首页banner;                                break;                            case 6:                                $_html[weizi] = 来兑换首页banner;                                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"  bgcolor="#F2F2F2">                  <td class="left_txt2"><?php echo $_html[userid]?></td>                  <td class="left_txt2"><?php echo $_html[weizi]?></td>                  <td class="left_txt2"><?php echo $_html[picName]?></td>                  <td class="left_txt2"><?php echo $_html[picImg]?></td>                  <td class="left_txt2"><?php echo $_html[picLink]?></td>                  <td class="left_txt2"><?php echo $_html[sort]?></td>                  <td class="left_txt2"><?php echo $_html[isFreeze]?></td>                  <td width="11%" class="left_txt2"><a href=http://www.mamicode.com/?action=delete&id=<?php echo $_html[id]?>>删除</a> | <a href=http://www.mamicode.com/picadvert_edit.php?id=<?php echo $_html[id]?>>修改</a></td>                </tr>                <?php                    }                    ?>                <?php                    } else {                    ?>                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >                  <td colspan="9">暂无信息</td>                </tr>                <?php                        }                    _free_result($_result);                    _close();                    ?>                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >                  <td colspan="9"><?php                     if($_GET[weizi]=="") {                        _paging(2);                    }else{                        _paging_parameter(2,"weizi=‘{$_GET[‘weizi‘]}‘");                    }                    ?>              </table></td>          </tr>        </table>      </div></td>    <td background="images/mail_rightbg.gif">&nbsp;</td>  </tr>  <tr>    <td valign="middle" background="images/mail_leftbg.gif"><img src=http://www.mamicode.com/"images/buttom_left2.gif" width="17" height="17" /></td>    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src=http://www.mamicode.com/"images/buttom_bgs.gif" width="17" height="17" /></td>    <td background="images/mail_rightbg.gif"><img src=http://www.mamicode.com/"images/buttom_right2.gif" width="16" height="17" /></td>  </tr></table></body></html>

 

 

 

 

广告管理