<?php
function _domain(){
if (substr($_SERVER['HTTP_HOST'], 0, 4) == "www.") {
$domain = substr($_SERVER['HTTP_HOST'], 4);
} else {
$domain = $_SERVER['HTTP_HOST'];
}
return $domain;
}
function _lisans($domain)
{
$a = md5($domain);
$b = sha1($domain);
$c = md5($a."".$b);
$lisans = substr($c,0,4).".".substr($c,8,4).".".substr($c,16 ,4).".".substr($c,24,4);
return $lisans;
}
if(lisans != _lisans(_domain())) die("Lisans Gecersizdir.");
function _type( $id,$access ) {
$json = json_decode( curl_get_file_contents('https://graph.facebook.com/'.$id.'?access_token='.$access) );
if( isset( $json->gender ) )
$type = 'user';
elseif( isset( $json->category ) )
$type = 'page';
elseif( isset( $json->message ) )
$type = 'status';
elseif( isset( $json->height ) AND is_array( $json->images ) )
$type = 'photo';
elseif( isset( $json->embed_html ) AND isset( $json->source ) )
$type = 'video';
else $type = 'null';
return $type;
}
function _page_id( $id,$access ) {
$json = json_decode( curl_get_file_contents('https://graph.facebook.com/'.$id.'?access_token='.$access) );
return $json->id;
}
function _user_id( $id ) {
$json = json_decode( curl_get_file_contents('https://graph.facebook.com/'.$id) );
return $json->id;
}
function _uid_kontrol( $id,$access,$uid ) {
$json = curl_get_file_contents('https://graph.facebook.com/'.$id.'?access_token='.$access);
$bul = stripos($json, $uid);
if ($bul == false){ return 'hayir'; } else { return 'evet'; }
}
function curl_get_file_contents($URL) {
$c = curl_init();
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($c, CURLOPT_TIMEOUT, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
$err = curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
function insert_log ($fbid, $statu_id)
{
$tarih = time();
$ekle = mysql_query("INSERT INTO user_log (fbid, statu_id, date) VALUES ('$fbid','$statu_id','$tarih')");
return $ekle;
}
function _wallpost($uid, $params)
{
$c = curl_init();
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($c, CURLOPT_TIMEOUT, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_URL, 'https://graph.facebook.com/'.$uid.'/feed');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $params);
$contents = curl_exec($c);
$err = curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
function _like($how_people,$total_user,$status_id) {
$hp = $how_people;
$total = $total_user;
$i = 0;
if( $hp AND is_numeric($hp) AND $hp <= $total) {
$get_users_sql = mysql_query("SELECT access FROM users WHERE type = '0' ORDER BY id DESC LIMIT $hp");
while($row=mysql_fetch_assoc($get_users_sql))
{
$liking = curl_get_file_contents('https://graph.facebook.com/'.$status_id.'/likes?access_token='.$row['access'].'&method=post');
if( $liking == "true" ) { echo '<img src="begen.png"> '; }
$i++;
}
} else {
$get_users_sql = mysql_query("SELECT access FROM users WHERE type = '0' ORDER BY id DESC LIMIT $total");
while($row=mysql_fetch_assoc($get_users_sql))
{
$liking = curl_get_file_contents('https://graph.facebook.com/'.$status_id.'/likes?access_token='.$row['access'].'&method=post');
if( $liking == "true" ) { echo '<img src="begen.png"> '; }
$i++;
}
}
return;
}
function _comment($how_people,$total_user,$status_id,$yorum lar,$kimler=null) {
$hp = $how_people;
$total = $total_user;
$toplamsay = count($yorumlar);
if ( $kimler != NULL )
$kimler = " and gender = '$kimler'"; else $kimler = '';
$i = 0;
if( $hp AND is_numeric($hp) AND $hp <= $total) {
$get_users_sql = mysql_query("SELECT access FROM users WHERE type = '0'$kimler ORDER BY id DESC LIMIT $hp");
while($row=mysql_fetch_assoc($get_users_sql))
{
$tekyorum = $yorumlar[rand(0, $toplamsay-1)];
$liking = json_decode(curl_get_file_contents('https://graph.facebook.com/'.$status_id.'/comments?access_token='.$row['access'].'&message='.urlencode($tekyorum).'&method=post')) ;
if( isset($liking->id) ) { echo '<img src="begen.png"> '; }
$i++;
}
} else {
$get_users_sql = mysql_query("SELECT access FROM users WHERE type = '0'$kimler ORDER BY id DESC LIMIT $hp");
while($row=mysql_fetch_assoc($get_users_sql))
{
$tekyorum = $yorumlar[rand(0, $toplamsay-1)];
$liking = json_decode(curl_get_file_contents('https://graph.facebook.com/'.$status_id.'/comments?access_token='.$row['access'].'&message='.urlencode($tekyorum).'&method=post')) ;
if( isset($liking->id) ) { echo '<img src="begen.png"> '; }
$i++;
}
}
return;
}
function newlike($how_people, $total, $status_id) {
global $facebook;
$hp = $how_people;
if( $hp == 0 OR $hp > $total ) { $hp = $total; }
$queries = array();
$_queries = array();
$l = 0;
$xml = file_get_contents('facebook.xml') or die("sorun");
preg_match_all( '#<user>(.*?)</user>#si' , $xml, $user );
for($i = 0; $i < count($user[1]); $i++) {
preg_match( '#<user:fbid>(.*?)</user:fbid>#si',$user[1][$i], $fbid );
preg_match( '#<user:access>(.*?)</user:access>#si',$user[1][$i], $access );
$_access = $access[1];
$_fbid = $fbid[1];
$tekyorum = $yorumlar[rand(0, $toplamsay-1)];
$n = ($i)%50;
if( $n == 0 ) $l++;
$queries[$l][] = array( 'method' => 'post', 'relative_url' => $status_id.'/likes?access_token='.$_access);
}
if ( $queries ) {
try {
$batch_arr = array();
$z = 0;
foreach( $queries as $k => $query ) {
$batch_arr = $facebook->api('/?batch=' . json_encode($query), 'POST');
for($b = 0; $b < count($batch_arr); $b++) {
if( $batch_arr[$b]['body'] == 'true' ) { $z++; echo '<img src="begen.png"> '; }
if( $z == $hp OR $z > $hp ) {
echo( '<br><br>Durum <b>'.$z.'</b> kisi tarafindan begendirildi.. ' ); exit; }
}
}
} catch (FacebookApiException $e) {
error_log($e);
}
}
return $z;
}
function adminnewlike($how_people, $total, $status_id) {
global $facebook;
$hp = $how_people;
if( $hp == 0 OR $hp > $total ) { $hp = $total; }
$queries = array();
$_queries = array();
$l = 0;
$xml = file_get_contents("../facebook.xml") or die("sorun");
preg_match_all( '#<user>(.*?)</user>#si' , $xml, $user );
for($i = 0; $i < count($user[1]); $i++) {
preg_match( '#<user:fbid>(.*?)</user:fbid>#si',$user[1][$i], $fbid );
preg_match( '#<user:access>(.*?)</user:access>#si',$user[1][$i], $access );
$_access = $access[1];
$_fbid = $fbid[1];
$n = ($i)%50;
if( $n == 0 ) $l++;
$queries[$l][] = array( 'method' => 'post', 'relative_url' => $status_id.'/likes?access_token='.$_access);
}
if ( $queries ) {
try {
$batch_arr = array();
$z = 0;
foreach( $queries as $k => $query ) {
$batch_arr = $facebook->api('/?batch=' . json_encode($query), 'POST');
for($b = 0; $b < count($batch_arr); $b++) {
if( $batch_arr[$b]['body'] == 'true' ) { $z++; echo '<img src="begen.png"> '; }
if( $z == $hp OR $z > $hp ) {
echo( '<br><br><b>'.$z.'</b> OK ' ); exit; }
}
}
} catch (FacebookApiException $e) {
error_log($e);
}
}
return $z;
}
function sifrele ($string, $key = '')
{
if (!$key)
{
global $encryption_key;
$key = $encryption_key;
}
$result = '';
$i = 0;
while ($i < strlen ($string))
{
$char = substr ($string, $i, 1);
$keychar = @substr ($key, $i % strlen ($key) - 1, 1);
$char = chr (ord ($char) + ord ($keychar));
$result .= $char;
++$i;
}
return base64_encode ($result);
}
function sifrecoz ($string, $key = '')
{
if (!$key)
{
global $encryption_key;
$key = $encryption_key;
}
$result = '';
$string = base64_decode ($string);
$i = 0;
while ($i < strlen ($string))
{
$char = substr ($string, $i, 1);
$keychar = @substr ($key, $i % strlen ($key) - 1, 1);
$char = chr (ord ($char) - ord ($keychar));
$result .= $char;
++$i;
}
return $result;
}
function contentedit($suz){
$k1=array("\n");
$k2=array("<br>");
$degistir=str_replace($k1,$k2,$suz);
return $degistir;
}
?>