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); }
private function save() { $name = Lua::post('name'); if (empty($name)) { Lua::ajaxmessage('error', '栏目名称'); } $model_id = Lua::post('model_id'); if (empty($model_id)) { Lua::ajaxmessage('error', '请选择模型'); } $filename = Lua::post('filename'); if (empty($filename)) { Lua::ajaxmessage('error', '静态名称'); } $sqlarr = array('add_perm' => Lua::post('add_perm'), 'name' => $name, 'seoinfo' => Lua::post('seoinfo'), 'seokey' => Lua::post('seokey'), 'title' => Lua::post('title'), 'vieworder' => Lua::post('vieworder'), 'filename' => $filename, 'model_id' => $model_id, 'systemname' => SYSNAME, 'upid' => Lua::post('upid')); $lastid = Lua::insert('lua_category', $sqlarr); $this->_cache(); Lua::write_log($this->user, '添加栏目', "catid={$lastid}<br />title=" . $name, SYSNAME); Lua::ajaxmessage('success', '操作成功', './category.htm'); }
private function save_add() { $cid = Lua::post('cid'); if (empty($cid)) { Lua::ajaxmessage('error', '请选择所属频道'); } $modelname = Lua::post('modelname'); if (empty($modelname)) { Lua::ajaxmessage('error', '模型名称'); } $developer = Lua::post('developer'); if (empty($developer)) { Lua::ajaxmessage('error', '开发者'); } $contact = Lua::post('contact'); if (empty($contact)) { Lua::ajaxmessage('error', '联系方式'); } $intro = Lua::post('intro'); if (empty($intro)) { Lua::ajaxmessage('error', '模型描述'); } $prefix = Lua::post('prefix'); if (empty($prefix)) { Lua::ajaxmessage('error', '模型前缀'); } $sqlarr = array('contact' => $contact, 'createtime' => time(), 'developer' => $developer, 'intro' => $intro, 'modelname' => $modelname, 'status' => 1, 'prefix' => $prefix, 'mtype' => Lua::post('mtype'), 'cid' => $cid); $id = Lua::insert('lua_model', $sqlarr); Lua::write_log($this->user, '增加模型', "model_id={$id}<br />modelname={$modelname}", SYSNAME); Lua::ajaxmessage('success', '操作成功', './model.htm'); }
private function so_delete() { $v1 = Lua::post('v1'); $v2 = Lua::post('v2'); if ($v1) { $e1 = explode(',', $v1); $e1 = array_unique($e1); $o1 = array(); foreach ($e1 as $r1) { if ($r1) { $r1 = intval($r1); if ($r1 == $v2) { continue; } $o1[] = $r1; } } if ($o1) { echo implode(',', $o1); } else { echo ''; } } }
private function isdefault() { $id = Lua::post('id'); $db = Lua::get_one("select isdefault from lua_channel where id='{$id}'"); $rt = $db['isdefault'] == 1 ? 0 : 1; Doo::db()->query("update lua_channel set isdefault='0'"); Doo::db()->query("update lua_channel set isdefault='{$rt}' where id='{$id}'"); $_index_db = Doo::db()->fetchRow("select * from lua_channel where isdefault='1' order by id desc limit 1"); $__install = ' if (file_exists("no.install")){ header("Location:/@install/"); exit; } '; if ($_index_db) { $__php = '<?php ' . $__install . ' header("Location:/' . $_index_db['path'] . '/"); exit; '; } else { $__php = '<?php ' . $__install . ' header("Location:/' . ADMIN_ROOT . '/"); exit;'; } file_put_contents(LUA_ROOT . 'index.php', $__php); Lua::println(); }
private function save() { $name = Lua::post('name'); $kindof = Lua::post('kindof'); $tplfile = Lua::post('tplfile'); if (empty($name)) { Lua::ajaxmessage('error', '模板名称'); } if (empty($kindof)) { Lua::ajaxmessage('error', '模板类型'); } if (empty($tplfile)) { Lua::ajaxmessage('error', '模板文件名'); } if (file_exists($this->tpl_path . $tplfile)) { Lua::ajaxmessage('error', $tplfile . ' 已存在'); } $query = array('systemname' => SYSNAME, 'name' => $name, 'kindof' => $kindof, 'dateline' => TIMESTAMP, 'lasttime' => TIMESTAMP, 'uid' => $this->user['uid'], 'username' => $this->user['username'], 'tplfile' => $tplfile); Lua::insert('lua_tpls', $query); Lua::ajaxmessage('success', '操作成功', $this->_url($kindof)); }
private function save_add() { $username = Lua::post('username'); if (empty($username)) { Lua::ajaxmessage('error', '用户名'); } $password = Lua::post('password'); if (empty($password)) { Lua::ajaxmessage('error', '登录密码'); } if ($password != Lua::post('confirm_password')) { Lua::ajaxmessage('error', '二次密码不相同'); } $count = Doo::db()->count("select count(*) from lua_member where username='******'"); if ($count > 0) { Lua::ajaxmessage('error', '此用户名已被使用'); } $sqlarr = array('email' => Lua::post('email'), 'lastip' => $this->clientIP(), 'lasttime' => time(), 'password' => md5($password), 'regip' => $this->clientIP(), 'regtime' => time(), 'status' => 1, 'username' => $username); $uid = Lua::insert('lua_member', $sqlarr); Lua::write_log($this->user, '增加注册会员', "uid={$uid}<br />username={$username}", SYSNAME); Lua::ajaxmessage('success', '操作成功', './member.htm'); }
public function _do() { $sql = Lua::post('content'); Doo::db()->query($sql); Lua::ajaxmessage('success', '成功执行', './plugin.htm?action=sql'); }
private function save_any_edit() { $tableid = Lua::get('tableid'); $db = $this->_table($tableid); $fields = $this->_fields($db['tablename']); $pri = $this->_pri($fields); $var = Lua::get($pri); $post = Lua::post('post'); $lastid = Lua::insert($db['tablename'], $post, 1); Lua::write_log($this->user, '修改任意数据', "table=" . $db['tablename'] . "<br />id={$lastid}<br />title=" . $post['subject'], SYSNAME); Lua::ajaxmessage('success', '操作成功', "./piece.htm?action=any&tableid={$tableid}"); }
public function _doit() { $dirs = date('Y-m-d'); $path = $this->cache . $dirs . '/'; $configFile = $path . 'config.php'; Doo::loadHelper('DooFile'); $fileManager = new DooFile(0777); if (!file_exists($configFile)) { if (!file_exists($path)) { $fileManager->create($path); } $tables = Doo::db()->fetchAll("SHOW TABLE STATUS"); $b_table = $d_table = ''; foreach ($tables as $row) { $b_table .= $row['Name'] . ","; $d_table .= "\$tb['" . $row['Name'] . "']=0;\r\n"; } $b_table = substr($b_table, 0, strlen($b_table) - 1); $string = "<?php\r\n\$b_table=\"" . $b_table . "\";\r\n" . $d_table . "?>"; $fileManager->create($configFile, $string); $this->jsonp('写入配置文件 ...'); } else { include $configFile; } $btb = explode(",", $b_table); $count = count($btb); $t = intval(Lua::post('t')); $s = intval(Lua::post('s')); $p = intval(Lua::post('p')); $alltotal = intval(Lua::post('alltotal')); $fnum = intval(Lua::post('fnum')); $dumpsql = ''; if ($t >= $count) { echo 'success'; exit; } if (empty($s)) { $num = Doo::db()->fetchRow("SHOW TABLE STATUS LIKE '" . $btb[$t] . "';"); $num = $num['Rows']; $dumpsql .= "self::query(\"DROP TABLE IF EXISTS `" . $btb[$t] . "`;\");\r\n"; Doo::db()->query("SET SQL_QUOTE_SHOW_CREATE=1"); $r = Doo::db()->fetchRow("SHOW CREATE TABLE `" . $btb[$t] . "`;"); $create = str_replace("\"", "\\\"", $r['Create Table']); $dumpsql .= "self::create(\"" . $create . "\");\r\n"; } else { $num = (int) $alltotal; } $fields = Doo::db()->fetchAll("SHOW FIELDS FROM `" . $btb[$t] . "`"); if (empty($fnum)) { $field_num = count($fields); } else { $field_num = $fnum; } $b = 0; $list = Doo::db()->fetchAll("select * from `" . $btb[$t] . "` limit {$s},{$num}"); if ($list) { foreach ($list as $v) { $b = 1; $s++; $dumpsql .= "self::query(\"replace into `" . $btb[$t] . "` values("; $first = 1; for ($i = 0; $i < $field_num; $i++) { if (empty($first)) { $dumpsql .= ','; } else { $first = 0; } $_field_name = $fields[$i]['Field']; if (!isset($v[$_field_name])) { $dumpsql .= 'NULL'; } else { $dumpsql .= '\'' . Lua::clean($v[$_field_name]) . '\''; } } $dumpsql .= ");\");\r\n"; if (strlen($dumpsql) >= 2048 * 1024) { $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $fileManager->create($sfile, "<?php\r\n" . $dumpsql . "?>"); $this->jsonp('Table Name : <b>' . $btb[$t] . '</b><br />Table : <b>' . ($t + 1) . '/' . $count . '</b><br />Record : <b>' . $s . '/' . $num . '</b><br />备份一组数据成功,正在进入下一组......', $s, $p, $t, $alltotal, $fnum); } } } if (empty($p) || $b == 1) { $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $fileManager->create($sfile, "<?php\r\n" . $dumpsql . "?>"); } if (empty($p)) { $p = 0; } $text = $fileManager->readFileContents($configFile); $rep1 = "\$tb['" . $btb[$t] . "']=0;"; $rep2 = "\$tb['" . $btb[$t] . "']=" . $p . ";"; $text = str_replace($rep1, $rep2, $text); $fileManager->create($configFile, $text); $t++; $this->jsonp('备份' . $btb[$t - 1] . '表成功,正在进入下一个表备份......', 0, 0, $t, 0, 0); }
private function ajax_change() { $uid = Lua::post('uid'); if ($uid) { $db = Lua::get_one("select gid from lua_admin where uid='{$uid}'"); $rt = $db['gid'] == 1 ? 0 : 1; Doo::db()->query("update lua_admin set gid='{$rt}' where uid='{$uid}'"); Lua::println(); } }