Parse error: syntax error, unexpected T_ELSE in /home/.nyles/

Forum
Last Post
Threads / Messages

Saphira

Member
Member
Joined
Jan 8, 2009
Messages
89
Points
0
Mysidian Dollar
3,860
On line 264. (lol topic title wasn't long enough.)

Line 264 has the underline bbcode around it:

PHP:
else if($act == "sentitems"){

}
else{

// No valid action...

$article_title = $lang_invalidact_title;
$article_content = $lang_invalidact;

}


[u]else{[/u]

// User is either not logged in or does not have the proper privledges to send messages...

$article_title = $lang_title_pmdenied;
$article_content = $lang_pmdenied;

}
 
What file is this in? Have you made any changes to the code for this file or is this file a part of a mod?

Try re-uploading a fresh copy of this file if it is from my script.
 
This is a part of messages.php, and yeah, I made the changes for the warning system mod. If I re-upload a fresh copy then the warning system won't work. :[
 
Well for one thing. The else/else if/and if's can't have around them. You need to get rid of that.

Lol whoopsy daisy, thats for the indication of the line nvmd.

Anyway, you are either missing one of two things, or both:

A left bracket that closes the very top 'if' statement, such as:

if($isloggedin == "yes"){

} <--

else{

}

Or, you erased a 'if' statement, its more likely the first.
 
Well, it all looks okay to me, I don't think that there are any }'s out of place. (I don't remember changing any). Would you look through my messages.php for me and see what you think? Coz this is the only problem I have with everything now lol.
 
sarge said:
Well, it all looks okay to me, I don't think that there are any }'s out of place. (I don't remember changing any). Would you look through my messages.php for me and see what you think? Coz this is the only problem I have with everything now lol.

Yeah, just post a copy of your file. =D
 
sarge said:

Okay I am looking at right now. And I need to tell you first while Im looking at it. That when I was making the report feature, i took out the part that deals with "sent items" I took that part out, because I dont use it, and at the time I wasn't thinking about if anyone else used it or not, I will have to add that part back in soon.

This isn't whats making your script not work, I just needed to tell you that.

Okay I need to know what exactly you changed, because I found brackets in the file that were missing/any totally the wrong places.
 
Bloodrun said:
Okay I am looking at right now. And I need to tell you first while Im looking at it. That when I was making the report feature, i took out the part that deals with "sent items" I took that part out, because I dont use it, and at the time I wasn't thinking about if anyone else used it or not, I will have to add that part back in soon.

This isn't whats making your script not work, I just needed to tell you that.

So that'd be:

PHP:
else if($act == "sentitems"){

}
?

I wouldn't really use it either, and if the members want it I can always add it back from the original source code.
 
sarge said:
Bloodrun said:
Okay I am looking at right now. And I need to tell you first while Im looking at it. That when I was making the report feature, i took out the part that deals with "sent items" I took that part out, because I dont use it, and at the time I wasn't thinking about if anyone else used it or not, I will have to add that part back in soon.

This isn't whats making your script not work, I just needed to tell you that.

So that'd be:

PHP:
else if($act == "sentitems"){

}
?

I wouldn't really use it either, and if the members want it I can always add it back from the original source code.

Your fixed code:

PHP:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");

$themeurl = grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links = getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads = getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************

$ugroup = getgroup();
$canpm = cando($ugroup, "canpm");

if($isloggedin == "yes" and $canpm == "yes"){

// Get our actions...

$act = $_GET["act"];
$act = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $act);
$act = secure($act);

$user = $_GET["user"];
$user = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $user);
$user = secure($user);

$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $id);
$id = secure($id);

if($act == "" or $act == "list"){

// We are showing the users all of their PMs...

$article_title = $lang_mypms_title;
$article_content = $lang_mypms."";

// Select all of the messages from the database...

$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);

if($num > 0){

$article_content = $article_content."<br><b><a href='messages.php?act=send'><img src='templates/icons/fans.gif' border=0> ".$lang_sendnewpm."</a></b><br><br><table width='550' border='1'>
  <tr>
    <td width='155'><strong>Message Title:</strong></td>
    <td width='98'><strong>From:</strong></td>
    <td width='68'><strong>Status:</strong></td>
    <td width='118'><strong>Date Received:</strong></td>
    <td width='77'><strong>Delete:</strong></td>
  </tr>";

//Loop out code
$i=0;
while ($i < $num) {

$nid=@mysql_result($result,$i,"id"); 
$status=@mysql_result($result,$i,"status"); 
$datesent=@mysql_result($result,$i,"datesent"); 
$fromuser=@mysql_result($result,$i,"fromuser"); 
$messagetitle=@mysql_result($result,$i,"messagetitle"); 

$messagetitle = stripslashes($messagetitle);

if($fromuser != "SYSTEM"){
$fromuser = "<a href='profile.php?user=".$fromuser."' target='_blank'>".$fromuser."</a>";
}

if($status == "unread"){
$status = "<b>unread</b>";
}

$article_content = $article_content."<tr>
    <td><b><a href='messages.php?act=read&id=".$nid."'>".$messagetitle."</a></b></td>
    <td>".$fromuser."</td>
    <td><center>".$status."</center></td>
    <td><center>".$datesent."</center></td>
    <td><center><a href='messages.php?act=delete&id=".$nid."'><img src='templates/icons/delete.gif' border=0></a></center></td>
  </tr>";

$i++;
}

$article_content = $article_content."</table><br>";

}
else{

$article_content = $article_content."".$lang_nopms."";

}

}
else if($act == "read"){

// We are reading a PM...

$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' AND id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);

if($num > 0){

//Loop out code
$i=0;
while ($i < 1) {

$nid=@mysql_result($result,$i,"id"); 
$status=@mysql_result($result,$i,"status"); 
$datesent=@mysql_result($result,$i,"datesent"); 
$fromuser=@mysql_result($result,$i,"fromuser"); 
$touser=@mysql_result($result,$i,"touser"); 
$messagetitle=@mysql_result($result,$i,"messagetitle"); 
$messagetext=@mysql_result($result,$i,"messagetext");

$messagetitle = stripslashes($messagetitle);
$messagetext = stripslashes($messagetext);

$i++;
}

$article_title = "Message From ".$fromuser.":";
$article_content = "<b><u>Message Title:</u></b> ".$messagetitle."<br>
<b><u>Message Text:</u></b> ".$messagetext."<br><br><b><a href='messages.php'><img src='templates/icons/next.gif' border=0> Return to Inbox</a><br> 
<a href='messages.php?act=send&user=".$fromuser."'><img src='templates/icons/comment.gif' border=0> Reply to this Message</a></b>
<br><a href='messages.php?act=report&user=".$fromuser."'><img src='templates/icons/next.gif' border=0> Report this member</a><br></b>"; 
// Set the message as read...

	$query = "UPDATE ".$prefix."messages SET status='read' WHERE id='".$nid."'";
	mysql_query($query);

}
else{

// Message Does Not Exist...

$article_title = $lang_messagenoexist_title;
$article_content = $lang_messagenoexist;

}



}
else if($act == "send" or $act == "newpm"){

// Send a new message to someone else...

$article_title = $lang_sendnew_title;
$article_content = $lang_sendnew."<br><form name='form1' method='post' action='pmpost.php'>
  <p>Message Recipient: 
    <input name='pmto' type='text' id='pmto' maxlength='50' value='".$user."'>
</p>
  <p>Message Title: 
    <input name='mtitle' type='text' id='mtitle' maxlength='25'>
</p>
  <p>Message Text:  </p>
  <p>
    <textarea name='mtext' cols='45' id='mtext'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Private Message'>
</p>
</form>"; 

}
else if($act == "report"){

$id=$_GET['id'];
$article_title = "Reporting a Member";
$article_content = "You may report a member here, by providing a reason. Please only report a member if he/she is harassing you, or constantly spamming your inbox. This isn't a toy, and shouldn't be treated as such.<br><form name='form1' method='post' action='reportpost.php'>
  <p>
    <input name='member' type='hidden' id='member' maxlength='50' value='".$user."'>
</p>
  <p>
    <input name='fromuser' type='hidden' id='fromuser' maxlength='50' value='".$loggedinname."'>
</p>
  <p>Reason:  </p>
  <p>
    <textarea name='reason' cols='45' id='reason'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Report'>
</p>
</form>"; 

} 
else if($act == "delete"){

// We are deleting a message...

$query = "DELETE FROM ".$prefix."messages WHERE touser='".$loggedinname."' and id='".$id."'";
mysql_query($query);

$article_title = $lang_delete_successful_t;
$article_content = $lang_delete_successful;

}

}

