status.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set("log_errors", 1);
  4. error_reporting(E_ALL);
  5. include "settings.php";
  6. include "include/init.php";
  7. include "include/functions.php";
  8. $media_id = array();
  9. if (!is_null($token) && (isset($_FILES['file']) || isset($_POST['status']))){
  10. if(isset($_FILES['file'])){
  11. $cnt = count($_FILES['file']['name']);
  12. for ($n = 0; $n <= $cnt-1; $n++){
  13. $video = 0;
  14. $errors= array();
  15. $file_name = $_FILES['file']['name'][$n];
  16. $file_size =$_FILES['file']['size'][$n];
  17. $file_tmp =$_FILES['file']['tmp_name'][$n];
  18. $file_type=$_FILES['file']['type'][$n];
  19. @$file_ext=strtolower(end(explode('.',$_FILES['file']['name'][$n])));
  20. $expensions= array("jpeg","jpg","png","gif","mp4","webm");
  21. if(in_array($file_ext,$expensions)=== false){
  22. $errors[]="extension not allowed, please choose a JPEG or PNG file.";
  23. }
  24. if(empty($errors)==true){
  25. move_uploaded_file($file_tmp, $file_name);
  26. $media_id[] = json_decode(uploadpic($file_name),true)[0];
  27. unlink($file_name);
  28. }else{
  29. //print_r($errors);
  30. //echo "error";
  31. }
  32. }
  33. }
  34. $result = sendpost(trim($_POST['status']),$media_id,$_POST['thread'],false,$_POST['scope'],(isset($_POST['sensitive']) ? $_POST['sensitive'] : false),(isset($_POST['spoiler']) && $_POST['spoiler'] != 'Title (optional)' ? $_POST['spoiler'] : false));
  35. //file_put_contents("output.txt",var_export($media_id,true));
  36. header('Location: '.$setting['url'].'?mode=home');
  37. }
  38. ?>