コード例 #1
0
ファイル: AdminAuth.php プロジェクト: strangetype/test
 public function authorisation($username, $password)
 {
     session_start();
     $id = 0;
     $stmt = DB::$DB->prepare("SELECT `id` FROM admin_users WHERE\n\t\t\t`username` = ? AND password = ?;");
     $stmt->bind_param('ss', $username, $password);
     $stmt->execute();
     $stmt->bind_result($id);
     $stmt->fetch();
     $stmt->close();
     if ($id) {
         $sid = Chiper::GUID();
         $stmt = DB::$DB->prepare("UPDATE admin_users SET `sid` = ? WHERE `id` = ?");
         $stmt->bind_param('ss', $sid, $id);
         $stmt->execute();
         $stmt->close();
         $_SESSION['admin_sid'] = $sid;
         return 1;
     }
     return 0;
 }
コード例 #2
0
<?php

$Auth = new AdminAuth();
$Chiper = new Chiper();
$isAuth = $Auth->authCheck();
if ($isAuth) {
    if (!empty($_FILES)) {
        $tempPath = $_FILES['file']['tmp_name'];
        $newFileName = $Chiper->getUniqueId();
        $uploadPath = PHOTOS_CLIENT_PATH . $newFileName;
        $size = getimagesize($tempPath);
        $fileWidth = $size[0];
        $fileHeight = $size[1];
        $fileSmallerSize = $fileWidth;
        if ($fileWidth > $fileHeight) {
            $fileSmallerSize = $fileHeight;
        }
        $dx = ceil(($fileWidth - $fileSmallerSize) / 2);
        $dy = ceil(($fileHeight - $fileSmallerSize) / 2);
        $x = $dx;
        $y = $dy;
        $w = $fileSmallerSize;
        $h = $fileSmallerSize;
        $DATA = (object) json_decode($_POST['data']);
        if ($DATA->x) {
            $x = $DATA->x;
        }
        if ($DATA->y) {
            $y = $DATA->y;
        }
        if ($DATA->w) {