else{

// User is either not logged in or does not have the proper privledges to send messages...

$article_title = $lang_title_pmdenied;
$article_content = $lang_pmdenied;

}


// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file = $themeurl;

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links
$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************



?>
 
I changed the following:

PHP:
$article_title = "<center>Message From <a href='profile.php?user=".$fromuser."' target='_blank'>".$fromuser."</a>:</center>
$article_content = "<center><b><u>Message Title:</u></b><br> ".$messagetitle."</center><br>
<center><b><u>Message Text:</u></b><br> ".$messagetext."</center><br><br><b><a href='messages.php'><img src='templates/icons/next.gif' border=0> Return to Inbox</a><br> 
<a href='messages.php?act=send&user=".$fromuser."'><img src='templates/icons/comment.gif' border=0> Reply to this Message</a>
to this:
PHP:
$article_title = "<center>Message From <a href='profile.php?user=".$fromuser."' target='_blank'>".$fromuser."</a>:</center>
$article_content = "<center><b><u>Message Title:</u></b><br> ".$messagetitle."</center><br>
<center><b><u>Message Text:</u></b><br> ".$messagetext."</center><br><br><b><a href='messages.php'><img src='templates/icons/next.gif' border=0> Return to Inbox</a><br> 
<a href='messages.php?act=send&user=".$fromuser."'><img src='templates/icons/comment.gif' border=0> Reply to this Message</a> 
<br><a href='messages.php?act=report&user=".$fromuser."'><img src='templates/icons/next.gif' border=0> Report this member</a><br></b>";

