示例#1
0
<?php

// โหลดไฟล์ inint
include '../../../bin/inint.php';
// ค่าคงที่สำหรับป้องกันการเรียกหน้าเพจโดยตรง
DEFINE('MAIN_INIT', 'load');
if (defined('MAIN_INIT')) {
    require_once ADMIN_PATH . 'inc.login.php';
    if (cms::isReferer() && $isAdmin) {
        //ค่าที่ส่งมา
        $save['module'] = $_GET['write_module'];
        $id = $_GET['write_id'];
        $last_id = $db->getRec(DB_ARCHIVE, $id);
        $save['ip'] = cms::getip();
        $save['member_id'] = $login_result['id'];
        $save['sender'] = $login_result['name'];
        //upload thumb
        $path = DATA_PATH . $save['module'] . '/';
        $valid_formats = array("jpg", "png", "gif", "JPG", "PNG", "GIF");
        $verifyToken = md5('Love_Art' . $_GET['timestamp']);
        if (!empty($_FILES) && $_GET['token'] == $verifyToken) {
            //ลบรูปเก่า..ถ้ามี
            if ($last_id['id']) {
                if (is_file(ROOT_PATH . 'images/' . $save['module'] . '/' . $last_id['picture'])) {
                    $flgDelete = unlink(ROOT_PATH . 'images/' . $save['module'] . '/' . $last_id['picture']);
                }
                if (is_file(ROOT_PATH . 'images/' . $save['module'] . '/thumb_' . $last_id['picture'])) {
                    $flgDeleteThumb = unlink(ROOT_PATH . 'images/' . $save['module'] . '/thumb_' . $last_id['picture']);
                }
            }
            include 'class.resize.php';
示例#2
0
 public static function CheckLogin($user, $password)
 {
     global $config, $db, $mmktime, $mtoday;
     $userupdate = false;
     $login_result = $db->basicSearch(DB_USER, 'email', $user);
     if (!$login_result) {
         // ไม่พบชื่อ
         return 0;
     } elseif (trim($login_result['verified']) != '') {
         // ยังไม่ได้ activate
         return 1;
     } elseif ($login_result['password'] == md5($login_result['email'] . $password)) {
         // อัปเดทการเยี่ยมชม
         if ($mtoday != (int) date("d", $login_result['lastvisited'])) {
             $login_result['ip'] = cms::getip();
             $login_result['visited']++;
             $login_result['lastvisited'] = $mmktime;
             $userupdate = true;
         }
         if ($userupdate) {
             $db->editBy(DB_USER, 'id', $login_result['id'], $login_result);
         }
         return $login_result;
     }
     //return $login_result;
 }