} else { echo 'noicon.png'; } ?> "> <?php echo $row['news01title']; ?> </a> </li> <?php } ?> <?php $objUser = new Users(); $currUser = $objUser->getCurrentUser(); //var_dump($currUser); if ($currUser['us01us00uin'] > 100) { if (getREQUEST('module') == 'admin_newstype') { $active = 'active'; } else { $active = ''; } ?> <li class="<?php echo $active; ?> "> <?php echo '<a href="home.php?module=admin_newstype">'; ?>
<?php # Include required files include $site->baseDir('/data/norm-user/external/norm.php'); include $site->baseDir('/data/norm-user/external/crood.php'); include $site->baseDir('/data/norm-user/lib/PasswordHash.php'); include $site->baseDir('/data/norm-user/lib/Random.php'); include $site->baseDir('/data/norm-user/external/model/user.model.php'); include $site->baseDir('/data/norm-user/external/controller/user.controller.php'); # Restore user session (check for Users module first) if (class_exists('Users')) { Users::init(); Users::checkLogin(); $site->user = Users::getCurrentUser(); } else { $site->user = null; } $this->chainController('UserController'); # Start session session_start();
<?php include "conn.php"; if (isset($_SESSION["user"])) { $uid = $_SESSION["user"]["uid"]; if (REQUEST_METHOD == "DELETE") { $target_file = "/img/avt/m" . rand(0, 7) . ".png"; $user = new Users(); $user->setUserAvt($uid, $target_file); $user->getCurrentUser(); echo json_encode(array("success" => "ลบรูปเสร็จสมบูรณ์", "avt" => "{$target_file}")); exit; } if (!isset($_FILES["avt"])) { echo json_encode(array("error" => "ไม่มีรูปภาพถูกอัพโหลดเข้ามา")); exit; } $ext = end(explode(".", $_FILES["avt"]["name"])); $target_file = "../img/avt-upload/" . $uid . "." . $ext; if (move_uploaded_file($_FILES["avt"]["tmp_name"], $target_file)) { $user = new Users(); $user->setUserAvt($uid, $target_file); $user->getCurrentUser(); echo json_encode(array("success" => "อัพโหลดเสร็จสมบูรณ์", "avt" => "{$target_file}")); } else { echo json_encode(array("error" => "อัพโหลดรุปไม่สมบูรณ์")); } } else { echo json_encode(array("error" => "คุณไม่มีสิทธ์การเข้าถึง")); }