public function interpret_request($POST, $FILES) { $image = null; if (isset($FILES['image']) && isset($FILES['image']['error']) && $FILES['image']['error'] == 0) { $image = $FILES['image']; $uploaddir = PATH . "images_dir/"; $ext = pathinfo(basename($image['name']), PATHINFO_EXTENSION); $uniqueId = uniqid(); $uploadfile = $uploaddir . $uniqueId . basename($image['name']); $allowed_extensions = Files::get_allowed_extensions(); if (in_array($image['type'], $allowed_extensions[strtolower($ext)]['mime'])) { if (move_uploaded_file($image['tmp_name'], $uploadfile)) { $image = $uniqueId . basename($image['name']); fixOrientation($uploadfile); } else { $image = null; } } else { $image = null; } } if (!isset($image)) { $this->errors[] = 'image'; } if (!empty($this->errors)) { throw new ValidationError($this->errors); } if (isset($image)) { $this->set_path($image); } return $this; }
<?php include_once "/var/www/php/sql_connect.php"; if (isset($_COOKIE["token"])) { $token = $_COOKIE["token"]; } include "/var/www/web_classes/DHunter.php"; $hunter = new DHunter($token); $quarry = $hunter->Quarry(); if (isset($_FILES["hpic"])) { $tmpdir = tempnam("/var/www/sites/oitgaming/uploads", "img_"); // unlink($tmpdir); $tmpdir = $tmpdir; $path = explode("oitgaming", $tmpdir); if ($_FILES["hpic"]["type"] === "image/jpeg" and $_FILES["hpic"]["size"] < 10 * 1024 * 1024) { if (move_uploaded_file($_FILES["hpic"]["tmp_name"], $tmpdir)) { fixOrientation($tmpdir); $img_text = $hunter->ChangeAvatar($path[1]); } } else { $img_text = "That's not a jpeg or it is over 6MB"; } } else { $img_text = ""; } ?> <style> .jumbotron-vert{ background-color: #FCFCFC;