and also,

PHP:
else if($act == "send" or $act == "newpm"){

// Send a new message to someone else...

$article_title = $lang_sendnew_title;
$article_content = $lang_sendnew."<br><form name='form1' method='post' action='pmpost.php'>
  <p>Message Recipient: 
    <input name='pmto' type='text' id='pmto' maxlength='50' value='".$user."'>
</p>
  <p>Message Title: 
    <input name='mtitle' type='text' id='mtitle' maxlength='25'>
</p>
  <p>Message Text:  </p>
  <p>
    <textarea name='mtext' cols='45' id='mtext'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Private Message'>
</p>
</form>"; 

}

to this:

PHP:
else if($act == "send" or $act == "newpm"){

// Send a new message to someone else...

$article_title = $lang_sendnew_title;
$article_content = $lang_sendnew."<br><form name='form1' method='post' action='pmpost.php'>
  <p>Message Recipient: 
    <input name='pmto' type='text' id='pmto' maxlength='50' value='".$user."'>
</p>
  <p>Message Title: 
    <input name='mtitle' type='text' id='mtitle' maxlength='25'>
</p>
  <p>Message Text:  </p>
  <p>
    <textarea name='mtext' cols='45' id='mtext'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Private Message'>
</p>
</form>"; 

}
$article_title = "Reporting a Member";
$article_content = "You may report a member here, by providing a reason. Please only report a member if he/she is harassing you, or constantly spamming your inbox. This isn't a toy, and shouldn't be treated as such.<br><form name='form1' method='post' action='reportpost.php'>
  <p>
    <input name='member' type='hidden' id='member' maxlength='50' value='".$user."'>
</p>
  <p>
    <input name='fromuser' type='hidden' id='fromuser' maxlength='50' value='".$loggedinname."'>
</p>
  <p>Reason:  </p>
  <p>
    <textarea name='reason' cols='45' id='reason'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Report'>
