function handle() { if (isset($_GET['behav'])) { if ($_GET['behav'] == 'uploadimg') { $name = uniqid() . '.jpg'; move_uploaded_file($_FILES["pic"]["tmp_name"], './jae/' . $name); upoadTmpFile('./jae/' . $name); $tmp = array(); $tmp['url'] = getTmpFileUrl($name); $tmp['id'] = $name; echo json_encode($tmp); exit; } } $smarty = new Smarty(); $smarty->assign('logined', isLogined()); $smarty->display('libs/view/head.ctp'); if (isset($_POST['bookname'])) { $name = explode('.', $_FILES["file"]["name"]); $name = $name[count($name) - 1]; if ($name == 'mobi') { $id = $this->doUpload(); header("location:index.php?action=detail&bid={$id}"); //$smarty->assign('type','success'); //$smarty->assign('message','上传成功'); } else { $smarty->assign('type', 'error'); $smarty->assign('message', '上传失败,文件类型错误'); } //$smarty->display('libs/view/alert.ctp'); } $smarty->display('libs/view/upload.ctp'); $smarty->display('libs/view/tail.ctp'); }
function handle() { $db = new db(); if (isset($_GET['action2']) == 'checkemail') { if (isset($_GET['email'])) { echo $db->checkEmail($_GET['email']); } else { header('location:index.php'); } exit; } if (isset($_SESSION['email'])) { header('location:index.php'); } if (!isset($_POST['email']) || !isset($_POST['pwd'])) { $smarty = new Smarty(); $smarty->assign('logined', isLogined()); $smarty->display('libs/view/head.ctp'); $smarty->display('libs/view/reg.ctp'); $smarty->display('libs/view/tail.ctp'); exit; } $email = $_POST['email']; $pwd = $_POST['pwd']; if ($db->addUsr($email, $pwd)) { $_SESSION['email'] = $email; $_SESSION['pwd'] = $pwdl; } header('location:index.php'); }
function handle() { if (!isset($_SESSION['email'])) { header('location:index.php'); } if (isset($_GET['hav'])) { $this->addKindle(); } else { $db = new db(); $smarty = new Smarty(); $smarty->assign('logined', isLogined()); $smarty->assign('kindle', $_SESSION['kindle']); $smarty->assign('downloads', $db->getDownloads($_SESSION['email'])); $smarty->display('libs/view/head.ctp'); $smarty->display('libs/view/setting.ctp'); $smarty->display('libs/view/tail.ctp'); } }
function show() { $db = new db(); $info = $db->searchBookById($_GET['bid']); //判断空的情况 $comments = $db->getCommentByBid($_GET['bid'], 1); $info['bookUrl'] = url . 'index.php?action=download&bid=' . $info['bid'] . '.mobi'; $info['picUrl'] = getImgUrl($info['bid'] . '.jpg'); $smarty = new Smarty(); if (isset($_SESSION['kindle'])) { $smarty->assign('hasKindle', 'true'); $smarty->assign('kindle', $_SESSION['kindle']); } else { $smarty->assign('hasKindle', 'false'); $smarty->assign('kindle', ''); } $smarty->assign('logined', isLogined()); $smarty->assign('info', $info); $smarty->assign('comments', $comments); $smarty->display('libs/view/head.ctp'); $smarty->display('libs/view/detail.ctp'); $smarty->display('libs/view/tail.ctp'); }
<?php if (!isset($_SESSION)) { session_start(); } require_once $_SERVER['DOCUMENT_ROOT'] . '/Config/db.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/Actions/users.php'; $user = false; if (isLogined()) { $user = getUser(); } $langID = isset($_GET['lang']) ? $_GET['lang'] : 2; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="./CSS/Site.css"/> <link rel="stylesheet" type="text/css" href="./CSS/animate.css"/> <script type="application/javascript" src="./JS/jquery-1.9.1.min.js"></script> <script type="application/javascript" src="./JS/jquery-ui.min.js"></script> <script type="application/javascript" src="./JS/jquery.scrollTo-min.js"></script> <script type="application/javascript" src="./JS/animation.js"></script> <script type="application/javascript" src="./JS/app.js"></script> <style> #menu{ display: inline-block; vertical-align: top; margin-top: 0px; margin-right: 80px;; }
function handle() { if (!isset($_GET['method']) || !isset($_GET['query'])) { header('location:' . url); } if ($_GET['method'] == 'name') { $db = new db(); $total = $db->countBookByName($_GET['query']); $totalPage = ceil($total / pagesize); $curPage = 1; if (isset($_GET['pg']) && $_GET['pg'] <= $totalPage) { $curPage = $_GET['pg']; } $result = $db->searchBookByName($_GET['query'], $curPage); } else { if ($_GET['method'] == 'author') { } else { if ($_GET['method'] == 'ISBN') { } else { header('location:' . url); } } } for ($i = 0; $i <= count($result) - 1; $i++) { $result[$i]['picSrc'] = getImgUrl($result[$i]['bid'] . '.jpg'); } $pageLink = array(); $tmp = array(); $tmp['flag'] = 'start'; $tmp['url'] = url . 'search/name/' . $_GET['query'] . '.html/pg=1'; array_push($pageLink, $tmp); $start = 1; if ($totalPage <= 10) { $start = 1; } else { $start = $curPage - 3; if ($start <= 0) { $start = 1; } if ($start + 9 > $totalPage) { $start = $totalPage - 9; } } $i = 1; for (; $start <= $totalPage && $i < 10; $start++, $i++) { $tmp = array(); if ($start == $curPage) { $tmp['flag'] = 'active'; } else { $tmp['flag'] = ''; } $tmp['url'] = url . 'search/name/' . $_GET['query'] . ".html/pg={$start}"; $tmp['pg'] = $start; array_push($pageLink, $tmp); } if ($start < $totalPage) { $tmp = array(); $tmp['flag'] = 'dot'; array_push($pageLink, $tmp); } $tmp = array(); $tmp['flag'] = 'end'; $tmp['url'] = url . 'search/name/' . $_GET['query'] . ".html/pg={$totalPage}"; array_push($pageLink, $tmp); $smarty = new Smarty(); $smarty->assign('pageLink', $pageLink); $smarty->assign('logined', isLogined()); $smarty->assign('result', $result); $smarty->display('libs/view/head.ctp'); $smarty->display('libs/view/search.ctp'); $smarty->display('libs/view/tail.ctp'); //print_r($_GET); }
?> </span>) </a> </div> <?php } ?> <div id="topmenu"> <ul> <li> <a href="/">Главная</a> </li> <?php if (!isLogined()) { ?> <li> <a href="/registration.php">Регистрация</a> </li> <?php } ?> </ul> </div> <div id="logo"> </div>
require_once 'libs/controller/SearchController.class.php'; $controller = new SearchController(); $controller->handle(); break; case 'detail': require_once 'libs/controller/DetailController.class.php'; $controller = new DetailController(); $controller->handle(); break; case 'push': session_write_close(); require_once 'libs/controller/PushController.class.php'; $controller = new PushController(); $controller->doPush(); break; case 'download': require_once 'libs/controller/DownloadController.class.php'; $controller = new DownloadController($_GET['id']); $controller->handle(); break; case 'test': print_r($_SESSION['kindle']); break; default: $smarty = new Smarty(); $smarty->assign('logined', isLogined()); $smarty->display('libs/view/head.ctp'); $smarty->display('libs/view/home.ctp'); $smarty->display('libs/view/tail.ctp'); break; }
if (is_numeric($v)) { //if($v<1.0){$v=1;} $cgi[$k] = round(abs($v), 0); } else { $cgi[$k] = str_replace('script', 'scr[i]pt', $v); } } if ($game_offline == 'true' AND !$_SESSION['admin'] AND !$incron) { header('Location: offline.php'); exit; } if ($_SESSION['isLogined']) { $user = getUserDetails($_SESSION['isLogined']); } if ($cgi[$_SESSION['uname']] != null AND !$_SESSION['banpass']) { $isLogined1 = isLogined($cgi[$_SESSION['uname']], $cgi[$_SESSION['psword']]); if ($isLogined1) { $usT = getUserDetails($isLogined1, " active,id "); logIP($isLogined1); //========== //== actives // 0 Not activated // 1 Normal User // 2 Vaction mode // 3 Flagged/suspected cheater // 4 banned // 5 Deleted - Just so the user doesn't think he's on vacation //============== if ($usT->active == 1) { $_SESSION["isLogined"] = $isLogined1; $sN = $HTTP_SERVER_VARS['SCRIPT_NAME'];
<?php require_once "../util/functions.php"; $pdo = connectDb(); $userId = $_POST["user_id"]; $password = $_POST["password"]; session_start(); if (isset($_SESSION['user_id']) && isLogined($userId, $_SESSION['user_id']) && canLogin($userId, $password, $pdo)) { //セッションにセットされていたらログイン済み header('location: logined.php'); exit; } else { //セッションにセットされていなかったらログイン判断 if (canLogin($userId, $password, $pdo)) { //userIdで検索できればログイン可能 $_SESSION['user_id'] = $userId; header('location: auth_check_complete.php'); exit; } else { //検索できなければ未登録ユーザー。 header('location: auth_check_error.php'); exit; } } function canLogin($userId, $password, $pdo) { $sql = "SELECT * FROM user where user_id = :user_id and password = :password"; $stmt = $pdo->prepare($sql); $stmt->bindValue(':user_id', $userId); $stmt->bindValue(':password', $password); $stmt->execute();