Jump to content

Build Theme!
  •  
  • Infected?

WE'RE SURE THAT YOU'LL LOVE US!

Hey there! :wub: Looks like you're enjoying the discussion, but you're not signed up for an account. When you create an account, we remember exactly what you've read, so you always come right back where you left off. You also get notifications, here and via email, whenever new posts are made. You can like posts to share the love. :D Join 93084 other members! Anybody can ask, anybody can answer. Consistently helpful members may be invited to become staff. Here's how it works. Virus cleanup? Start here -> Malware Removal Forum.

Try What the Tech -- It's free!


Photo

PHP Parse Error


  • Please log in to reply
6 replies to this topic

#1 allwinners

allwinners

    Authentic Member

  • Authentic Member
  • PipPip
  • 28 posts

Posted 24 November 2010 - 07:30 PM

Hi,
I was wondering if anyone can help me with a Parse Error with a script I am trying to install?

Parse error: syntax error, unexpected T_STRING in /home/trulykiw/public_html/admin/functions.php on line 1001

Thanks in advance
Bryce

    Advertisements

Register to Remove


#2 Overbooked

Overbooked

    Silver Member

  • Authentic Member
  • PipPipPip
  • 347 posts

Posted 24 November 2010 - 08:43 PM

Hi Bryce,

It will help if you post the code you have on line 1001 of functions.php. The error indicates that there is some syntax error on this line.
Thank you, Overbooked

#3 allwinners

allwinners

    Authentic Member

  • Authentic Member
  • PipPip
  • 28 posts

Posted 24 November 2010 - 09:26 PM

Thanks for the reply - I should have remembered to add the code, lol.

Line 990 to 1005 is as follows

if ($rs = $rss->get($rssurl)) {
for( $i = 0; $i < $limit; $i++){
$ret .= "<p class=\"msg_head\"><img src=\"images/ico_mail.png\" align=\"absmiddle\" width=\"16\" height=\"14\"> ".$rs['items'][$i]['title']."</p>";
$ret .= "<div class=\"msg_body\"><p>";
$ret .= unhtmlspecialchars($rs['items'][$i]['description'])."</p>";
$ret .= "<a href=\"".$rs['items'][$i]['link']."\" target=\"_blank\" >Read more</a>";
$ret .= "</div>\n";
}
}
else {
$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at <a href="http://anonym.to/?ht...gar.com">Anonym zu www.phpsugar.com</a> to stay up-to-date.";
}
return $ret;
}

The section in "red" is indicated to me as line 1001

Thanks again
Bryce

#4 Overbooked

Overbooked

    Silver Member

  • Authentic Member
  • PipPipPip
  • 347 posts

Posted 24 November 2010 - 10:29 PM

Than you that gives us something to work with :)

$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at <a href="http://anonym.to/?http://www.phpsugar.com">Anonym zu www.phpsugar.com</a> to stay up-to-date.";

It appears that the double quotes for the anchor tag is terminating the string prematurely. Try replacing them with double-double quotes (""http://anonym.to/?ht...w.phpsugar.com"") or slash-double quote (\"http://anonym.to/?http://www.phpsugar.com\") and see if it works.
Thank you, Overbooked

#5 allwinners

allwinners

    Authentic Member

  • Authentic Member
  • PipPip
  • 28 posts

Posted 25 November 2010 - 12:19 AM

Hi Overbooked, thanks for the assistance - I will give that a try :)

edit:

completed suggestion....

applying double-double quote - no change - same message

applying slash-double quote - new message - as follows

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/trulykiw/public_html/admin/functions.php on line 1001

Parse error: syntax error, unexpected T_STRING in /home/trulykiw/public_html/admin/functions.php on line 1001


When I delete this entire function - line 990 to 1005 - the error disappears and I gain access to admin. BUT I am of course wondering if by doing so I am breaking something else.

Edited by allwinners, 25 November 2010 - 12:36 AM.


#6 Overbooked

Overbooked

    Silver Member

  • Authentic Member
  • PipPipPip
  • 347 posts

Posted 25 November 2010 - 11:38 AM

Hi Bryce,

When I delete this entire function - line 990 to 1005 - the error disappears and I gain access to admin.

Great! You've identified the block as the only source of errors :thumbup:

BUT I am of course wondering if by doing so I am breaking something else.

Removing that section would definitely impact the functionality of the page. The block of code in the top section appears to be building a set/collection and iterating through it do display information (ie: RSS feed subscriptions).

Try replacing the code in red:

else {
$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at <a href="http://anonym.to/?ht...gar.com">Anonym zu www.phpsugar.com</a> to stay up-to-date.";
}

With the code block below:

$ret = "Sorry! Couldn't fetch the news. ";
//$ret .= "Please join our newsletter at ";
//$ret .= "<a href=\"http://anonym.to/?http://www.phpsugar.com\">Anonym zu www.phpsugar.com</a>";
//$ret .= "to stay up-to-date.";
Let's try breaking down the string into 4 lines. If you get the code block above to work without errors, un-comment the next line (remove the // before the $ret) and try again. Hopefully you get all the way down to the 4th line without errors this time.
Thank you, Overbooked

#7 Ztruker

Ztruker

    WTT Technical Elder

  • Tech Team
  • 8,292 posts
  • Interests:Helping people fix MS Windows related computer problems of all kinds.

    Waking each morning to see the green side of the Earth!

Posted 26 November 2010 - 04:13 PM

I just changed it to this and it works correctly, no error:


$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at <a href=\"http://anonym.to/?http://www.phpsugar.com\">Anonym zu www.phpsugar.com</a> to stay up-to-date.";


Keep it all on one line.

Rich
 

Die with memories, not dreams. – Unknown

Related Topics



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users