Advertisement
Guest User

MyCode

a guest
Aug 23rd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. $msg = '';
  2. $title = '';
  3. $size = '';
  4. $definition = '
  5. اسم اللعبة :
  6. التصنيف :
  7. حجم اللعبة :
  8. تاريخ الاصدار :';
  9. $direct = '';
  10. $torrent = '';
  11. $description = '';
  12. $instal = '';
  13. $gameplay = '';
  14.  
  15. if (isset($_POST['add_game'])) {
  16.  
  17. $title = strip_tags($_POST['title']);
  18. $size = strip_tags($_POST['size']);
  19. $game_cate = @implode(', ', @$_POST['game_cate']);
  20. $definition = strip_tags($_POST['definition']);
  21. $direct = $_POST['direct'];
  22. $torrent = $_POST['torrent'];
  23. $description = strip_tags($_POST['description']);
  24. $instal = strip_tags($_POST['instal']);
  25. $gameplay = $_POST['gameplay'];
  26. $game_date = date("d/m/Y");
  27.  
  28. if (empty($title)) {
  29. $msg = '<div class="alert alert-danger col-md-11" role="alert">أدخل اسم اللعبة</div>';
  30. }elseif (empty($size)) {
  31. $msg = '<div class="alert alert-danger col-md-11" role="alert">أدخل حجم اللعبة</div>';
  32. }elseif (empty($game_cate)) {
  33. $msg = '<div class="alert alert-danger col-md-11" role="alert">اختر تصنيف اللعبة</div>';
  34. }else {
  35.  
  36. $image = $_FILES['image'];
  37. $image_name = $image['name'];
  38. $image_tmp = $image['tmp_name'];
  39. $image_size = $image['size'];
  40. $image_error = $image['error'];
  41.  
  42. if ($image_name != '') {
  43.  
  44. $image_exe = explode('.', $image_name);
  45. $image_exe = strtolower(end($image_exe));
  46.  
  47. $allowd = array('png','jpg','jpeg','gif');
  48.  
  49. if (in_array($image_exe , $allowd)) {
  50.  
  51. if ($image_error === 0){
  52.  
  53. if ($image_size <= 1000000) {
  54.  
  55. $new_name = mt_rand(1265873 , 9858412) . '.' . $image_exe ;
  56. $image_dir = '../images/games/' . $new_name ;
  57. $image_db = '../images/games/' . $new_name ;
  58.  
  59. if (move_uploaded_file($image_tmp, $image_dir)){
  60.  
  61. // -------------- This The Code -----------------
  62. $files = reArrayFiles($_FILES['images']);
  63.  
  64. foreach ($files as $file) {
  65.  
  66. $images_name = $file['name'];
  67. $images_tmp = $file['tmp_name'];
  68. $images_size = $file['size'];
  69. $images_error = $file['error'];
  70.  
  71. if ($images_name != '') {
  72.  
  73. $images_exe = strtolower(end(explode('.', $images_name)));
  74.  
  75. $allowd = array('png','jpg','jpeg','gif');
  76.  
  77. if (in_array($images_exe , $allowd)) {
  78.  
  79. if ($images_error === 0){
  80.  
  81. if ($images_size <= 1000000) {
  82.  
  83. $newName = mt_rand(1265873 , 9858412) . '.' . $images_exe ;
  84. $images_dir = '../images/games/' . $newName ;
  85. $images_db = '../images/games/' . $newName ;
  86.  
  87. if (move_uploaded_file($images_tmp, $images_dir)){
  88.  
  89. $msg = '<div class="alert alert-success col-md-11" role="alert">لم يتم رفع الصور</div>';
  90.  
  91. }else {
  92. $msg = '<div class="alert alert-danger col-md-11" role="alert">لم يتم رفع الصور</div>';
  93. }
  94. }else {
  95. $msg = '<div class="alert alert-danger col-md-11" role="alert">حجم الصور كبير جدا</div>';
  96. }
  97. }else {
  98. $msg = '<div class="alert alert-danger col-md-11" role="alert">حدث خطأ أثناء رفع الصور</div>';
  99. }
  100. }else {
  101. $msg = '<div class="alert alert-danger col-md-11" role="alert">الرجاء اختيار صور صحيحة</div>';
  102. }
  103. }else {
  104. $msg = '<div class="alert alert-danger col-md-11" role="alert">لم تقم برفع الصور</div>';
  105. }
  106. }
  107. // -------------- End The Code -----------------
  108.  
  109. }else {
  110. $msg = '<div class="alert alert-danger col-md-11" role="alert">لم يتم رفع الصورة الرئيسية</div>';
  111. }
  112. }else {
  113. $msg = '<div class="alert alert-danger col-md-11" role="alert">حجم الصورة الرئيسية كبير جدا</div>';
  114. }
  115. }else {
  116. $msg = '<div class="alert alert-danger col-md-11" role="alert">حدث خطأ أثناء رفع الصورة الرئيسية</div>';
  117. }
  118. }else {
  119. $msg = '<div class="alert alert-danger col-md-11" role="alert">الرجاء اختيار صورة صحيحة</div>';
  120. }
  121. }else {
  122. $msg = '<div class="alert alert-danger col-md-11" role="alert">لم تقم برفع الصورة الرئيسية</div>';
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement