Search

Rss Posts

Rss Comments

Login

 

Posts in ‘Internet’

PHP online proxy check script on web server!

Feb 18

So let I am introduce for you updated

PHP script for online proxy checking

on web server!

<?
// Fresh proxy list takes from http://proxy-list.org/ru/index.php
set_time_limit(10000);
 
$list = "
60.247.2.241:8080
123.176.47.203:6588 - fine - fine
";
 
$goodproxylist = '';
 
function pping($a)
{
    error_reporting(0);
    $ret = 0;
    $z = explode(":", $a);
    // Если это прокси, то в $z должно быть 2 элемента. В идеале можно регуляркой проверить что это IP:PORT
    if( 2 == count($z) ){
        $z = $z[0];
        if( $fo = fsockopen($z, 21, $errno, $errstr, 1) ){
            $ret = 1;
            fclose($fo);
        }
    }
    return $ret;
}/******************************************************************/
 
foreach (explode ("\n", $list) as $key=>$value) {
    $z ='';
    $z=explode("\t", trim($value));
    $allproxy[] = $z[0];
}
 
 
foreach ($allproxy as $key=>$value)
{
    $proxy = $value;
    if(strlen($proxy)<5) continue;
    //if (!pping($value)) continue;
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://iscience.ru/');
    curl_setopt($ch, CURLOPT_HEADER, 1);
 
    $headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
    $headers[] = 'Connection: Keep-Alive';
    $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
    $user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
 
 
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
    curl_setopt($ch, CURLOPT_PROXY, "$proxy");
    curl_setopt($ch,CURLOPT_FAILONERROR,true);
 
    $data = curl_exec($ch);
 
 
    if (curl_error($ch)) {
        print "Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) . " - exiting.<br>";
    }else {
        echo $proxy . ' - fine<br>';
        $goodproxylist .= $proxy.'<br>';
    }
    curl_close($ch);
    @ob_flush(); flush();
}
 
echo '<hr>'.$goodproxylist.'<hr>';
 
 
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://www.google.com.ua/');
    curl_setopt($ch, CURLOPT_TIMEOUT, 300);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_PROXY, "123.176.47.203:6588");
        //curl_setopt($ch, CURLOPT_PROXY, 'ip:port');
    $xml =  curl_exec($ch);
 
    if (curl_error($ch)) {
        print "Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) . " - exiting.<br>";
    }else {
        echo $xml;
    }
    curl_close($ch);
 
    echo $xml;
 
?>

How to define search engine bot on website (using PHP)?

Jan 27

Add to root folder of websitefile  bot.php

<?
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Yandex')){ $bot='Yandex';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Googlebot')){$bot='Google';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mediapartners-Google')){$bot='Mediapartners-Google (Adsense)';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Slurp')){$bot='Hot&nbsp;Bot&nbsp;search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'WebCrawler')){$bot='WebCrawler&nbsp;search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ZyBorg')){$bot='Wisenut&nbsp;search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'scooter')){$bot='AltaVista';}  
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'StackRambler')){$bot='Rambler';}  
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Aport')){$bot='Aport';}  
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'lycos')){$bot='Lycos';}  
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'WebAlta')){$bot='WebAlta';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'yahoo')){$bot='Yahoo';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'msnbot')){$bot='msnbot/1.0';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ia_archiver')){$bot='Alexa search engine';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'FAST')){$bot='AllTheWeb';}
 
if($bot !=""){
$b_data = "bots.txt";
$inf = date("YmdHis",time());
$day = date("d.m.Y",time());
$time = date("H:i",time());
$ip = $REMOTE_ADDR;
$home = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$data = fopen($b_data, "a");
fwrite($data, "$inf|$day|$time|$bot|$ip|$home|rn");
fclose($data);
}
?>

This code tracks visits to your site 15 different bots. Naturally, the list can be extended – is represented by no means all of the existing ones.

Use it, you can read: let’s say your site has a template, and its “assembly” used files header.php ( “cap” of the site) and footer.php ( “basement”). Typically, these files are inserted at the beginning and end of each page on your site.
To carried out statistics on the Hits In of SE bots in this case, you must add the file header.php following code:

include("bot.php");

Now all the bots will be tracked and kept locked in a file bots.txt on your server.
PS. Do not forget to change CHMOD of bots.txt to 777

How to change chmod for folders and files recursively?

Dec 09

chmod for all sub folders 4770, also for siles 660 …

1
2
find /path -type f -exec chmod 660 {} \;
find /path -type d -exec chmod 4770 {} \;

How to Wget files form FTP to another server recursively

Dec 04

easy
so this code …
wget:
download to ./tmp2 dir
from ftp /foldername dir
20 – dir length from main url

1
wget -r -l20 -P./tmp2 ftp://login:pas@servername/foldername

How to make onclick for show or hide div?

Dec 01

it is easy! to show div in javascript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<style>
#hide_show{
display:none
}
</style>
<script language="javascript">
function hidediv(div) {
 
  if (document.getElementById)
     document.poppedLayer = eval('document.getElementById(div)');
  else if (document.all)
     document.poppedLayer = eval('document.all[div]');
  else
     document.poppedLayer = eval('document.layers[div]');
  document.poppedLayer.style.display = "none";
}
 
