数据刷新无效

时间:2017-04-22 02:02:29

标签: php mysql facebook

嘿朋友我想在检查访问令牌是否正常工作后刷新我的数据库我想删除Facebook过期访问令牌而不删除工作访问令牌但是我的脚本删除了我的所有用户访问令牌而我没有&#39 ;我知道为什么我是PHP新手

<body>

<div id="wrap" class="boxed">
<center>
<br><br>
<div class="bannerX" style="width: 600px;">
<div class="logo">
<section class="logo">
<img src="logo-new.png">
</section>
</div>
<br>
<hr>
<br>
<?php
include'config.php';
$items = mysql_query("SELECT * FROM token_all");
$thispage = $PHP_SELF;
$num = mysql_num_rows($items);
$per_page = 300;
$start = @$_GET['start'];
if(empty($start)) $start = 000;
?>


<?php

// Turn off all error reporting
error_reporting(0);
?>







<center>
<?php
$i = "0";
if($start+$per_page<$num){
?>
[<a href="<?php print("$thispage?start=".max(0,$start+$per_page)); ?>">Next Like</a>]
<?php
}

$result = mysql_query("SELECT * FROM token_all  LIMIT $start,$per_page");
if($result){
while($row = mysql_fetch_array($result))
{
$token = $row[token];

$userData = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$token.'&fields=name,id'),true);print($userData[name]).'<br/>';
if(!$userData[name]){
$i++;
mysql_query("
DELETE FROM
token_all
WHERE
token='" . mysql_real_escape_string($token) . "'
");
}
}
}
echo $i;

?>

</body>
</html>

提前致谢

0 个答案:

没有答案