123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- // by 请勿倒卖,已申请软著,否则追究法律责任
- namespace app\admin;
- class ldurl extends Base
- {
- public function initialize()
- {
- parent::initialize();
- $this->Administrator(3);
- $this->header();
- }
- public function __destruct()
- {
- $this->footer();
- }
- function index($map = [])
- {
- $result = db('ldurl')->select();
- $count = db('ldurl')->count();
- ?> <div class="container">
- <?php
- $this->nav3();
- ?> <table class="tb tb2">
- <tr>
- <th class="partition">域名列表</th>
- </tr>
- </table>
- <form name="form" method="post" action="?c=ldurl&a=editsave">
- <table class="tb tb2">
- <tr class="header">
- <th>编号</th>
- <th>域名</th>
- <th>状态</th>
- <th>排序</th>
- <th>操作</th>
- </tr>
- <?php
- if ($count == 0) {
- ?> <tr>
- <td colspan="2" class="td27">没有落地域名</td>
- </tr>
- <?php
- } else {
- foreach ($result as $row) {
- ?> <tr class="hover">
- <td class="td25"><input class="checkbox" type="checkbox" name="in_id[]"
- value="<?php echo $row['in_id'];?>"><?php echo $row['in_id'];?> </td>
- <td class="td29"><?php echo $row['in_url'];?></td>
- <td class="td29">
- <select name="in_status<?php echo $row['in_id'];?>">
- <option value="0">关闭</option>
- <option value="1" <?php
- if ($row['in_status']) {
- ?>selected<?php
- }
- ?>>开启</option>
- </select>
- </td>
- <td>
- <div class="parentboard"><input type="text"
- name="in_sort<?php echo $row['in_id'];?>"
- value="<?php echo $row['in_sort'];?>" class="txt"/>
- </div>
- </td>
- <td><input type="button" class="btn" value="删除"
- onclick="location.href='?c=ldurl&a=del&in_id=<?php echo $row['in_id'];?>'"/>
- </td>
- </tr>
- <?php
- }
- }
- ?></table>
- <table class="tb tb2">
- <tr>
- <td class="td25"><input type="checkbox" id="chkall" class="checkbox"
- onclick="CheckAll(this.form)"/><label
- for="chkall">全选</label></td>
- <td colspan="15">
- <div class="fixsel"><input type="submit" class="btn" name="editsave" value="批量修改"/></div>
- </td>
- </tr>
- </table>
- </form>
- <table class="tb tb2">
- <tr>
- <th class="partition">新增域名</th>
- </tr>
- </table>
- <form method="post" action="?c=ldurl&a=saveadd">
- <table class="tb tb2">
- <tr>
- <td>域名</td>
- <td><input type="text" class="txt" name="in_url" id="in_url" style="margin:0;width:200px"></td>
- </tr>
- <tr>
- <td colspan="15">
- <div class="fixsel"><input type="submit" id="btnadd" name="saveadd" class="btn"
- value="新增域名"/>
- </div>
- </td>
- </tr>
- </table>
- </form>
- </div>
- <?php
- }
- function saveadd()
- {
- if (!submitcheck('saveadd')) {
- $this->ShowMessage("表单验证不符,无法提交!", $_SERVER['PHP_SELF'], "infotitle3", 3000, 1);
- }
- $in_url = SafeRequest("in_url", "post");
- if (empty($in_url)) {
- $this->ShowMessage("新增出错,域名不能为空!", "?c=ldurl", "infotitle3", 1000, 1);
- }
- $find = db('ldurl')->where('in_url', $in_url)->count();
- if (!$find) {
- db('ldurl')->insert(array('in_url' => $in_url));
- }
- $this->ShowMessage("恭喜您,域名新增成功!", "?c=ldurl", "infotitle2", 1000, 1);
- }
- function editsave()
- {
- if (!submitcheck('editsave')) {
- $this->ShowMessage("表单验证不符,无法提交!", $_SERVER['PHP_SELF'], "infotitle3", 3000, 1);
- }
- $in_id = RequestBox("in_id");
- if ($in_id == 0) {
- $this->ShowMessage("修改失败,请先勾选要编辑的域名!", "?c=ldurl", "infotitle3", 3000, 1);
- } else {
- $ID = explode(',', $in_id);
- for ($i = 0; $i < count($ID); $i++) {
- $in_status = SafeRequest("in_status" . $ID[$i], "post");
- $in_sort = SafeRequest("in_sort" . $ID[$i], "post");
- db('ldurl')->where('in_id', $ID[$i])->update(array('in_status' => $in_status, 'in_sort' => $in_sort));
- }
- $this->ShowMessage("恭喜您,域名批量修改成功!", "?c=ldurl", "infotitle2", 3000, 1);
- }
- }
- function del()
- {
- $in_id = intval(SafeRequest("in_id", "get"));
- db('ldurl')->where('in_id', $in_id)->delete();
- $this->ShowMessage("恭喜您,域名删除成功!", "?c=ldurl", "infotitle2", 3000, 1);
- }
- }
|