Advertisement
Guest User

Untitled

a guest
May 6th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. <?
  2. /*
  3. Coded By Nathaniel Davidson
  4. */
  5. mysql_connect("localhost","animecap","#LB7PeF9");
  6. mysql_select_db("animecap_animecap");
  7. $ftp_server = "ftp.national-anime.com";
  8. $ftp_user = "Firestarthe";
  9. $ftp_pass = "nat156";
  10.  
  11. $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
  12. if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
  13. echo "Connected as $ftp_user@$ftp_server\n";
  14. } else {
  15. echo "Couldn't connect as $ftp_user\n";
  16. }
  17. $start=0;
  18. $show_i=Array();
  19. $to_download=Array();
  20. $sql=mysql_query("SELECT * FROM `shows`");
  21. while($shows=mysql_fetch_object($sql)){
  22. ftp_chdir($conn_id, $shows->show_path);
  23. $files=ftp_nlist($conn_id, "");
  24. echo "<br><br>".$shows->show."<br>";
  25. foreach($files as $file){
  26. $filename=$file;
  27. $file = str_replace(")", "",str_replace("(", "", $file));
  28. $file = preg_replace('/\[(.*?)\]/i', '', $file);
  29. $replace_i = str_replace(")", "",str_replace("(", "", $shows->show));
  30. $replace_u = str_replace(")", "",str_replace("(", "", $shows->show_alt));
  31. $replace_i = preg_replace('/ /i', '(.*?)', $replace_i);
  32. $replace_u = preg_replace('/ /i', '(.*?)', $replace_u);
  33. $file = preg_replace('/'.$replace_i.'/i', '', $file);
  34. $file = preg_replace('/'.$replace_u.'/i', '', $file);
  35. if (preg_match('/([0-9]+)/i', $file, $regs)) {
  36. $episode_num = $regs[1];
  37. }
  38. if($shows->last_episode<$episode_num){
  39. $to_download[$start]['title']=$shows->show." Episode ".$episode_num;
  40. $to_download[$start]['link']=$shows->show_path.$filename;
  41. $id_u=$shows->id;
  42. if($show_i[$id_u]<$episode_num){
  43. $show_i[$id_u]=$episode_num;
  44. }
  45. $start++;
  46. }
  47. }
  48. }
  49. ftp_close($conn_id);
  50. foreach($show_i as $show_id=>$episode){
  51. mysql_query("UPDATE `shows` SET `last_episode` = '".$episode."' WHERE `id` = '".$show_id."'");
  52. }
  53. foreach($to_download as $download){
  54. $result = mysql_query("SHOW TABLE STATUS LIKE 'ost_media'");
  55. $rows = mysql_fetch_assoc($result);
  56. $next_id=$rows['Auto_increment'];
  57. $url_get=$download['link'];
  58. $title=$download['title'];
  59. $description=$title;
  60. $DATA_i=array(
  61. "next_id"=>$next_id,
  62. "title"=>$title,
  63. "description"=>$description,
  64. "url_get"=>$url_get,
  65. "user_id"=>$user_id
  66. );
  67. $DATA_r=base64_encode(json_encode($DATA_i));
  68. $unique=substr(md5(rand(1,1000).time()),0,10);
  69. $filename = 'tmp/'.$unique.'.info';
  70. $handle = fopen($filename,"x+");
  71. fwrite($handle,$DATA_r);
  72. fclose($handle);
  73. $ext = substr(strrchr($DATA_i['url_get'], "."), 1);
  74. mysql_query("INSERT INTO `ost_media` VALUES ( NULL , '".$DATA_i['user_id']."', '".$DATA_i['title']."', '".$DATA_i['description']."', '', 'public', NOW( ) , '".substr(sha1(time().md5($DATA_i['description'].$DATA_i['title'])),0,20)."', '0', '0', NOW( ) , '0', '0', '0', '0', 'true', 'true', 'video', 'converting', '', 'legal', '".$ext."', 'mp4' );");
  75. mysql_query("INSERT INTO `retrieve_query` VALUES ( NULL, '".$next_id."', '".$unique."' );");
  76. mysql_query("INSERT INTO `convert_query` VALUES ( NULL, '".$next_id."','no');");
  77. }
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement