コード例 #1
0
ファイル: __login.php プロジェクト: lianren/doophp.cms
 public function index()
 {
     $thisip = $this->clientIP();
     Lua::adminfail($thisip, 1);
     $username = Lua::post('username');
     $password = Lua::post('password');
     if (empty($username)) {
         Lua::admin_msg('信息提示', '请输入用户名');
     }
     if (empty($password)) {
         Lua::admin_msg('信息提示', '请输入密码');
     }
     $user = Lua::get_one("select * from lua_admin where username='******' and password='******' and gid='1'");
     if (empty($user)) {
         Lua::adminfail($thisip);
         Lua::admin_msg('信息提示', '用户名或密码错误');
     }
     $auth = Lua::authcode($user['uid'] . "\t" . $user['password'], 'ENCODE');
     $session = Doo::session('Lua');
     // 口令卡验证
     $sets = Doo::cache('php')->get('loginset');
     if ($sets && $sets['cardit'] == 1) {
         $cardcode = $session->get('cardcode');
         $cardit = intval(Lua::post('cardit'));
         if (empty($cardit)) {
             Lua::admin_msg('信息提示', '请输入口令卡');
         }
         $cardex = explode('@', $cardcode);
         $b1 = $cardex[0][1];
         $b2 = $cardex[1][1];
         $secureid = $user['secureid'];
         $sdb = Lua::get_one("select * from lua_secure where id='{$secureid}' and uid='" . $user['uid'] . "'");
         if (empty($sdb)) {
             Lua::admin_msg('信息提示', '请先绑定口令卡后再登录');
         }
         $securekey = unserialize($sdb['securekey']);
         $x = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
         $k1 = array_search($cardex[0][0], $x);
         $k2 = array_search($cardex[1][0], $x);
         $truekey = $securekey[$b1][$k1] . $securekey[$b2][$k2];
         $truekey = intval($truekey);
         if ($truekey != $cardit) {
             Lua::adminfail($thisip);
             Lua::admin_msg('信息提示', '输入的口令卡错误', '/' . ADMIN_ROOT . '/');
         }
     }
     // end
     $session->auth = $auth;
     Doo::db()->query("update lua_admin set logintime='" . time() . "',logs=logs+1,loginip='" . $this->clientIP() . "' where uid='" . $user['uid'] . "'");
     Lua::delete('lua_admin_fails', array('ip' => $thisip));
     Lua::write_log($user, '登录后台', '---', $user['channel']);
     Lua::admin_msg('操作提示', '登录成功', '/' . ADMIN_ROOT);
 }
コード例 #2
0
ファイル: __category.php プロジェクト: lianren/doophp.cms
 private function del()
 {
     $id = Lua::get('id');
     $count = Doo::db()->count("select count(*) from lua_category where systemname='" . SYSNAME . "' and upid='{$id}'");
     if ($count > 0) {
         Lua::admin_msg('提示信息', '有下级栏目');
     }
     $db = Lua::get_one("select * from lua_category where id='{$id}' and systemname='" . SYSNAME . "'");
     if ($db) {
         $models = $this->_models_tree($db['model_id']);
         if ($models) {
             foreach ($models as $row) {
                 Doo::db()->query("delete from " . $row['tablename'] . " where catid='{$id}'");
             }
         }
     }
     Lua::delete('lua_category', array('systemname' => SYSNAME, 'id' => $id));
     $this->_cache();
     Lua::write_log($this->user, '删除栏目', "catid={$id}<br />title=" . $db['name'], SYSNAME);
     Lua::admin_msg('操作提示', '成功删除', './category.htm');
 }
コード例 #3
0
ファイル: __channel.php プロジェクト: lianren/doophp.cms
 private function del()
 {
     $id = Lua::get('id');
     $db = Lua::get_one("select * from lua_channel where id='{$id}'");
     Lua::delete('lua_channel', array('id' => $id));
     Lua::delete('lua_category', array('systemname' => $db['path']));
     Lua::delete('lua_piece', array('systemname' => $db['path']));
     $list = Lua::get_more("select * from lua_model where cid='{$id}'");
     if ($list) {
         foreach ($list as $v) {
             $table = Lua::get_more("select * from lua_model_table where model_id='" . $v['id'] . "'");
             if ($table) {
                 foreach ($table as $t) {
                     Doo::db()->query("drop table `" . $t['tablename'] . "`");
                 }
             }
             Lua::delete('lua_model_table', array('model_id' => $v['id']));
             Lua::delete('lua_model_field', array('model_id' => $v['id']));
         }
     }
     Lua::delete('lua_model', array('cid' => $id));
     Lua::write_log($this->user, '删除频道', "id={$id}<br />title=" . $db['name'], SYSNAME);
     Lua::admin_msg('提示信息', '操作成功', './channel.htm');
 }
