Advertisement
Guest User

skinupload.php

a guest
Mar 21st, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.43 KB | Gaming | 0 0
  1. <?
  2. /**
  3.  * Функция загрузки скина на сервер
  4.  * =======================================================
  5.  * Автор:  GamerVII
  6.  * URL:     https://vk.com/gamervii
  7.  * email:   gamervii.phone@gmail.com
  8.  * =======================================================
  9.  * Файл:  skinupload.php
  10.  * -------------------------------------------------------
  11.  * Версия: 1.2.2 (05.07.2019)
  12.  * =======================================================
  13.  */
  14.  
  15. if (!defined('DATALIFEENGINE')) die("Error!");
  16.  
  17. $privilage = $db->super_query("SELECT * FROM `cabinet_permissions` WHERE `name` = '{$member_id['name']}'");
  18.  
  19. $uploadHDSkin = $privilage['hd_skin'];
  20.  
  21. $redirect = "http://".$_SERVER['HTTP_HOST']."/cabinet.html";
  22.  
  23. if (isset($_FILES['skin'])) {
  24.     $username = $member_id['name'];
  25.     $fileName = $_FILES['skin']['name'];
  26.     $fileSize = $_FILES['skin']['size'];
  27.     $fileType = $_FILES['skin']['type'];
  28.  
  29.     if ($fileType == null) {
  30.         dumpErrors("Ошибка", "Вы не выбрали файл для загрузки");
  31.         header("Location: $redirect");
  32.     }elseif ($fileType == "image/png") {
  33.         $fileTmp = $_FILES['skin']['tmp_name'];
  34.         $imageSkinInfo = getimagesize($filetmp);
  35.        
  36.         if ($uploadHDSkin == 1) {
  37.             if ($imageSkinInfo["0"] == "64" || $imageSkinInfo["0"] == "1024" || $imageSkinInfo["0"] == "256" || $imageSkinInfo["0"] == "1023" || $imageSkinInfo["0"] == "512") {
  38.                 if ($imageSkinInfo["1"] == "32" || $imageSkinInfo["1"] == "64" || $imageSkinInfo["1"] == "512" || $imageSkinInfo["1"] == "128" || $imageSkinInfo["1"] == "256") {
  39.                     move_uploaded_file($fileTmp, "./recloud/modules/cabinet/uploads/skins/". $username .".png");
  40.  
  41.                     dumpErrors("Успешно", "Скин успешно загружен");
  42.                     header("Location: $redirect");
  43.                 }else{
  44.                     dumpErrors("Ошибка", "Неверный размер скина");
  45.                     header("Location: $redirect");
  46.                 }
  47.             }else{
  48.                 dumpErrors("Ошибка", "Неверный размер скина");
  49.                 header("Location: $redirect");
  50.             }
  51.         }else{
  52.             if ($imageSkinInfo["0"] == "64") {
  53.                 if ($imageSkinInfo["1"] == "32") {
  54.                     move_uploaded_file($fileTmp, "./recloud/modules/cabinet/uploads/skins/". $username .".png");
  55.  
  56.                     dumpErrors("Успешно", "Скин успешно загружен");
  57.                     header("Location: $redirect");
  58.                 }else{
  59.                     dumpErrors("Ошибка", "Неверный размер скина, или вы пытаетесь загрузить HD скин");
  60.                     header("Location: $redirect");
  61.                 }
  62.             }else{
  63.                 dumpErrors("Ошибка", "Неверный размер скина, или вы пытаетесь загрузить HD скин");
  64.                 header("Location: $redirect");
  65.             }
  66.         }
  67.     }else{
  68.         dumpErrors("Ошибка", "Файл должен быть в формате png");
  69.         header("Location: $redirect");
  70.     }
  71.  
  72. }
  73.  
  74. ?>
  75.  
  76. <form id="skinUpload" action method="post" enctype="multipart/form-data">
  77.     <div class="row cabinet-file-upload">
  78.         <div class="col-xl-6 col-md-12">
  79.             <div class="cabinet-form-group">
  80.                 <input type="file" name="skin" id="sortpictureSkin" class="input-file">
  81.                 <label for="sortpictureSkin" class="cabinet-file js-labelFile mb-2">
  82.                     <span class="js-fileName">Выбрать скин</span>
  83.                 </label>
  84.             </div>
  85.         </div>
  86.         <div class="col-xl-6 col-md-12">
  87.             <input id="uploadSkin" type="submit" value="Загрузить" class="cabinet-buttons">
  88.         </div>
  89.     </div>
  90. </form>
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement