Jump to content

Unfixable PHP Error? X.x Please Help; and Thank You. =^)


Recommended Posts

I've been getting this error since around 1:30 A.M. this morning:

 

Parse error: syntax error, unexpected '}' in /home/sitename/public_html/messages.php on line 92

 

and the PHP Code is this Exactly:

 

<?php
@session_start();
include("config.php");
require_once("functions.php"); // include the functions we just wrote 
define('DATE_FORMAT', 'Y-m-d g:ia'); // define our date format variable 

$myuser = $_SESSION['username'];
if($myuser == "" || empty($myuser)) {
echo "<div id=\"header\"></div><div id=\"center\"></div><div id=\"left\">$left</div><div id=\"details\"><a href=login.php>Login</a> or <a href=register.php>Register</a></div><div id=\"content\">Please <a href=login.php>Login</a> or <a href=register.php>Register</a> to Continue.</div>";
} else {

$folder = isset($_GET['folder']) ? $_GET['folder'] : 'inbox'; 

switch($folder) { 
  case 'sent': 
    // Show my sent messages 
    $title = "Sent Messages"; 

    // Notice we set the second parameter to "true" to pull sent messages 
    $myMessages = getMyMessageList('', true); 

    // Set the columns we will be using for our display 
    $cols = array('To', 'Subject', 'Time'); 
    break; 

  default: 
    // Show our inbox 
    // Notice we are setting the same variables as above 
    $title = "Inbox"; 
    $folder = "inbox"; // This is in case we have something errant entered 
    $myMessages = getMyMessageList(); 
    $cols = array('From', 'Subject', 'Time', 'Del'); 
} 

// This is so we know how many columns we actually have 
$span = count($cols); 
if (isset($_GET['action']) && $_GET['action'] == 'send') { 
  $title = "Send Message"; 
  require('new.php'); 
  exit(); 
} 
if (isset($_GET['id'])) { 
  $id = $_GET['id']; 
  switch($folder) { 
    case 'sent': 
      $msg  = getMyMessage($id, '', true); 
      $back = "?folder=sent"; // Set my link back to Sent Messages 
      $from = "To"; 
      break; 

    case 'inbox': 
      $msg  = getMyMessage($id); 
      $back = "?folder=inbox"; 
      $from = "From"; 
      break; 

    // Obviously, if you choose, you can easily add more boxes without 
    // too much difficulty. 
  } 
  }
  // Output a "back" link 
  echo "<div id=\"header\"></div><div id=\"center\"></div><div id=\"left\">$left</div><div id=\"details\">$myuser</div><div id=\"content\"><a href=\"$back\"> Back</a>\n"; 

  // If there is no message returned, we have an error 
  if (!$msg) { 
    echo "<div id=\"content\"><p>Invalid message requested</p>\n</div>"; 
  } else { 
}
?>
<?php 
    // Define our variables (removing slashes) 
    // Add any other formating you like here (including BBCode, etc) 
    $user = stripslashes($msg['username']); 
    $date = date(DATE_FORMAT, strtotime($msg['time_sent'])); // Notice our defined constant 
    $subject = stripslashes($msg['subject']); 
    $message = nl2br(stripslashes($msg['message'])); 
    $opened  = $msg['opened']; 

    // Mark a received message "read" when it's opened 
    if ($msg['to_id'] == $_SESSION['userID'] && $opened == 'n') { 
      $sql = "UPDATE myPMs SET opened = 'y', time_opened = NOW() WHERE id = '$id'"; 
      mysql_query($sql); 
    } 
     
    // Output our message 
    echo "<h3>$subject</h3>\n"; 
    echo "<p>$from <b>$user</b><br />on $date</p>\n"; 
    echo "<p>$message</p>\n"; 
    
  } else { // They haven't chosen a message, so show the box! 

?>
<?php 
  echo "<p><a href=\"?folder=inbox\">Inbox</a> |\n"; 
  echo "<a href=\"?folder=sent\">Sent Messages</a></p>\n"; 

  // If we're in the inbox, show a Create link 
  if ($folder == 'inbox') { 
    echo "<p><a href=\"?action=send\">Create New Message</a></p>\n"; 
  } 
?> 
<?php

  }
?>

 

Any Help is [move]GREATLY[/move] appreciated! Please and Thank You. ^^

 

-Sonya Benedict =^)

Somewhare you have made some wrong with '}'(s)

like

{

  {

    //{

      }

  }

}

-------------------------------------------------

Your code is not in a Tree Structure thats why its hard to debug it Manually

Please make a Tree Structure

e.g.

if([condition])

  {

    //Job to do

  }

else

  {

    //Job To Do

  }

<?php
    // Mark a received message "read" when it's opened 
    if ($msg['to_id'] == $_SESSION['userID'] && $opened == 'n') { 
      $sql = "UPDATE myPMs SET opened = 'y', time_opened = NOW() WHERE id = '$id'"; 
      mysql_query($sql); 
    }                                          // line 90 - I'd guess this } shouldn't be here
     
    // Output our message 
    echo "<h3>$subject</h3>\n"; 
    echo "<p>$from <b>$user</b><br />on $date</p>\n"; 
    echo "<p>$message</p>\n"; 
    
  } else { // They haven't chosen a message, so show the box! 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.