PDA

View Full Version : unexpected T_STRING


The Codfin Keeper
02-01-2011, 07:54 AM
I keep getting this error:

Parse error: syntax error, unexpected T_STRING in /home/a5010171/public_html/index.php on line 80

and this is my code:

<?php

// ************************************************** ********************
// Mysidia Adoptables Script: index.php
// Copyright 2011 Mysidia Adoptables staff team
// For help and support: http://www.mysidiaadoptables.com/forum/
//
// Redistribution prohibited without written permission
// ************************************************** ********************


// Wake the sleeping giant

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

include("inc/functions.php");
include("inc/config.php");
include("inc/bbcode.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];


// Convert the BBCODE to HTML
$article_content = bbconvert($article_content);

// Convert line breaks to <br>
$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
// ************************************************** ********************
$article_content = $article_content."<p>Only for a limited time - receive a special item when you visit this page!";
if ($isloggedin == "yes") {
$result = mysql_query("SELECT * FROM ".$prefix."useritems WHERE owner = '$loggedinname');
$num = mysql_numrows($result);

$i = 0;
$oh = 0;

while (i < $num){
$isit = @mysql_query($result,'0','Item');
if ($isit == "Pile of Ice Blocks") {
$oh = 'oh';
}
else {}

i++;
}

if ($oh == 'oh'){
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('','$loggedinname','Pile of Ice Blocks')");
}
else if ($oh == 0){
$article_content = $article_content."<br>You have already received this item.";
}
}
else {
$article_content = $article_content."<p>You must be logged in to receive the item.";
}

// ************************************************** ********************
// 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,$templ ate);
$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
// ************************************************** ********************



?>

What's wrong with it? Line 80 is the "if ($isit == "Pile of Ice Blocks") {" line.

fadillzzz
02-01-2011, 07:57 AM
Try this code

<?php

// ************************************************** ********************
// Mysidia Adoptables Script: index.php
// Copyright 2011 Mysidia Adoptables staff team
// For help and support: http://www.mysidiaadoptables.com/forum/
//
// Redistribution prohibited without written permission
// ************************************************** ********************


// Wake the sleeping giant

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

include("inc/functions.php");
include("inc/config.php");
include("inc/bbcode.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];


// Convert the BBCODE to HTML
$article_content = bbconvert($article_content);

// Convert line breaks to <br>
$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
// ************************************************** ********************
$article_content = $article_content."<p>Only for a limited time - receive a special item when you visit this page!";
if ($isloggedin == "yes") {
$result = mysql_query("SELECT * FROM ".$prefix."useritems WHERE owner = '$loggedinname'");
$num = mysql_numrows($result);

$i = 0;
$oh = 0;

while (i < $num){
$isit = @mysql_query($result,'0','Item');
if ($isit == "Pile of Ice Blocks") {
$oh = 'oh';
}
else {}

i++;
}

if ($oh == 'oh'){
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('','$loggedinname','Pile of Ice Blocks')");
}
else if ($oh == 0){
$article_content = $article_content."<br>You have already received this item.";
}
}
else {
$article_content = $article_content."<p>You must be logged in to receive the item.";
}

// ************************************************** ********************
// 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,$templ ate);
$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
// ************************************************** ********************



?>

The Codfin Keeper
02-01-2011, 08:18 AM
Thank you! I now have it working :happycbig:

Kaeliah
02-01-2011, 12:40 PM
Just to point out the error, I know it's already been fixed but you can tell right away from the difference in the color of the codes.

$result = mysql_query("SELECT * FROM ".$prefix."useritems WHERE owner = '$loggedinname');

That line is missing a double quote " which messes everything after it up.

The Codfin Keeper
02-01-2011, 04:09 PM
Oh, now I see. Thanks also! :happyc:

Kaeliah
02-01-2011, 07:13 PM
Solved and locked!