zoukankan      html  css  js  c++  java
  • php 原生 好久不写原生demo了

    <?php

    require 'common.php';
    error_reporting(E_ALL);
    //判断登录
    if (!isset($_SESSION['uname']) || empty($_SESSION['uname'])) {
    header("Location: login.php");
    }


    $wherelist=array();
    $urlist=array();
    //搜索标题
    if(!empty($_GET['subject']))
    {
    $wherelist[]=" subject like '%".$_GET['subject']."%'";
    $urllist[]="subject=".$_GET['subject'];

    }
    //搜索发件人
    if(!empty($_GET['from_email']))
    {
    $wherelist[]=" from_email like '%".$_GET['from_email']."%'";
    $urllist[]="from_email=".$_GET['from_email'];
    }

    if(!empty($_GET['to_email']))
    {
    $wherelist[]=" to_email like '%".$_GET['to_email']."%'";
    $urllist[]="to_email=".$_GET['to_email'];
    }

    $start_time = $end_time = 0;
    if(!empty($_GET['start_time'])){
    $start_time = strtotime($_GET['start_time']);
    }
    if(!empty($_GET['end_time'])){
    $end_time = strtotime($_GET['end_time']);
    }
    //如果结束时间比开始时间大
    if($end_time > $start_time){
    $wherelist[] = " create_time >=".$start_time." and create_time <=".$end_time;

    $urllist[]="start_time=".$_GET['start_time'];
    $urllist[]="end_time=".$_GET['end_time'];
    }
    //如果结束时间和开始时间一样大
    if(($end_time==$start_time)&&($end_time>0)&($start_time>0)){
    //查询当天的数据
    $s = strtotime(date('Y-m-d',$start_time));
    $e = $s+86400;

    $wherelist[] = " create_time >=".$s." and create_time <=".$e;
    $urllist[]="start_time=".$_GET['start_time'];
    $urllist[]="end_time=".$_GET['end_time'];
    }


    $where="";
    if(count($wherelist)>0)
    {
    $where =" where ".implode(' and ',$wherelist);
    $url='&'.implode('&',$urllist);

    }

    //计算总条数
    $sql = "select * from mail_send $where";
    $result = mysql_query($sql);

    // $map = isset($where)?$where:'where 1';
    if(empty($where)){
    $map = 'where status = 2';
    }else{
    $map = $where;
    $map.= ' and status = 2';

    }
    $sql2 = "select * from mail_send $map";
    $success = mysql_num_rows(mysql_query($sql2));
    $totalnum = mysql_num_rows($result);
    //每页显示条数
    $pagesize = 10;
    //总共有几页
    $maxpage=ceil($totalnum/$pagesize);
    $page = 1;
    $p = (int)$_GET['page'];
    if($p>0){
    $page = $p;
    }


    if($page>$maxpage)
    {
    $page=$maxpage;
    }
    $a = $page-1;

    $limit = " limit ".($page-1)*$pagesize.",$pagesize";
    $sql1 = "select * from mail_send {$where} order by id desc {$limit}";
    $res = mysql_query($sql1);
    // $sql = mysql_query("select * from mail_send where user_id=12689 order by id desc", $conn);
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>中宏保险</title>
    <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
    body,html{
    padding: 0px;
    margin: 0px;
    }
    .header {
    100%;
    padding: 0px;
    margin: 0px;
    background-color: #699C03;
    }

    .header-nav {
    min- 1170px;

    height: 50px;
    line-height: 50px;
    }

    .header-nav-left {
    float: left;
    padding-left: 150px;
    margin-top: 10px;
    }

    .header-nav-left h3 {
    font-size: 18px;
    line-height: 25px;
    margin: 0px;
    color: #fff;
    }

    .header-nav-right {
    float: right;
    59.9999%;
    position: relative;
    height: 50px;
    }

    .header-nav-right ul {
    padding: 0px;
    margin: 0px;
    list-style: none;
    position: absolute;
    right: 25px;
    }

    .header-nav-right ul li {
    float: left;
    margin-left: 5px;
    color: #fff;
    }

    .header-nav-right ul li a {
    color: #fff;
    text-decoration: none;

    }
    .user{
    min-980px;
    text-align: center;
    margin: 0px;
    padding: 0px;
    position: relative;
    }
    .user-list{
    470px;
    height: 250px;
    padding: 15px;
    margin: 20px auto;
    position: relative;
    border: 1px solid #DBDBDB;
    }
    .user-list ul{
    list-style: none;
    100%;
    overflow: hidden;
    height: 250px;
    position: relative;
    padding: 10px 0px;
    margin: 0px;
    }
    .user-list ul li{
    100%;
    list-style: none;
    margin-bottom:15px;
    }
    .user-list ul li i{
    color: red;
    }
    .user-list ul li label{
    display: inline-block;
    12%;
    text-align: right;
    font-size:16px;
    margin-right: 10px;
    font-family: "微软雅黑";

    }
    .user-list ul li input{
    display: inline-block;
    border: 1px solid #DBDBDB;
    border-radius:4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -ms-border-radius:4px;
    height: 30px;
    padding: 2px 5px;
    vertical-align:middle;
    }
    .buttons{
    100%;
    height:35px;
    padding: 5px 10px;
    position: absolute;
    bottom: 40px;
    left: 0px;
    right: 0px;
    }
    .openbutton,.onbutton{
    display: inline-block;
    40%;
    }
    .buttons button{
    90%;
    color: #fff;
    padding: 5px 10px;
    background-color: #4CB0F9;
    border: 1px solid #4CB0F9;
    border-radius: 4px;
    vertical-align: middle;
    height: 35px;
    line-height: 25px;
    cursor:pointer;
    }
    #form2{
    display: none;
    }
    </style>
    </head>
    <body>
    <div class="header">
    <div class="header-nav">
    <div class="header-nav-left">
    <h3>中宏保险</h3>
    </div>
    <div class="header-nav-right">
    <ul>
    <li><span>欢迎到来到网站后台</span></li>
    <li><a href="/">群发</a></li>

    <li><a href="trigger.php">触发</a></li>
    <li><a href="">退出</a></li>
    </ul>
    </div>
    </div>
    </div>
    <div class="user">
    <table border="1">

    <form action="trigger.php" method="get">
    标题:<input type="text" name="subject" value="<?php echo $_GET['subject']?>" size="8">
    发件人邮箱:<input type="text" name="from_email" value="<?php echo $_GET['from_email']?>" size="8">
    收件人邮箱:<input type="text" name="to_email" value="<?php echo $_GET['to_email']?>" size="8">
    开始时间:<input type="date" name = "start_time" value="<?php echo $_GET['start_time']?>"/>
    结束时间:<input type="date" name="end_time" value="<?php echo $_GET['end_time']?>"/>

    <!-- <input type="button" value="查看全部" onclick="window.location='searchpage.php'"> -->
    <input type="submit" value="搜索">
    </form>
    <br/>
    <table border="1" width="1500">
    <tr>
    <td>标题</td>
    <td>发件人</td>
    <td>收件人</td>
    <td>收件人邮箱</td>
    <td>回复邮箱</td>
    <td>发送时间</td>
    <td>状态</td>
    <td>模板</td>

    </tr>
    <tr>
    <?php
    while ($row= mysql_fetch_assoc($res)){?>
    <tr>
    <td><?php echo $row['subject']; ?></td>
    <td><?php echo $row['fromname']; ?></td>
    <td><?php echo $row['from_email']; ?></td>
    <td><?php echo $row['to_email']; ?></td>
    <td><?php echo $row['replyto']; ?></td>
    <td><?php echo date('Y-m-d H:i:s', $row['create_time']); ?></td>
    <td><?php echo $row['status'] == 2 ? '发送成功' : ($row['status'] == 1 ? '待发送' : '发送失败'); ?></td>
    <td>
    <input type="button" value="查看" onclick="window.location='look.php?id=<?php
    echo $row['id'];?>'">
    </td>
    </tr>
    <?php
    }
    ?>
    <tr>
    <td colspan="6">
    <?php
    echo " 当前{$page}/{$maxpage}页 共{$totalnum}条";
    echo " <a href='trigger.php?page=1{$url}'>首页</a> ";
    echo "<a href='trigger.php?page=".($page-1)."{$url}'>上一页</a>";
    echo "<a href='trigger.php?page=".($page+1)."{$url}'>下一页</a>";
    echo " <a href='trigger.php?page={$maxpage}{$url}'>尾页</a> ";
    echo '成功条数:'.$success;
    ?>
    </td>
    </table>
    </html>

  • 相关阅读:
    Git的分支的clone、提交及删除
    Linux查找整个目录下包含关键词的文件并全局替换文件内容
    解决Mysql group_concat长度限制
    SQLSERVER建立MYSQL连接服务器
    批处理创建文件夹
    表分区常用脚本
    添加别名的重要性
    floor相关
    T-SQL 小数点转换百分数
    开启MSDTC
  • 原文地址:https://www.cnblogs.com/ayanboke/p/8793930.html
Copyright © 2011-2022 走看看