Share hàm leech Ảnh về Xtgem và tạo Thumb cho IDVN v3
Demo:
http://khotruyenhay.gq
I. Hàm leech Ảnh về Xtgem
Cách dùng:
- Vào tool post Idvn tìm file function.php, thêm code trên vào.
- Vào file incfiles/new_posts.php
Tìm
thay thế bằng
II. Tạo thumb
Tạo file SimpleImage.php
Vào file incfiles/new_posts.php
Tìm đoạn
Lưu ý: phải vào xtgem tạo 2 thư mục img và thumb ngang hàng index.
- Trên host tạo thư mục 'img' và 'thumb' ngang hàng với file function.php và SimpleImage.php .
Và điều đặc biệt quan trọng là phải cài tool hỗ trợ idvnv3.
Nguồn: nhozkitboy - 2hi.biz
I. Hàm leech Ảnh về Xtgem
function hk_up_files($data){
preg_match_all('/\[img\](.*?)\[\/img\]/is', $data, $img);
if(!empty($img[1])){
foreach($img[1] as $i => $anh){
$anh = str_replace('
', '',$anh);
$title = rwurl(basename($anh));
$ghi=file_put_contents('img/'.$title,file_get_contents($anh));
@set_time_limit(0);
include 'set.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_URL, $auto);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser');
$nd = curl_exec($ch);
preg_match('#token=(.*?)&#is', $nd, $matoken);$token = @$matoken[1];
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload?file=/img');
$html = curl_exec($ch);
preg_match('#<input type="file" name="filext([a-z0-9] )" \/>#', $html, $xt);
$rd = 'filext'.$xt[1];
if(!isset($rd)) continue;
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload_save?__token='.$token.'&file=/img');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('MAX_FILE_SIZE' => '5242880', $rd => '@img/'.$title, 'upload_more' => 'y', 'submit' => 'OK'));
curl_exec($ch);
$data=str_replace($anh, '/img/'.$title, $data);
curl_close($ch);
}
}
return $data;
}
preg_match_all('/\[img\](.*?)\[\/img\]/is', $data, $img);
if(!empty($img[1])){
foreach($img[1] as $i => $anh){
$anh = str_replace('
', '',$anh);
$title = rwurl(basename($anh));
$ghi=file_put_contents('img/'.$title,file_get_contents($anh));
@set_time_limit(0);
include 'set.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_URL, $auto);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser');
$nd = curl_exec($ch);
preg_match('#token=(.*?)&#is', $nd, $matoken);$token = @$matoken[1];
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload?file=/img');
$html = curl_exec($ch);
preg_match('#<input type="file" name="filext([a-z0-9] )" \/>#', $html, $xt);
$rd = 'filext'.$xt[1];
if(!isset($rd)) continue;
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload_save?__token='.$token.'&file=/img');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('MAX_FILE_SIZE' => '5242880', $rd => '@img/'.$title, 'upload_more' => 'y', 'submit' => 'OK'));
curl_exec($ch);
$data=str_replace($anh, '/img/'.$title, $data);
curl_close($ch);
}
}
return $data;
}
Cách dùng:
- Vào tool post Idvn tìm file function.php, thêm code trên vào.
- Vào file incfiles/new_posts.php
Tìm
$content = md_up_files($_POST['content']);
thay thế bằng
$content = hk_up_files($_POST['content']);
II. Tạo thumb
Tạo file SimpleImage.php
<?php
header('Content-Type:image/jpeg');
class SimpleImage{
var $image;
var $image_type;
function load($filename){
$image_info=getimagesize($filename);
$this->image_type=$image_info[2];
if($this->image_type==IMAGETYPE_JPEG){
$this->image=imagecreatefromjpeg($filename);
}elseif($this->image_type==IMAGETYPE_GIF){
$this->image=imagecreatefromgif($filename);
}elseif($this->image_type==IMAGETYPE_PNG){
$this->image=imagecreatefrompng($filename);
}
}
function save($filename,$image_type=IMAGETYPE_JPEG,$compression=75,$permissions=null){
if($image_type==IMAGETYPE_JPEG){
imagejpeg($this->image,$filename,$compression);
}elseif($image_type==IMAGETYPE_GIF){
imagegif($this->image,$filename);
}elseif($image_type==IMAGETYPE_PNG){
imagepng($this->image,$filename);
}
if($permissions!=null){
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG){
if($image_type==IMAGETYPE_JPEG){
imagejpeg($this->image);
}elseif($image_type==IMAGETYPE_GIF){
imagegif($this->image);
}elseif($image_type==IMAGETYPE_PNG){
imagepng($this->image);
}
}
function getWidth(){
return imagesx($this->image);
}
function getHeight(){
return imagesy($this->image);
}
function resizeToHeight($height){
$ratio=$height/$this->getHeight();
$width=$this->getWidth()*$ratio;
$this->resize($width,$height);
}
function resizeToWidth($width){
$ratio=$width/$this->getWidth();
$height=$this->getheight()*$ratio;
$this->resize($width,$height);
}
function scale($scale){
$width=$this->getWidth()*$scale/100;
$height=$this->getheight()*$scale/100;
$this->resize($width,$height);
}
function resize($width,$height){
$new_image=imagecreatetruecolor($width,$height);
imagecopyresampled($new_image,$this->image,0,0,0,0,$width,$height,$this->getWidth(),$this->getHeight());
$this->image=$new_image;
}
}
?>
header('Content-Type:image/jpeg');
class SimpleImage{
var $image;
var $image_type;
function load($filename){
$image_info=getimagesize($filename);
$this->image_type=$image_info[2];
if($this->image_type==IMAGETYPE_JPEG){
$this->image=imagecreatefromjpeg($filename);
}elseif($this->image_type==IMAGETYPE_GIF){
$this->image=imagecreatefromgif($filename);
}elseif($this->image_type==IMAGETYPE_PNG){
$this->image=imagecreatefrompng($filename);
}
}
function save($filename,$image_type=IMAGETYPE_JPEG,$compression=75,$permissions=null){
if($image_type==IMAGETYPE_JPEG){
imagejpeg($this->image,$filename,$compression);
}elseif($image_type==IMAGETYPE_GIF){
imagegif($this->image,$filename);
}elseif($image_type==IMAGETYPE_PNG){
imagepng($this->image,$filename);
}
if($permissions!=null){
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG){
if($image_type==IMAGETYPE_JPEG){
imagejpeg($this->image);
}elseif($image_type==IMAGETYPE_GIF){
imagegif($this->image);
}elseif($image_type==IMAGETYPE_PNG){
imagepng($this->image);
}
}
function getWidth(){
return imagesx($this->image);
}
function getHeight(){
return imagesy($this->image);
}
function resizeToHeight($height){
$ratio=$height/$this->getHeight();
$width=$this->getWidth()*$ratio;
$this->resize($width,$height);
}
function resizeToWidth($width){
$ratio=$width/$this->getWidth();
$height=$this->getheight()*$ratio;
$this->resize($width,$height);
}
function scale($scale){
$width=$this->getWidth()*$scale/100;
$height=$this->getheight()*$scale/100;
$this->resize($width,$height);
}
function resize($width,$height){
$new_image=imagecreatetruecolor($width,$height);
imagecopyresampled($new_image,$this->image,0,0,0,0,$width,$height,$this->getWidth(),$this->getHeight());
$this->image=$new_image;
}
}
?>
Vào file incfiles/new_posts.php
Tìm đoạn
$zz = explode('''>
',$content); $zzz = explode('
',$content); $zzz = explode('[img]',$zz[0]);
$icon = $zzz[1];
if(!empty($icon)){
include 'SimpleImage.php';
$rs = basename($icon);
$image = new SimpleImage();
$image->load('img/'.$rs);
$image->resize(65,65);
$image->save('thumb/'.$rs);
include 'set.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_URL, $auto);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser');
$nd = curl_exec($ch);
preg_match('#token=(.*?)&#is', $nd, $matoken);
$token = @$matoken[1];
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload?file=/thumb');
$html = curl_exec($ch);
preg_match('#<input type="file" name="filext([a-z0-9] )" \/>#', $html, $xt);
$rd = 'filext'.$xt[1];
if(!isset($rd)) continue;
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload_save?__token='.$token.'&file=/thumb');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('MAX_FILE_SIZE' => '5242880', $rd => '@thumb/'.$rs, 'upload_more' => 'y', 'submit' => 'OK'));
curl_exec($ch);
curl_close($ch);
$thumb= '/thumb/'.$rs;
}else{
$thumb = '/thumb/no.png';
}
',$content); $zzz = explode('
',$content); $zzz = explode('[img]',$zz[0]);
$icon = $zzz[1];
if(!empty($icon)){
include 'SimpleImage.php';
$rs = basename($icon);
$image = new SimpleImage();
$image->load('img/'.$rs);
$image->resize(65,65);
$image->save('thumb/'.$rs);
include 'set.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_URL, $auto);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser');
$nd = curl_exec($ch);
preg_match('#token=(.*?)&#is', $nd, $matoken);
$token = @$matoken[1];
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload?file=/thumb');
$html = curl_exec($ch);
preg_match('#<input type="file" name="filext([a-z0-9] )" \/>#', $html, $xt);
$rd = 'filext'.$xt[1];
if(!isset($rd)) continue;
curl_setopt($ch, CURLOPT_URL, ' http://xtgem.com/filebrowser/file_upload_save?__token='.$token.'&file=/thumb');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('MAX_FILE_SIZE' => '5242880', $rd => '@thumb/'.$rs, 'upload_more' => 'y', 'submit' => 'OK'));
curl_exec($ch);
curl_close($ch);
$thumb= '/thumb/'.$rs;
}else{
$thumb = '/thumb/no.png';
}
Lưu ý: phải vào xtgem tạo 2 thư mục img và thumb ngang hàng index.
- Trên host tạo thư mục 'img' và 'thumb' ngang hàng với file function.php và SimpleImage.php .
Và điều đặc biệt quan trọng là phải cài tool hỗ trợ idvnv3.
Nguồn: nhozkitboy - 2hi.biz