title: PHP Unexpected End of File Syntax Error
body: <p>First off thanks for any and all answers. They are all appreciated! Ok, I am programming a method of generating TeamSpeak permissions tokens for website users. They click a button and 2 tokens are generated for them. That all works fine. Another part of the system gets the members website username, and IP Address and then searches the MySQL database of the TeamSpeak3 server to find the members serverID(An Auto-Increment Primary Key). Upon simply loading the page the member uses to do this an error is given: "Parse error: syntax error, unexpected end of file in 'FILEPATH-REPLACED' on line 92" Here is the code for this file:</p>
  
  <pre><code>&lt;?php
      if(!isset($member) || substr($_SERVER['PHP_SELF'], -11) != "console.php") {
      exit();
      }
      else {
      $memberInfo = $member-&gt;get_info();
      $consoleObj-&gt;select($_GET['cID']);
      if(!$member-&gt;hasAccess($consoleObj)) {
      exit();
      }
      }
  
      $rankObj = new Rank($mysqli);
      $rankObj-&gt;select($memberInfo['rank_id']);
      $RankInfo = $rankObj-&gt;get_info_filtered();
      $rankname = $RankInfo['name'];
      $cID = $_GET['cID'];
      $tsuid = "";
  
      $dispError = "";
      $countErrors = 0;
      if($_POST['submit']) {
          if($memberInfo['tsuid'] != "") {
          $tsuid = $memberInfo['tsuid'];
          $arrColumns = array("tsuid");
          $arrValues = array("");
          $member-&gt;update($arrColumns, $arrValues);
          }
          $ts3 = new IVTS3($tshost, $tsuser, $tspass, $tsdb);
          if($tsuid == "") {
          $tsuid = $ts3-&gt;getuid($memberInfo['username'], $memberInfo['ipaddress'], 0);
          if($tsuid == false) {
          die("Unable to retrieve TS UIDs. Please ensure you have been on our TeamSpeak Server using the same name as your website nickname. If you haven't been on our server, do so now, then regenerate tokens. Otherwise, contact Operations Support.");
          }
          $lastmembertoken = $memberInfo['tslasttokenmem'];
          $lastranktoken = $memberInfo['tslasttokenrank'];
          $lasttokens = ['rank' =&gt; $lastranktoken, 'mem' =&gt; $lastmembertoken];
          $newtoken = $ts3-&gt;createtoken($memberInfo['username'], $rankname, $lasttokens, $tsuid);
          $arrColumns = array("tslasttokenrank", "tslasttokenmem");
          $arrValues = array($newtoken['rank'], $newtoken['mem']);
          $member-&gt;update($arrColumns, $arrValues);
          echo "
                      &lt;div style='display: none' id='successBox'&gt;
                          &lt;p align='center'&gt;
                              Successfully generated new tokens!
                          &lt;/p&gt;
                      &lt;/div&gt;
  
                      &lt;script type='text/javascript'&gt;
                          popupDialog('New Tokens Created', '".$MAIN_ROOT."members/console.php?cID=$cID', 'successBox');
                      &lt;/script&gt;
  
                  ";
      }
      if(!$_POST['submit']) {
      $currentTokenRank = $memberInfo['tslasttokenrank'];
      $currentTokenMem = $memberInfo['tslasttokenmem'];
      if($currentTokenRank == "") {
      $currentTokenRank = "No Previously Generated Rank Token Exists (Click Generate Tokens Below)";
      }
      if($currentTokenMem == "") {
      $currentTokenMem = "No Previously Generated Membership Token Exists (Click Generate Tokens Below)";
      }
      echo "
      &lt;form action='".$MAIN_ROOT."members/console.php?cID=".$cID."' method='post'&gt;
      &lt;div class='formDiv'&gt;
      ";
      echo "
                      &lt;div align='center'&gt;&lt;h2&gt;======IMPORTANT TEAMSPEAK DATA======&lt;/h2&gt;&lt;/div&gt;
                      You need to use the following keys in TeamSpeak, they will give you your rank and membership group in TeamSpeak:&lt;br&gt;
                      &lt;h2&gt;Use the Membership Token First! Use it before using the Rank Token! If you fail to do this right then generate new tokens. If one or both of the tokens below have already been used, then you will need to generate new tokens.&lt;/h2&gt;
                      Your Membership Token (Copy It): &lt;b&gt;&lt;u&gt;$currentTokenMem&lt;/u&gt;&lt;/b&gt;&lt;br&gt;
                      Your Rank Token (Copy It): &lt;b&gt;&lt;u&gt;$currentTokenRank&lt;/u&gt;&lt;/b&gt;
                      &lt;br&gt;
                      HOW TO USE:&lt;br&gt;
                      1.) Open Teamspeak and connect to our server.&lt;br&gt;
                      2.) In the top menu bar click PERMISSIONS then USE PRIVILEGE KEY.&lt;br&gt;
                      3.) Paste the privilege token in and click OK. Ensure you do the Member Token First!&lt;br&gt;
                      4.) Do the same with the other key.&lt;br&gt;
                      &lt;table class='formTable'&gt;
                          &lt;tr&gt;
                              &lt;td class='main' align='center' colspan='2'&gt;&lt;br&gt;
                                  &lt;input type='submit' name='submit' value='Generate Tokens' class='submitButton' style='width: 125px'&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  
          ";
      }
  ?&gt;
  </code></pre>
  
  <p>The system references 2 functions (getuid and createtoken) in the IVTS3 class. The createtoken code is rock solid. There are no errors in it. The getuid code was recently changed along with the main file so here is the getuid code:</p>
  
  <pre><code>public function getuid($membername, $memberip, $method=0) {
      $tsuid = array();
      $membername = strtolower($membername);
      $clientid = $this-&gt;MySQL-&gt;query("SELECT client_id FROM clients WHERE client_lastip LIKE '%$memberip%' AND LOWER(client_nickname) LIKE '%$membername%'");
      while ($row = $clientid-&gt;fetch_assoc()) {
          $tsuid[] = $row['client_id'];
      }
      if ($tsuid == "") {
      $clientid = $this-&gt;MySQL-&gt;query("SELECT client_id FROM clients WHERE client_lastip LIKE '%$memberip%'");
      while ($row = $clientid-&gt;fetch_assoc()) {
          $tsuid[] = $row['client_id'];
      }
      }
      if ($tsuid == "") {
      $clientid = $this-&gt;MySQL-&gt;query("SELECT client_id FROM clients WHERE LOWER(client_nickname) LIKE '%$membername%'");
      while ($row = $clientid-&gt;fetch_assoc()) {
          $tsuid[] = $row['client_id'];
      }
      }
      if ($tsuid == "") {
      return false;
      }
      else {
      return $tsuid;
      }
  }
  </code></pre>
  
  <p>Like stated, I'm receiving the End of File error on the first code block. I may be missing something, but I've checked it over and over and still can't find anything. Thanks again guys. Any questions will be answered as quickly as possible.</p>