• 18-04-2017, 20:55:11
    #1
    selamlar resim eklemede sorun yaşıyorum resim eklenmiyor yardımcı olabilecek bir arkadaş varmıdır ?
    <?php
    ob_start();
    @set_time_limit(0);
    $mysql = mysql_connect("localhost","root","") or die("mysql");
    
    mysql_select_db("minimix",$mysql) or die ("db");
    ## Karakter Sorunu ##
    mysql_query("SET CHARACTER SET 'utf8'");
    mysql_query("SET NAMES 'utf8'");
    $user		= "admin";
    $pass		= "admin";
    
    
    function authenticate(){ 
    header( 'WWW-Authenticate: Basic realm="Sadece yetkisi olanlar girebilir, eger yetkin yoksa girmeyi denemeyin."' ); 
    header( 'HTTP/1.0 401 Unauthorized' ); 
    echo 'Siz yetkili değilsiniz, lütfen sistemi terkedin.'; 
    exit; 
    } 
    
    
    if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { 
    	authenticate(); 
    }else{ 
    	if($_SERVER['PHP_AUTH_USER']==$user && $_SERVER['PHP_AUTH_PW']==$pass){
    		$auth=TRUE;
    	} 
    
    	if($auth !=TRUE) {
    		authenticate();
    	} 
    
    }
    function getir($url)
    {
    		$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, $url);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch, CURLOPT_TIMEOUT, 9999999);  
    		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    		curl_setopt($ch, CURLOPT_REFERER, "Referer: http://google.com/x.html");
    		curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0");
    		$x = curl_exec($ch);
    		curl_close($ch);
    		return $x;
    }
    function getir1($url)
    {
    		$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, $url);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch, CURLOPT_TIMEOUT, 9999999);  
    		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    		curl_setopt($ch, CURLOPT_HEADER, 1);
    		curl_setopt($ch, CURLOPT_REFERER, "Referer: http://google.com/x.html");
    		curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0");
    		$x = curl_exec($ch);
    		preg_match ('/Cookie: (.*);/', $x, $header);
    		$cookie = $header[1];		
    		curl_close($ch);
    		return $cookie;
    }
    function getir2($url)
    {
    		$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HEADER, 1);
    		curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    		$x = curl_exec($ch);
    		curl_close($ch);
    		return $x;
    }
    	function seo_link($s) {
        $tr = array('ş','Ş','ı','İ','ğ','Ğ','ü','Ü','ö','Ö','ç','Ç');
        // Türkçe karakterlerin çevirlecegi karakterler
        $en = array('s','s','i','i','g','g','u','u','o','o','c','c');
        $s = str_replace($tr,$en,$s);
        $s = strtolower($s);
        $s = preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;.+?;/', '-', $s);
        $s = preg_replace('/[^%a-z0-9 _-]/', '-', $s);
        $s = preg_replace('/\s+/', '-', $s);
        $s = preg_replace('|-+|', '-', $s);
        $s = str_replace("--","-",$s);
        $s = trim($s, '-');
        return $s;
    }
    	function resimindir($file, $local_path, $newfilename)
    {
        $out = fopen($local_path."/".$newfilename, 'wb');
       
        $ch = curl_init();
               
        curl_setopt($ch, CURLOPT_FILE, $out);
        curl_setopt($ch, CURLOPT_HEADER, 0);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_URL, $file);
    	curl_exec($ch);
        curl_close($ch);
    
    }
    	function kodTemizle ( &$yazi ) 
    	{
    		$yazi = preg_replace( "'<div[^>]*>'si", '', $yazi );
    		$yazi = preg_replace( "'<span[^>]*>'si", '', $yazi );
    		$yazi = preg_replace( "'<a[^>]*>'si", '', $yazi );
    		$yazi = str_replace("</div>","",$yazi);	
    		$yazi = str_replace("</a>","",$yazi);	
    		$yazi = str_replace("</span>","",$yazi);
    		$yazi = str_replace("<p><p>","",$yazi);
    		return $yazi;
    	}
    	function ari_normal_cats()
    	{
    	$kategoriler = wp_dropdown_categories('hide_empty=0&show_count=0&hierarchical=1&echo=0&orderby=name');
    	$option = str_replace('</select>', '', $kategoriler);
    	$option = preg_replace( "'<select[^>]*>'si", '', $option );
    	preg_match_all('@<option.*?value="(.*?)".*?>(.*?)</option>@si', $option, $datas);
    	for($i=0; $i<count($datas[1]); $i++){
    		?>
    		<option value="<?=$datas[1][$i]?>"><?=$datas[2][$i]?></option>
    		<?php
    	}
    }
    
    function googleTranslate($string){
         $api = 'trnsl.1.1.20160224T145226Z.44b96f9c133f6a57.40ac3ddf74f0707b6a6707cf7500d4c26e29f207'; //Yandex'ten aldığınız translate api
         $from = 'tr'; //Çevirmek istediğiniz dil
         $to = 'it'; //Çevrilecek dil
         $url = file_get_contents('https://translate.yandex.net/api/v1.5/tr.json/translate?key='.$api.'&lang='.$from.'-'.$to.'&text='.$string);
         $json = json_decode($url);
    	 $return = $json->text[0];
    	 return $return;
    }
    
    function video_urlchecker($url, $video)
    {
    		//$video = '<iframe src="/pulse/dHh4eHxodHRwOi8vd3d3LnR4eHguY29tL3ZpZGVvcy8xMjk3NjA1L2NyaXN0YWwtam9saWUtZGF2aWQtcGVycnktdGhvbWFzLXN0b25lLWluLWFzc2Z1Y2tlZC1taWxmcy0wNS1zY2VuZS0wMS8=.mp4" height="100%" width="100%" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" scrolling="no" frameborder="0"></iframe>';
    		$host = parse_url($url);
    		$parse1 = trim(htmlentities($host["host"]));
    		$parse = str_replace("www.", "", $parse1);
    		$parse = str_replace("http://", "", $parse1);		
    		if ( strstr($video, $parse)){$deger = 1;}else{ $deger = 0;};
    		if(!$deger)
    		{
    			if ( !strstr($parse1, "http://")){$url2 = "http://".$parse1;}else{ $url2 = $parse1;};
    			$video = str_replace('src="', 'src="'.$url2.'', $video);
    			$video = str_replace("src='", "src='".$url2."", $video);
    		}
    		return $video;
    }
    ?>


    <?php
    include 'fonksiyon.php';
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
            <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    		<link rel="stylesheet" type="text/css" href="css/global.css" />
    		<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
    		<script type="text/javascript" src="js/redactor.js"></script>
    		<script type="text/javascript" src="js/redactor.min.js"></script>
    		<link rel="stylesheet" type="text/css" href="js/redactor.css" />
           <title>- Detube Bot</title>
        </head>
    
    <script type="text/javascript">
    	$(function() {
    		
    		$('div.one-item').on('click', 'button.submit', function(e) { 
    			e.preventDefault();
    			var that = $(this);
    			var row = $(this).parents('div.one-item');
    			
    			if ($('img', $(this).parent()).length==0) $(this).hide().after('<img class="loader" src="css/loader.gif" />');
    			
    			post_data = $('input, select, textarea', row).serialize();
    			
    			$.post('do.php', post_data, function(resp) {
    				$('img.loader', row).remove();
    				console.log($('img.loader', row));
    				//that.after(resp);
    				if (resp == '1') {
    					that.after('<strong class="yes">EKLENDİ</strong>');
    				} else if (resp == '2'){
    					that.after('<strong class="yes">HAVUZA EKLENDİ</strong>');
    				}else{
    					that.after('<button class="submit no">HATA! EKLENEMEDİ</button>');
    				}
    				
    				that.remove();
    			
    			});
    			
    		});
    		
    		$('button.submit-all').click(function() {
    		
    			$('div.one-item button.submit').hide().after('<img class="loader" src="css/loader.gif" />');
    			add_item($('div.one-item:first'));
    		});
    		
    		
    		$('div textarea').redactor({'lang': 'tr', 'maxHeight': '300px'});
    		
    	}); //jQuery Ready!
    	
    	
    	function add_item(item) {
    		if (item != null) {
    			$('button.submit', item).click();
    			setTimeout(function() { add_item(item.next()) }, 2000);
    		} else {
    			alert('BİTTİ!');
    		}
    	}
    </script>	
        <body>
    
    <div class="search">
    	<h1>Arımedya - Detube Bot</h1>
    
    	<form action="?" method="GET">
    	<input type="text" style="width:380px;" name="hedefkat" value="<?=@$_GET['hedefkat'];?>" placeholder="Hedef site linkini giriniz"/>
    	<input type="text" style="width:80px;" name="page" value="<?=@$_GET['p'];?>" placeholder="Sayfa"/>
    	<b>ÇEVİRİ →</b>
    	<select class="ari_select" name="translate">
    		<option value="1"<?php if(urldecode($_GET["translate"])=="1"){ echo ' selected="selected" '; } ?>>Evet</option>
    		<option value="0"<?php if(urldecode($_GET["translate"])=="0"){ echo ' selected="selected" '; } ?>>Hayır</option>
    	</select>
    		<input type="submit" name="process" value="ARA" />
    	</form>
    
    </div>
    
    <?php 
    if($_GET["process"] == "ARA")
    {
    	$datas = $_GET;
    	extract($datas);
    	
    	if(empty($page)){$page = 1;}
    		if($page > 1)
    		{
    			$hedef = $hedefkat."page/".$page."/";
    		}else{
    			$hedef = $hedefkat;
    		}
    
    	$git = getir($hedef);
    	preg_match_all('@<div class="thumb">.*?<span class="clip">.*?<img src="(.*?)".*?>.*?</span>.*?<div class="data">.*?<h2 class="entry-title"><a href="(.*?)".*?>(.*?)</a></h2>@si', $git, $hedefs);
    
    	$xml_array = array('video' => array());
    	for($i=0; $i<count($hedefs[1]); $i++)
    	//for($i=0; $i<2; $i++)	
    	{
    		$hedefler 	= $hedefs[2][$i];
    		$img 		= $hedefs[1][$i];
    		$sure 		= "00:00";
    		$title 		= urldecode(trim(htmlspecialchars_decode($hedefs[3][$i])));
    		$title 		= strip_tags($title);
    		$varmi 		= mysql_num_rows(mysql_query("SELECT * FROM videolar WHERE sourceid = '".$hedefler."'"));
    			
    			if($varmi < 1)
    			{
    				$get 		= getir($hedefler);
    				preg_match('@<div class="entry-content.*?">(.*?)</div><.*?entry-content.*?>@si', $get, $desc);
    				preg_match('@<div id="video">(.*?)</div><.*?end #video-->@si', $get, $vid);
    				preg_match('@<meta name="keywords" content="(.*?)"@si', $get, $tags);
    				$tag 		= trim(strip_tags($tags[1]));
    				$description = trim(strip_tags($desc[1]));
    				$description = htmlspecialchars($description);
    				if($_GET["translate"]== 1)
    				{
    					$title 			=  googleTranslate($title);
    					$description 	=  googleTranslate($description);
    				}
    				$video 		= trim(kodTemizle($vid[1]));
    				$videoed	= video_urlchecker($hedefkat, $video);
    				$video_data = array(
    					'video' => $videoed,
    					'title' => (string)$title,
    					'description' => (string)$description,
    					'duration' => (string)$sure,
    					'thumb' => (string)$img,
    					'tags' => (string)$tag,			
    					'link' => (string)$hedefler
    				);
    				$xml_array['video'][] = (object)$video_data;				
    			}
    	}
    if (count($xml_array['video'])):
    
    ?>
    
    <div class="items">
    
    	<button class="submit submit-all">TÜM GÖNDERİLERİ EKLE</button>
    
    <?php
    foreach ($xml_array['video'] as $n=>$video) 
    {
    	$videos = $video->video;
    	$post_link = $video->link;	
    	$post_title = $video->title;
    	$post_image = $video->thumb;
    	$post_tags = $video->tags;
    	$description = $video->description;
    ?>
    	<div class="one-item">
    		<div class="left">
    			<div><a href="<?=$post_link?>" target="_blank"><img src="<?=$post_image;?>" /></a></div>
    		</div>
    		
    		<div class="right">
    			<div class="one-element">
    				<strong>BAŞLIK :</strong>
    				<div><input type="text" class="styled" name="post_title" value="<?=$post_title;?>" /></div>
    			</div>
    			<div class="one-element">
    				<strong>ETİKETLER :</strong>
    				<div><input type="text" class="styled" name="tags_input" value="<?=$post_tags?>" placeholder="Etiketler" /></div>
    			</div>
    			<div class="one-element">
    				<strong>TANIM :</strong>
    				<div>
    	
    					<textarea name="post_excerpt" style="width: 100%; height:300px;"><?=($description)?></textarea>
    				</div>
    			</div>			
    			<div class="one-element">
    				<strong>İÇERİK :</strong>
    				<div>
    	
    					<textarea name="post_content" style="width: 100%; height:300px;"><?=($videos)?></textarea>
    				</div>
    			</div>
    
    			<div class="one-element" style="padding-top: 5px;">
    				<strong>&nbsp;</strong>
    				<div style="display: none">
    					<input type="hidden" name="link" value="<?=$post_link;?>" />
    					<input type="hidden" name="image" value="<?=$post_image;?>" />
    					<input type="hidden" name="target" value="detube" />
    				</div>
    				<div><button class="submit">GÖNDERİYİ EKLE</button></div>
    			</div>
    		</div>
    	
    	</div>
    	
    	
    <?php
    
    }
    ?>
    
    <button class="submit submit-all">TÜM GÖNDERİLERİ EKLE</button>
    
    <?php
    $query = $_SERVER['QUERY_STRING'];
    parse_str($query, $parses);
    $parses['page'] += 1;
    $query = http_build_query($parses);
    
    ?>
    <ul class="pagination">
    	<li><a href="?<?=$query;?>">SONRAKİ</li>
    </ul>
    
    
    </div>
    
    <?php
    
    endif;	
    	
    }
    ?>
    
        </body>
    </html>
  • 21-04-2017, 00:41:01
    #2
    denemek çok uğraştırırda yolun şu; urlyi bas ekrana url geliyor mu gelmiyorsa sitede bi değişiklik vardır onu kontrol et.
  • 22-04-2017, 20:45:59
    #3
    Taktik verebilirim. curl kısmında str replace array "\n","\r","\t", "" şeklinde kodların boşluklarını temizleyip birleştirebilir, kodu alırken kod temizle fonksiyonu yerine strip_tags($degİsken,"<izinverilecektag1><izinveri lecektag2>") şeklinde kullanabilirsin.