• 22-05-2016, 22:10:04
    #1
    Arkadaşlar hosting değişiminden sonra kullanmış olduğum bot, kendi veritabanımdaki içeriği gösteremiyor. Bu yüzden de error.log kısmında bu şekilde hata alıyorum.
    Ama veritabanı bağlantıları doğru çünkü wp-config.php den çekiliyor içerik. Kodlar bu şekilde.

    Hata da bu şekilde;
    Alıntı
    [22-May-2016 17:44:40 UTC] PHP Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /home/xxx/public_html/xxx.php on line 12
    [22-May-2016 17:44:40 UTC] PHP Warning: mysql_query(): A link to the server could not be established in /home/xxx/public_html/kongre.php on line 12
    [22-May-2016 17:44:40 UTC] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xxx/public_html/xxx.php on line 13
    <?php
    
    include("wp-load.php");
    include("wp-config.php");
    set_time_limit(0);
    
    $site_adresi = get_bloginfo('url');
    
    $qu = mysql_query("select terms.term_id, terms.name, taxo.taxonomy, taxo.term_id	
    FROM wp_terms as terms    
    LEFT JOIN wp_term_taxonomy AS taxo ON (taxo.term_id = terms.term_id)	
    WHERE taxo.taxonomy = 'category'	");		
    while($list_terms = mysql_fetch_array($qu))	{		
    $list_term .= "<option value=\"".$list_terms["term_id"]."\">".$list_terms["name"]."</option>";	
    }	
    
    function wp_resim_ekle($url, $pid, $filename){
        $link_info = pathinfo($url);
        $filetype = wp_check_filetype($url);
        extract($filetype);
        if (!$type) $type = "";
        $upload = wp_upload_bits($filename, $filetype, @file_get_contents($url));
        if (!empty($upload['error']) ) {
            return "Resim eklenemedi!<br>Hata: ".$upload['error']."<br>";
            } else {
            $neyim = $upload['file'];
            $attachment = array(
                'guid' => $upload['url'],
                'post_mime_type' => $type,
                'post_title' => $link_info['basename'],
                'post_content' => '',
                'post_type' => 'attachment',
                'post_parent' => $pid
            );
            require_once ( ABSPATH . 'wp-admin/includes/image.php' );
            $attach_id = wp_insert_attachment($attachment, $neyim, $pid);
            $attach_data = wp_generate_attachment_metadata($attach_id, $neyim);
            wp_update_attachment_metadata($attach_id, $attach_data);
    		add_post_meta($pid, '_thumbnail_id', $attach_id);
            return $attach_data;
        }
    }
    
    function curl($url)
    
    {        $ch = curl_init();
    
            $timeout = 5;
    
             
    
            curl_setopt($ch,CURLOPT_URL,$url);
    
            curl_setopt($ch,CURLOPT_HEADER,true);
    
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    		curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
    
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
    
            curl_setopt($ch,CURLOPT_REFERER,"http://www.google.com");
    
            curl_setopt($ch,CURLOPT_USERAGENT,"googlebot");
    
            $data = curl_exec($ch);
    
            curl_close($ch);
    
            return $data;
    
    }
    	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_URL, $file);
    	curl_exec($ch);
        curl_close($ch);
    
    }
    
    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 kodTemizle ( &$yazi ) {
    		$yazi = preg_replace( "'<script[^>]*>.*?</script>'si", '', $yazi );
    
    		$yazi = preg_replace( "'<img[^>]*>'si", '', $yazi );
    		$yazi = preg_replace( "'<a[^>]*>'si", '', $yazi );
    		$yazi = preg_replace( "'<span[^>]*>'si", '', $yazi );
    
    		$yazi = str_replace("</a>","",$yazi);
    		$yazi = str_replace("</span>","",$yazi);
    		$yazi = preg_replace('/\s+/',' ',$yazi);
    		return ($yazi);
    	}
    	
    		function kaynaktemizle ( &$yazi ) {
    		$yazi = preg_replace( "'<script[^>]*>.*?</script>'si", '', $yazi );
    		return ($yazi);
    	}
    ?>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
    <?php
    if(@$_GET["process"]=="Start")
    {
    $year  = $_GET["year"];
    $month  = $_GET["month"];
    $CatID = $_GET["cat"];
    
    ### POST TIME
    $ch = curl_init();
    $cookie_new = fopen ("cookie.txt", "w");
    curl_setopt($ch, CURLOPT_URL, "http://xxxxx.net/manzara.asp");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,"yil=".$year."&ay=".$month."");
    curl_setopt($ch, CURLOPT_WRITEHEADER, $cookie_new);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $icerik = curl_exec($ch);
    fclose ($cookie_new);
    curl_close($ch);
    ### POST TIME
    
    		$baglan = curl("http://xxx.net/xxx.asp?yil=".$year."&ay=".$month."");
    		$baglan = iconv("iso-8859-9","utf-8//IGNORE", $baglan);
    		
    		preg_match_all('#onClick="(.*?)"#si', $baglan, $hedefs);
    		for($i=0; $i<count($hedefs[1]); $i++)
    		//for($i=0; $i<4; $i++)
    		{
    ?>
    <script type="text/javascript">
    function mntbot<?PHP echo $i; ?>(){$('#sonuc<?PHP echo $i; ?>').slideDown('slow');
    $("#sonuc<?PHP echo $i; ?>").html('Ekleniyor...');
    $.ajax({type:'POST',url:'manzara_i.php',
    data:$('#form<?PHP echo $i; ?>').serialize(),
    success:function(cevap){    $("#sonuc<?PHP echo $i; ?>").html(cevap)}})}
    
    </script>
    <?php		
    $k = $hedefs[1][$i];
    preg_match('~(\d+)~', str_ireplace(array('.', ','), '', $k), $eslesme);
    
    $hedefler = "http://xxx.net/manzara_detay.asp?ID=".$eslesme[1];
    
    ### POST TIME
    $ch = curl_init();
    $cookie_new = fopen ("cookie2.txt", "w");
    curl_setopt($ch, CURLOPT_URL, "http://xxx.net/manzara_detay.asp");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,"ID=".$eslesme[1]."");
    curl_setopt($ch, CURLOPT_WRITEHEADER, $cookie_new);
    $icerik = curl_exec($ch);
    fclose ($cookie_new);
    curl_close($ch);
    ### POST TIME
    
    $go = curl("$hedefler");
    $go = kaynaktemizle(iconv("iso-8859-9","UTF-8//IGNORE",$go));
    
    preg_match('#<td.*?class="kbaslik">.*?<span.*?>(.*?)</span></td>#si', $go, $htitle);
    preg_match('#<tr class="metin">.*?<td.*?>xxx</td>.*?<td.*?>&nbsp;</td>.*?<td.*?>(.*?)</td>#si', $go, $hyer);
    preg_match('#<tr class="metin">.*?<td.*?>xxx</td>.*?<td.*?>&nbsp;</td>.*?<td.*?>(.*?)</td>#si', $go, $htarih);
    preg_match('#<tr class="metin">.*?<td.*?>xxx.*?</td>.*?<td.*?>&nbsp;</td>.*?<td.*?>(.*?)</td>#si', $go, $hwho);
    preg_match('#<tr class="metin">.*?<td.*?>xxx.*?</td>.*?<td.*?>&nbsp;</td>.*?<td.*?>(.*?)</td>#si', $go, $hem);
    preg_match('@<tr class="metin">.*?<td.*?>xxx.*?</td>.*?</td>(.*?)</tr>@si', $go, $htest);
    preg_match('@<tr class="metin">.*?<td.*?>.*?xxx.*?</td>.*?</td>(.*?)</tr>@si', $go, $hsite);
    preg_match('@<span class="davet".*?>(.*?)</span>@si',$go,$hdavet);
    $title = trim(strip_tags($htitle[1]));
    $yer = trim($hyer[1]);
    $tarih = trim($htarih[1]);
    $who = trim($hwho[1]);
    $em = trim(strip_tags($hem[1]));
    $orgk = trim(strip_tags($htest[1]));
    $resim = "http://www.xxx.net.net/wp-content/uploads/yok.png";
    $desc = trim($hdavet[1]);
    $desc = urldecode($desc);
    $site = trim(strip_tags($hsite[1]));
    
    $titlec = mysql_real_escape_string($title);
    $sqlcheck = mysql_query("SELECT target FROM damn_check WHERE target = '$hedefler' LIMIT 0,1") or die(mysql_error());
    if(mysql_num_rows($sqlcheck) < '1')
    {
    ?>
  • 22-05-2016, 23:30:16
    #2
    Database bilgilerini wp-config dosyasından almadan, direk bu dosyayla bağlantı kurarak girip deneyin, muhtemelen sorun çözülecektir. Database bağlantı hatası alıyorsunuz, database bağlantısını botunuzun dosyasından sağlayın
  • 22-05-2016, 23:53:25
    #3
    Atasun adlı üyeden alıntı: mesajı görüntüle
    Database bilgilerini wp-config dosyasından almadan, direk bu dosyayla bağlantı kurarak girip deneyin, muhtemelen sorun çözülecektir. Database bağlantı hatası alıyorsunuz, database bağlantısını botunuzun dosyasından sağlayın
    Tam olarak nereye hangi şekilde eklemem gerekli hocam.
  • 23-05-2016, 00:07:36
    #4
    TeXaS adlı üyeden alıntı: mesajı görüntüle
    Tam olarak nereye hangi şekilde eklemem gerekli hocam.
    Hocam ilk önce include edilen wp-config.php doyasını botun ayar sayfasından çıkarın ve onun yerine database bilgilerini kodlarıyla birlikte oraya yazın. Muhtemelen sorun çözülecektir.

    Örneğin :
    <?php
    
    include("wp-load.php");
    mysql_connect('host', 'kullanıcı adı', 'şifre')or die("Bağlantı Kurulamadı");
    mysql_select_db('veritabani adi')or die('Veritabanı Bulunamadı');
    set_time_limit(0);
    
    $site_adresi = get_bloginfo('url');