RE: Parse error: syntax error, unexpected T_ELSE in /home/.nyles/
Quote:
Originally Posted by sarge
Quote:
Originally Posted by Bloodrun
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 Code:
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 Code:
<?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
// **********************************************************************
?>
|