</p>
</form>"; 

}

I also added an extra } to the bottom of the script, because I got an unexpected $end error, and this is the only way I know to fix that error.

Edit: I just noticed your reply before this one, and everything works fine now. Thanks for your help again Bloodrun!
 
Saphira said:
I changed the following:

PHP:
$article_title = "<center>Message From <a href='profile.php?user=".$fromuser."' target='_blank'>".$fromuser."</a>:</center>
$article_content = "<center><b><u>Message Title:</u></b><br> ".$messagetitle."</center><br>
<center><b><u>Message Text:</u></b><br> ".$messagetext."</center><br><br><b><a href='messages.php'><img src='templates/icons/next.gif' border=0> Return to Inbox</a><br> 
<a href='messages.php?act=send&user=".$fromuser."'><img src='templates/icons/comment.gif' border=0> Reply to this Message</a>
to this:
PHP:
$article_title = "<center>Message From <a href='profile.php?user=".$fromuser."' target='_blank'>".$fromuser."</a>:</center>
$article_content = "<center><b><u>Message Title:</u></b><br> ".$messagetitle."</center><br>
<center><b><u>Message Text:</u></b><br> ".$messagetext."</center><br><br><b><a href='messages.php'><img src='templates/icons/next.gif' border=0> Return to Inbox</a><br> 
<a href='messages.php?act=send&user=".$fromuser."'><img src='templates/icons/comment.gif' border=0> Reply to this Message</a> 
<br><a href='messages.php?act=report&user=".$fromuser."'><img src='templates/icons/next.gif' border=0> Report this member</a><br></b>";

and also,

PHP:
else if($act == "send" or $act == "newpm"){

// Send a new message to someone else...

$article_title = $lang_sendnew_title;
$article_content = $lang_sendnew."<br><form name='form1' method='post' action='pmpost.php'>
  <p>Message Recipient: 
    <input name='pmto' type='text' id='pmto' maxlength='50' value='".$user."'>
</p>
  <p>Message Title: 
    <input name='mtitle' type='text' id='mtitle' maxlength='25'>
</p>
  <p>Message Text:  </p>
  <p>
    <textarea name='mtext' cols='45' id='mtext'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Private Message'>
</p>
</form>"; 

}

to this:

PHP:
else if($act == "send" or $act == "newpm"){

// Send a new message to someone else...

$article_title = $lang_sendnew_title;
$article_content = $lang_sendnew."<br><form name='form1' method='post' action='pmpost.php'>
  <p>Message Recipient: 
    <input name='pmto' type='text' id='pmto' maxlength='50' value='".$user."'>
</p>
  <p>Message Title: 
    <input name='mtitle' type='text' id='mtitle' maxlength='25'>
</p>
  <p>Message Text:  </p>
  <p>
    <textarea name='mtext' cols='45' id='mtext'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Private Message'>
</p>
</form>"; 

}
$article_title = "Reporting a Member";
$article_content = "You may report a member here, by providing a reason. Please only report a member if he/she is harassing you, or constantly spamming your inbox. This isn't a toy, and shouldn't be treated as such.<br><form name='form1' method='post' action='reportpost.php'>
  <p>
    <input name='member' type='hidden' id='member' maxlength='50' value='".$user."'>
</p>
  <p>
    <input name='fromuser' type='hidden' id='fromuser' maxlength='50' value='".$loggedinname."'>
</p>
  <p>Reason:  </p>
  <p>
    <textarea name='reason' cols='45' id='reason'></textarea>
</p>
  <p>
    <input type='submit' name='Submit' value='Send Report'>
</p>
</form>"; 

}

I also added an extra } to the bottom of the script, because I got an unexpected $end error, and this is the only way I know to fix that error.

Edit: I just noticed your reply before this one, and everything works fine now. Thanks for your help again Bloodrun!

Yeah your second edit is what messed everything up.

I had to get rid of the two brackets at the very bottom, and I had to add the 'else if($act = "report"){' statement for the report feature, because it will not work without it.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top