|
|
|
แนะนำโค๊ด php เว็บสำเร็จรูป ของคนไทย แจกฟรี ดูรายละเอียดได้ที่ http://www.ebizzi.net/ ครับ |
|
|
|
|
|
|
|
เดียวเอาลงให้นะครับ พี่ต้น ใจเย็น ๆ
|
|
|
|
|
Date :
30 ก.ย. 2548 18:38:01 |
By :
@W_IN |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
// Anti Bot Links 5.01
// by bit.makejar.com NeedIfFindIt https://bitcointalk.org/index.php?action=profile;u=391838
// working demo at http://bit.makejar.com/labs/anti-bot-links-501/
// instructions at http://bit.makejar.com/labs/anti-bot-links-501/install.php
// If it works for you and you want to share some BTC: 1MakeJarmmzLs5gzkQubNJxxx9kQMZpKPr
class antibotlinks {
var $version=501;
var $link_count=3;
var $links_data=array();
var $use_gd=true;
var $fonts=array();
public function __construct($use_gd=true, $font_type='') {
$this->use_gd=$use_gd;
if (!empty($font_type)) {
$font_type=str_replace(' ', '', $font_type);
$font_type_array=explode(',', $font_type);
$font_files_array = scandir('libs/fonts');
foreach ($font_files_array as $font_file) {
$ext=pathinfo($font_file, PATHINFO_EXTENSION);
if (in_array($ext, $font_type_array)) {
$this->fonts[]=$font_file;
}
}
}
}
public function generate($link_count=3, $force_regeneration=false) {
$this->link_count=$link_count;
if ((!$force_regeneration)&&
(isset($_SESSION['antibotlinks']))&&
(is_array($_SESSION['antibotlinks']))&&
((isset($_POST['antibotlinks']))||($_SESSION['antibotlinks']['time']>time()-180))) {
return true;
}
if ($this->link_count<3) {
$this->link_count=3;
}
if ($this->link_count>5) {
$this->link_count=5;
}
$word_universe=array();
$word_universe[]=array('one'=>'1', 'two'=>'2', 'three'=>'3', 'four'=>'4', 'five'=>'5', 'six'=>'6', 'seven'=>'7', 'eight'=>'8', 'nine'=>'9', 'ten'=>'10');
$word_universe[]=array('1'=>'one', '2'=>'two', '3'=>'three', '4'=>'four', '5'=>'five', '6'=>'six', '7'=>'seven', '8'=>'eight', '9'=>'nine', '10'=>'ten');
$word_universe[]=array('1'=>'I', '2'=>'II', '3'=>'III', '4'=>'IV', '5'=>'V', '6'=>'VI', '7'=>'VII', '8'=>'VIII', '9'=>'IX', '10'=>'X');
$word_universe[]=array('cat'=>'C@t', 'dog'=>'d0g', 'lion'=>'1!0n', 'tiger'=>'T!g3r', 'monkey'=>'m0nk3y', 'elephant'=>'31eph@nt', 'cow'=>'c0w', 'fox'=>'f0x', 'mouse'=>'m0us3', 'ant'=>'@nt');
$word_universe[]=array('2-1'=>'1', '1+1'=>'2', '1+2'=>'3', '2+2'=>'4', '3+2'=>'5', '2+4'=>'6', '3+4'=>'7', '4+4'=>'8', '1+8'=>'9', '5+6'=>'11');
$word_universe[]=array('1'=>'3-2', '2'=>'8-6', '3'=>'1+2', '4'=>'3+1', '5'=>'9-4', '6'=>'3+3', '7'=>'6+1', '8'=>'2*4', '9'=>'3+6', '10'=>'2+8');
$word_universe[]=array('--x'=>'OOX', '-x-'=>'OXO', 'x--'=>'XOO', 'xx-'=>'XXO', '-xx'=>'OXX', 'x-x'=>'XOX', '---'=>'OOO', 'xxx'=>'XXX', 'x-x-'=>'XOXO', '-x-x'=>'OXOX');
$word_universe[]=array('--x'=>'--+', '-x-'=>'-+-', 'x--'=>'+--', 'xx-'=>'++-', '-xx'=>'-++', 'x-x'=>'+-+', '---'=>'---', 'xxx'=>'+++', 'x-x-'=>'+-+-', '-x-x'=>'-+-+');
$word_universe[]=array('--x'=>'oo+', '-x-'=>'o+o', 'x--'=>'+oo', 'xx-'=>'++o', '-xx'=>'o++', 'x-x'=>'+o+', '---'=>'ooo', 'xxx'=>'+++', 'x-x-'=>'+o+o', '-x-x'=>'o+o+');
$word_universe[]=array('oox'=>'--+', 'oxo'=>'-+-', 'xoo'=>'+--', 'xxo'=>'++-', 'oxx'=>'-++', 'xox'=>'+-+', 'ooo'=>'---', 'xxx'=>'+++', 'xoxo'=>'+-+-', 'oxox'=>'-+-+');
$word_universe[]=array('2*A'=>'AA', '3*A'=>'AAA', '2*B'=>'BB', '3*B'=>'BBB', '1*A+1*B'=>'AB', '1*A+2*B'=>'ABB', '2*A+2*B'=>'AABB', '2*C'=>'CC', '3*C'=>'CCC', '1*C+1*A'=>'CA', '1*C+1*B'=>'CB', '1*C+2*A'=>'CAA', '1*C+2*B'=>'CBB', '2*C+1*A'=>'CCA');
$word_universe[]=array('AA'=>'2*A', 'AAA'=>'3*A', 'BB'=>'2*B', 'BBB'=>'3*B', 'AB'=>'1*A+1*B', 'ABB'=>'1*A+2*B', 'AABB'=>'2*A+2*B', 'CC'=>'2*C', 'CCC'=>'3*C', 'CA'=>'1*C+1*A', 'CB'=>'1*C+1*B', 'CAA'=>'1*C+2*A', 'CBB'=>'1*C+2*B', 'CCA'=>'2*C+1*A');
$word_universe[]=array('zoo'=>'200', 'ozo'=>'020', 'ooz'=>'002', 'soo'=>'500', 'oso'=>'050', 'oos'=>'005', 'lol'=>'101', 'sos'=>'505', 'zoz'=>'202', 'lll'=>'111');
// I hope every faucet owner will make his own word universes
// that way there will be no single solution to attack all the faucets with the same bot
// keep 10+ items in the universe arrays
// keep the part before => short
// puzzle the people with math and logic instead with complicated language
$universe_number=mt_rand(0, count($word_universe)-1);
$universe=$word_universe[$universe_number];
$antibotlinks_solution='';
$used_keywords_array=array();
$antibotlinks_array=array();
$antibotlinks_array['links']=array();
for ($z=0;$z<$this->link_count;$z++) {
$random_number=mt_rand(1000, 9999);
$antibotlinks_solution.=$random_number.' ';
// Choose the keyword
do {
$keyword=array_rand($universe, 1);
} while (isset($used_keywords_array[$keyword]));
$used_keywords_array[$keyword]=1;
if (count($this->fonts)>0) {
ob_start();
// use ttf/otf
$info_font=$this->fonts[mt_rand(0, count($this->fonts)-1)];
$angle=mt_rand(-7, 7);
// get dimension
$infostring_length=(strlen($universe[$keyword])+1)*14;
$imx = imagecreate($infostring_length, 32);
$fontcolor = imagecolorallocate($imx, mt_rand(5, 50), mt_rand(5, 50), mt_rand(5, 50));
$imageinfo=imagefttext($imx, 18, $angle, 1, 24, $fontcolor, 'libs/fonts/'.$info_font, $universe[$keyword]);
// draw the image
$infostring_length=$imageinfo[2]+4;
$im = imagecreatetruecolor($infostring_length, 32);
imagealphablending($im, true);
$background = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $background);
$fontcolor = imagecolorallocatealpha($im, mt_rand(1, 80), mt_rand(1, 80), mt_rand(1, 80), mt_rand(0, 32));
imagefttext($im, 18, $angle, 2, 24, $fontcolor, 'libs/fonts/'.$info_font, $universe[$keyword]);
imagesavealpha($im, true);
imagepng($im);
$imagedata = ob_get_contents();
ob_end_clean();
$abdata='<img src="data:image/png;base64,'.base64_encode($imagedata).'" alt="" width="'.$infostring_length.'" height="32"/>';
} else {
$abdata=$universe[$keyword];
}
$antibotlinks_array['links'][$z]['link']='<a href="/" rel="'.$random_number.'">Anti-Bot ( '.$abdata.' )</a>';
$antibotlinks_array['links'][$z]['keyword']=$keyword;
}
$info_array=array();
foreach ($antibotlinks_array['links'] as $link) {
$info_array[]=$link['keyword'];
}
$info_string=implode(', ', $info_array);
if ($this->use_gd) {
ob_start();
if (count($this->fonts)>0) {
// use ttf/otf
$info_font=$this->fonts[mt_rand(0, count($this->fonts)-1)];
$angle=mt_rand(-1, 1);
// get dimension
$infostring_length=(strlen($universe[$keyword])+1)*14;
$imx = imagecreate($infostring_length, 32);
$fontcolor = imagecolorallocate($imx, mt_rand(5, 50), mt_rand(5, 50), mt_rand(5, 50));
$imageinfo=imagefttext($imx, 16, $angle, 1, 16, $fontcolor, 'libs/fonts/'.$info_font, $info_string);
// draw the image
$infostring_length=$imageinfo[2]+4;
$im = imagecreatetruecolor($infostring_length, 24);
imagealphablending($im, true);
$background = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $background);
$fontcolor = imagecolorallocatealpha($im, mt_rand(1, 80), mt_rand(1, 80), mt_rand(1, 80), mt_rand(0, 32));
imagecolortransparent($im, $background);
imagerectangle($im, 0, 0, $infostring_length, 16, $background);
imagefttext($im, 16, mt_rand(-1, 1), 2, 18, $fontcolor, 'libs/fonts/'.$info_font, $info_string);
imagesavealpha($im, true);
imagepng($im);
$imagedata = ob_get_contents();
} else {
// use standard fonts
$infostring_length=(strlen($info_string)+1)*7;
$im = imagecreate($infostring_length, 16);
$background = imagecolorallocate($im, mt_rand(0, 4), mt_rand(0, 4), mt_rand(0, 4));
$fontcolor = imagecolorallocate($im, mt_rand(5, 50), mt_rand(5, 50), mt_rand(5, 50));
imagecolortransparent($im, $background);
imagerectangle($im, 0, 0, $infostring_length, 16, $background);
imagestring($im, 3, mt_rand(1, 5), 1, $info_string, $fontcolor);
imagepng($im);
$imagedata = ob_get_contents();
}
ob_end_clean();
$antibotlinks_array['info']='Please click on the Anti-Bot links in the following order <img src="data:image/png;base64,'.base64_encode($imagedata).'" alt="" width="'.$infostring_length.'" height="24"/> <a href="#" id="antibotlinks_reset">( reset )</a>';
} else {
$antibotlinks_array['info']='Please click on the Anti-Bot links in the following order '.$info_string.' <a href="#" id="antibotlinks_reset">( reset )</a>';
}
shuffle($antibotlinks_array['links']);
$antibotlinks_array['time']=time();
$antibotlinks_array['solution']=trim($antibotlinks_solution);
if (!$force_regeneration) {
$antibotlinks_array['valid']=true;
}
$antibotlinks_array['universe']=$word_universe[$universe_number];
$_SESSION['antibotlinks']=$antibotlinks_array;
return true;
}
public function check() {
if ((trim($_POST['antibotlinks'])==$_SESSION['antibotlinks']['solution'])&&(!empty($_SESSION['antibotlinks']['solution']))) {
$_SESSION['antibotlinks']['valid']=true;
} else {
$_SESSION['antibotlinks']['valid']=false;
}
return $_SESSION['antibotlinks']['valid'];
}
public function get_links() {
$retval='';
foreach ($_SESSION['antibotlinks']['links'] as $linkarray) {
if (!empty($retval)) {
$retval.='","';
}
$retval.= str_replace('"', '\"', $linkarray['link']);
}
return '["'.$retval.'"]';
}
public function get_js() {
global $data;
if ($data['page']=='eligible') {
?>
<script type="text/javascript">
$(function() {
var claim_button=$('form[method="POST"] input[type="submit"], form[method="POST"] input[type="button"]');
var clicks = 0;
var time_interval = <?php echo (int)$data['button_timer']; ?>;
var ablinks=<?php echo $this->get_links(); ?>;
var interval;
$('#antibotlinks_reset').hide();
if (claim_button.length==0) {
return;
}
if (ablinks.length>$('.antibotlinks').length) {
alert('Not enough antibotlinks in the template.');
}
$('.antibotlinks').each(function(k){
if (typeof(ablinks[k])!=='undefined') {
$(this).html(ablinks[k]);
}
});
claim_button.after('<div id="ncb"></div>');
$('#ncb').append('<input type="'+claim_button.attr('type')+'" class="'+claim_button.attr('class')+'" value="Get Reward!" />');
claim_button.remove();
claim_button=$('#ncb input');
claim_button.css('display', 'none');
$('.antibotlinks a').click(function() {
$('#antibotlinks_reset').show();
clicks++;
$('#antibotlinks').val($('#antibotlinks').val()+' '+$(this).attr('rel'));
if(clicks==ablinks.length) {
var badblock=false;
<?php
if ($data['block_adblock'] == 'on') {
?>
badblock=true;
<?php
}
?>
if ((badblock)&&($('#tester').length==0)) {
claim_button.val('Please disable AdBlock and reload');
} else {
if (time_interval>0) {
claim_button.val('Please wait '+time_interval+' seconds!');
claim_button.prop('disabled', true);
interval=setInterval(function() {
time_interval--;
if (time_interval>0) {
claim_button.css('display', '');
claim_button.prop('disabled', true);
claim_button.val('Please wait '+time_interval+' seconds!');
} else {
claim_button.prop('disabled', false).val('Get Reward!');
clearInterval(interval);
}
}, 1000);
}
}
claim_button.css('display', '');
}
$(this).hide();
return false;
});
$('#antibotlinks_reset').click(function() {
clicks = 0;
$('#antibotlinks').val('');
$('.antibotlinks a').show();
time_interval = <?php echo (int)$data['button_timer']; ?>;
if (typeof(interval)!='undefined') {
clearInterval(interval);
}
claim_button.css('display', 'none');
$('#antibotlinks_reset').hide();
return false;
});
});
</script>
<?php
}
}
public function show_info() {
echo '<input type="hidden" name="antibotlinks" id="antibotlinks" value="" />';
echo '<p class="alert alert-info">'.$_SESSION['antibotlinks']['info'].'</p>';
if ((!$this->is_valid())&&(is_array($_POST))&&(count($_POST)>0)) {
?>
<div class="form-group">
<p class="alert alert-danger">Invalid AntiBot verification!</p>
</div>
<?php
}
}
public function is_valid() {
if (empty($_SESSION['antibotlinks']['valid'])) {
$_SESSION['antibotlinks']['valid']=false;
}
return $_SESSION['antibotlinks']['valid'];
}
public function get_link_count() {
return count($_SESSION['antibotlinks']['links']);
}
}
?>
|
|
|
|
|
Date :
2016-11-19 17:00:32 |
By :
Whinvers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|