Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- /*
- Coded By Nathaniel Davidson
- */
- mysql_connect("localhost","animecap","#LB7PeF9");
- mysql_select_db("animecap_animecap");
- $ftp_server = "ftp.national-anime.com";
- $ftp_user = "Firestarthe";
- $ftp_pass = "nat156";
- $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
- if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
- echo "Connected as $ftp_user@$ftp_server\n";
- } else {
- echo "Couldn't connect as $ftp_user\n";
- }
- $start=0;
- $show_i=Array();
- $to_download=Array();
- $sql=mysql_query("SELECT * FROM `shows`");
- while($shows=mysql_fetch_object($sql)){
- ftp_chdir($conn_id, $shows->show_path);
- $files=ftp_nlist($conn_id, "");
- echo "<br><br>".$shows->show."<br>";
- foreach($files as $file){
- $filename=$file;
- $file = str_replace(")", "",str_replace("(", "", $file));
- $file = preg_replace('/\[(.*?)\]/i', '', $file);
- $replace_i = str_replace(")", "",str_replace("(", "", $shows->show));
- $replace_u = str_replace(")", "",str_replace("(", "", $shows->show_alt));
- $replace_i = preg_replace('/ /i', '(.*?)', $replace_i);
- $replace_u = preg_replace('/ /i', '(.*?)', $replace_u);
- $file = preg_replace('/'.$replace_i.'/i', '', $file);
- $file = preg_replace('/'.$replace_u.'/i', '', $file);
- if (preg_match('/([0-9]+)/i', $file, $regs)) {
- $episode_num = $regs[1];
- }
- if($shows->last_episode<$episode_num){
- $to_download[$start]['title']=$shows->show." Episode ".$episode_num;
- $to_download[$start]['link']=$shows->show_path.$filename;
- $id_u=$shows->id;
- if($show_i[$id_u]<$episode_num){
- $show_i[$id_u]=$episode_num;
- }
- $start++;
- }
- }
- }
- ftp_close($conn_id);
- foreach($show_i as $show_id=>$episode){
- mysql_query("UPDATE `shows` SET `last_episode` = '".$episode."' WHERE `id` = '".$show_id."'");
- }
- foreach($to_download as $download){
- $result = mysql_query("SHOW TABLE STATUS LIKE 'ost_media'");
- $rows = mysql_fetch_assoc($result);
- $next_id=$rows['Auto_increment'];
- $url_get=$download['link'];
- $title=$download['title'];
- $description=$title;
- $DATA_i=array(
- "next_id"=>$next_id,
- "title"=>$title,
- "description"=>$description,
- "url_get"=>$url_get,
- "user_id"=>$user_id
- );
- $DATA_r=base64_encode(json_encode($DATA_i));
- $unique=substr(md5(rand(1,1000).time()),0,10);
- $filename = 'tmp/'.$unique.'.info';
- $handle = fopen($filename,"x+");
- fwrite($handle,$DATA_r);
- fclose($handle);
- $ext = substr(strrchr($DATA_i['url_get'], "."), 1);
- 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' );");
- mysql_query("INSERT INTO `retrieve_query` VALUES ( NULL, '".$next_id."', '".$unique."' );");
- mysql_query("INSERT INTO `convert_query` VALUES ( NULL, '".$next_id."','no');");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement