Jump to content

Parse error: syntax error, unexpected '}' in /home/a1790778/public_html/addcode.


Johng123

Recommended Posts

I have no idea why I matched up all the "}" yet still get the error.

 

 

<html>
<body>
  <?php
include("/home/a1790778/public_html/include/session.php");
   global $database;
$friend_file = 'friends.txt';
$friend_code = $_POST[fcode];
$friend_content = file_get_contents($friend_file);
if(isset($_POST['fcode'])) {
   $pos = strpos($friend_content, $_POST['fcode']);
        if ($pos === false) {
           $friend_content = $friend_content . "\r\n" . $friend_code;
           if(file_put_contents($friend_file,$friend_content)) {
        print $friend_code . ' has been added to the friends file.<hr />';
        } }
        else 
            print $friend_code . ' is already on the list!<hr />';
    
}
   $q = "SELECT username,userlevel,email,timestamp "
       ."FROM ".TBL_USERS." ORDER BY userlevel DESC,username";
   $result = $database->query($q);
   $num_rows = mysql_numrows($result);
   for($i=0; $i<$num_rows; $i++) {
      $uname  = mysql_result($result,$i,"username");
      $friend_file = "/home/a1790778/public_html/FriendCodes/".$uname.".".txt;;
      $friend_content = file_get_contents($friend_file);
     if($pos === false) {
           $pos = strpos($friend_content, $_POST['fcode']);
           $friend_content = $friend_content . "\r\n" . $friend_code;
           file_put_contents($friend_file,$friend_content)
}}
?>



<br><br><br><br>
<a href="main.php">Return to Site</a>


<br><br><br><br><br><br>
<div style="font-size:0px; position:absolute; width:0px; height:0px; color:#000000; z-index:-1; overflow:hidden;"><xmp></body></xmp></div>
<script type='text/javascript'>
document.write('</bo');
document.write('dy>');


</script>
</html> 

  else            print $friend_code . ' is already on the list!<hr />';    }

 

 

needs a { in front of else

 

I don't wanna say your wrong but I am pretty sure if it just does one thing in the else it does not need a bracket

 

either way I think there is a problem with the last if statement or something because when I remove it then it works, but I need that statement

This line also needs changing....

 

$friend_file = "/home/a1790778/public_html/FriendCodes/".$uname.".".txt;;

 

to

 

$friend_file = "/home/a1790778/public_html/FriendCodes/".$uname.".txt";

 

If you indented your code consistently any missing brace errors would become clear.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.