function showdiv(div) {
  if (document.getElementById)
     document.poppedLayer = eval('document.getElementById(div)');
  else if (document.all)
     document.poppedLayer = eval('document.all[div]');
  else
     document.poppedLayer = eval('document.layers[div]');
  document.poppedLayer.style.display = "block";
}
</script>
<a href="#" onclick="showdiv('hide_show')">show</a> 
<a href="#" onclick="hidediv('hide_show')">show</a>
<div id="hide_show">
<h1>Here I am!</h1>
</div>

Chmod commands for install IPB forum board

Nov 15

To quick install IPB Invision Power Board run this commands in putty at root dir (public_html)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
chmod g+w ./install/installfiles/
chmod g+w ./cache/
find ./cache/ -type d -exec chmod 777 {} \;
find ./cache/ -type f -exec chmod 666 {} \;
find ./public/ -type d -exec chmod 777 {} \;
find ./public/ -type f -exec chmod 666 {} \;
find ./uploads/ -type d -exec chmod 777 {} \;
find ./hooks/ -type d -exec chmod 777 {} \;
 
 
chmod g+w ./cache/lang_cache/
chmod g+w ./cache/skin_cache/
chmod g+w ./uploads/
chmod g+w ./style_images/
chmod g+w ./conf_global.php
chmod g+w ./cache/tmp

NOTE IPB 2.* AND
IPB 3.*
SUPPORTED

A semantic kernel of site

Jul 25

A semantic kernel is a library of words and phrases, which reflect the type of Your activity or commodities/services, offered by you at the market most exactly. A semantic kernel is created from most characteristic and widespread in Your segment of market of searching queries having a special purpose audiences of Your site and sites of competitors, that will allow you to retain leading positions in the results of search, generated the searching systems, upon requests of target audiences about Your commodities/services.

Linkator

Jul 25

Linkator is the avtomatizirovannya system of exchange by Refs.s. Participants place for itself on a site the catalogue of Refs.s, where the sites of other participants are presented, or pay placing of reference the creator of catalogue without placing of catalogue for itself.

PPC – Pay Per Click PPC

Jul 25

(pay per click)(angl.) to pay for pressure. It is the system of advertising in the internet, which places advertising on sites, suitable under this theme, and payment goes for pressure an user on a banner(text or graphic). Thus turns out that an advertiser buys itself clients in the internet after fully priemlimuyu sum.

phpdug symbols encoding problem

Jul 25

phpdug coul not works normal with russian and other languages well in front and backed

to fix this you need just add

1
2
3
4
5
mysql_query( "set session character_set_server=utf8;", $db_connection );
mysql_query( "set session character_set_database=utf8;", $db_connection );
mysql_query( "set session character_set_connection=utf8;", $db_connection );
mysql_query( "set session character_set_results=utf8;", $db_connection );
mysql_query( "set session character_set_client=utf8;", $db_connection );

to

line 81

1
2
3
4
5
6
7
8
9
10
11
function db_connect($config)
{
$db_connection = @mysql_connect ($config['db']['host'], $config['db']['user'], $config['db']['pass']) OR error (mysql_error(),$config, __LINE__, __FILE__, 0, '');
$db_select = @mysql_select_db ($config['db']['name']) or error (mysql_error(),$config, __LINE__, __FILE__, 0, '');
mysql_query( "set session character_set_server=utf8;", $db_connection );
mysql_query( "set session character_set_database=utf8;", $db_connection );
mysql_query( "set session character_set_connection=utf8;", $db_connection );
mysql_query( "set session character_set_results=utf8;", $db_connection );
mysql_query( "set session character_set_client=utf8;", $db_connection );
return $db_connection;
}

public_html\includes\functions\func.global.php

 
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
29 queries. 1.012 seconds.