コード例 #4
0
ファイル: __tpl.php プロジェクト: lianren/doophp.cms
 private function del()
 {
     $id = intval(Lua::get('id'));
     $rs = Lua::get_one("select id from lua_category where tpl_id='{$id}'");
     if ($rs) {
         Lua::admin_msg('信息提示', '此模板已关联至某栏目下,不可删除');
     }
     $db = Lua::get_one("select * from lua_tpls where id='{$id}'");
     $file = $db['tplfile'];
     list($tpl, ) = explode('.', $file);
     if (file_exists($this->tpl_path . $file)) {
         unlink($this->tpl_path . $file);
     }
     if (file_exists($this->tpl_path . 'cache/' . $tpl . '.tpl.php')) {
         unlink($this->tpl_path . 'cache/' . $tpl . '.tpl.php');
     }
     Lua::delete('lua_tpls', array('id' => $id));
     Lua::admin_msg('信息提示', '操作成功', $this->_list($db['kindof']));
 }
コード例 #5
0
ファイル: __member.php プロジェクト: lianren/doophp.cms
 private function user_del()
 {
     $mid = Lua::get('mid');
     $mdb = $this->_model($mid);
     $uid = Lua::get('uid');
     $db = Lua::get_one("select username from lua_member where uid='{$uid}'");
     Lua::delete($mdb['tablename'], array('vuid' => $uid));
     Lua::write_log($this->user, '删除模型会员', "model_id={$mid}<br />uid={$uid}<br />title=" . $db['username'], SYSNAME);
     Lua::admin_msg('提示信息', '成功删除', "./member.htm?action=user&id={$mid}");
 }
コード例 #6
0
ファイル: __admin.php プロジェクト: lianren/doophp.cms
 private function makecard()
 {
     header("Content-Disposition: attachment; filename=card.png");
     header("Content-type: image/png");
     $uid = intval(Lua::get('uid'));
     $x = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
     $image = imagecreatefromjpeg(LUA_ROOT . ADMIN_ROOT . '/static/img/table.jpg');
     imagecolorallocate($image, 255, 255, 255);
     $black = imagecolorallocate($image, 0, 0, 0);
     $y = array();
     $_line = 9;
     $_column = 10;
     for ($i = 1; $i <= $_line; $i++) {
         for ($h = 1; $h <= $_column; $h++) {
             $num = mt_rand(100, 999);
             $y[$i][] = $num;
         }
     }
     $X_START = 33;
     $Y_START = 93;
     $ITERATIVE = 36;
     $xStart = $X_START;
     $yStart = $Y_START;
     foreach ($x as $column) {
         imagestring($image, 9, $xStart + 10, $Y_START - 30, $column, $black);
         $xStart += $ITERATIVE;
     }
     $xStart = $X_START;
     for ($i = 1; $i <= 9; $i++) {
         imagestring($image, 9, $xStart - 25, $yStart, $i, $black);
         $yStart += $ITERATIVE;
     }
     $yStart = $Y_START;
     foreach ($y as $key => $line) {
         foreach ($line as $key => $column) {
             imagestring($image, 9, $xStart, $yStart, $column, $black);
             $xStart += $ITERATIVE;
         }
         $yStart += $ITERATIVE;
         $xStart = $X_START;
     }
     imagepng($image);
     imagedestroy($image);
     $securekey = serialize($y);
     $sqlarr = array('uid' => $uid, 'securekey' => $securekey);
     Lua::delete('lua_secure', array('uid' => $uid));
     $sid = Lua::insert('lua_secure', $sqlarr);
     Lua::update('lua_admin', array('secureid' => $sid), array('uid' => $uid));
 }