[PHP] What is wrong with this script?

frash23

Member
May 26, 2012
85
12
I recently got this script to make homes work, but this line is seeming to give an error:

Code:
<img src="'deltahotel.co/web-gallery/images/myhabbo/profile/habbo_'.$status.'.gif" alt="'.$status.'" />

This is the error:

Parse error: syntax error, unexpected T_STRING in /home/a6639703/public_html/includes/class.homes.php on line 196

This is the full page:
Code:
<?php
class HomesManager
{
    public static function HomeExists($linkId)
    {
        return ((mysql_num_rows(mysql_query("SELECT null FROM homes WHERE link_id = '".mysql_real_escape_string($linkId)."' LIMIT 1")) > 0) ? true : false);
    }
   
    public static function GetHomeId($linkId)
    {
        if (!HomesManager::HomeExists($linkId))
        {
            return 0;
        }
        else
        {
            return mysql_result(mysql_query("SELECT home_id FROM homes WHERE link_id = '".mysql_real_escape_string($linkId)."' LIMIT 1"), 0);
        }
    }
   
    public static function CreateHome($linkId)
    {
        mysql_query("INSERT INTO homes (home_id,link_id,allow_display) VALUES ($linkId,'".mysql_real_escape_string($linkId)."','1')");
       
        $homeId = HomesManager::GetHomeId($linkId);
        $home = HomesManager::GetHome($homeId);
       
        $home->AddItem(463, 39, 1, 'profile', 'w_skin_defaultskin', $linkId);
       
        return $homeId;
    }
   
    public static function GetHomeDataRow($id)
    {
        return mysql_fetch_assoc(mysql_query("SELECT * FROM homes WHERE home_id = '".mysql_real_escape_string($id)."' LIMIT 1"));
    }
   
    public static function GetHome($id)
    {
        $data = HomesManager::GetHomeDataRow($id);
       
        if ($data == null)
        {
            return null;
        }
        else
        {
            return new Home($data['home_id'], $data['link_id']);
        }
    }
   
    public static function DisplayHome($id)
    {
        return mysql_fetch_assoc(mysql_query("SELECT allow_display FROM homes WHERE home_id = '".mysql_real_escape_string($id)."' AND allow_display = '1' LIMIT 1"));
    }
   
    public static function GetUserDataRow($id)
    {
        return mysql_fetch_assoc(mysql_query("SELECT username FROM users WHERE id = '".mysql_real_escape_string($id)."' LIMIT 1"));
    }
   
    public static function BadgesExist($id)
    {
        return  mysql_num_rows(mysql_query("SELECT id FROM homes_items WHERE data = 'badges' AND home_id = '".mysql_real_escape_string($id)."' LIMIT 1"));
    }
}
 
class Home
{
    public $id = 0;
    public $linkId = 0;
   
    public function Home($id, $linkId)
    {
        $this->id = $id;
        $this->linkId = $linkId;
    }
   
    public function AddItem($x, $y, $z, $data, $skin)
    {
        mysql_query("INSERT INTO homes_items (home_id,x,y,z,data,skin) VALUES ('".mysql_real_escape_string($this->id)."','".mysql_real_escape_string($x)."','".($y)."','".mysql_real_escape_string($z)."','".mysql_real_escape_string($data)."','".mysql_real_escape_string($skin)."')");
    }
   
    public function GetItems($id = false)
    {
        if($id == false)
        {
            $list = Array();
            $get = mysql_query("SELECT * FROM homes_items WHERE home_id = '".mysql_real_escape_string($this->linkId)."' ORDER BY x ASC");
   
            while ($item = mysql_fetch_assoc($get))
            {
                $list[] = new HomeItem($item['id'], $item['home_id'], $item['data'], $item['skin'], $item['x'], $item['y'], $item['z']);
            }
        }
        else
        {
            $item = mysql_fetch_assoc(mysql_query("SELECT * FROM homes_items WHERE id = '".mysql_real_escape_string($id)."' LIMIT 1"));
            $list = new HomeItem($item['id'], $item['home_id'], $item['data'], $item['skin'], $item['x'], $item['y'], $item['z']);
        }
       
        return $list;
    }
}
 
class HomeItem
{
    public $id = 0;
    public $homeId = 0;
   
    public $data = '';
    public $skin = '';
   
    public $x = 0;
    public $y = 0;
    public $z = 0;
   
    public function HomeItem($id, $homeId, $data, $skin, $x, $y, $z)
    {
        $this->id = $id;
        $this->homeId = $homeId;
        $this->data = $data;
        $this->skin = $skin;
        $this->x = $x;
        $this->y = $y;
        $this->z = $z;
    }
   
    public function GetHome()
    {
        return HomesManager::GetHome($this->homeId);
    }
   
    public function UpdateItem($skinId, $stickieId)
    {
        switch($skinId)
        {
            case 1:
                $skin = 'defaultskin';
                break;
            case 2:
                $skin = 'speechbubbleskin';
                break;
            case 3:
                $skin = 'metalskin';
                break;
            case 4:
                $skin = 'noteitskin';
                break;
            case 5:
                $skin = 'notepadskin';
                break;
            case 6:
                $skin = 'goldenskin';
                break;
            case 7:
                $skin = 'hc_machineskin';
                break;
            case 8:
                $skin = 'hc_pillowskin';
                break;
            default:
                $skin = 'defaultskin';
                break;
        }
       
        mysql_query("UPDATE homes_items SET skin = '".mysql_real_escape_string($skinId)."' WHERE id = '".mysql_real_escape_string($stickieId)."'");
       
        $item = mysql_fetch_assoc(mysql_query("SELECT * from homes_items WHERE id = '".$stickieId."'"));
        $list = new HomeItem($item['id'], $item['home_id'], $item['data'], $item['skin'], $item['x'], $item['y'], $item['z']);   
       
        return $list->GetHtml();
    }
   
    public function GetHtml()
    {
        switch (strtolower($this->data))
        {
            case 'profile':
            $widget = new Template('widgets/profile');
           
            $row = mysql_fetch_assoc(mysql_query("SELECT username, look, account_created, online FROM users WHERE id = '".mysql_real_escape_string($this->GetHome()->linkId)."' LIMIT 1"));
           
            if ($row['online'] == 1)
            {
                $status = 'online';
            }
            else
            {
                $status = 'offline';
            }
           
            $widget->SetParam('profile', '<span class="name-text">'.$row['username'].'</span>
                                        </div>
                                        <br class="clear" />
                                        <img src="'deltahotel.co/web-gallery/images/myhabbo/profile/habbo_'.$status.'.gif" alt="'.$status.'" />
                                        <div class="birthday text">
                                            Created on:
                                        </div>
                                        <div class="birthday date">
                                            '.$row['account_created'].'
 
                                        </div>
                                    <div>
                                </div>
                            </div>
                            <div class="profile-figure">
                                <img src="http://www.habbo.com/habbo-imaging/avatarimage?figure='.$row['look'].'&direction=4" alt="'.$row['username'].'" />');
            break;
           
            case 'badges':
            $widget = new Template('widgets/badges');
           
            $query = mysql_query("SELECT badge_id FROM user_badges WHERE user_id = '".mysql_real_escape_string($this->GetHome()->linkId)."'");
            if (mysql_num_rows($query) > 0)
            {
                while($row = mysql_fetch_assoc($query))
                {
                    $widget->SetParam('badges', '<li style="background-image: url(http://habbo.hs.llnwd.net/c_images/album1584/'.$row['badge_id'].'.gif)"></li>');
                }
            }
            else
            {
                $widget->SetParam('badges', 'You do not own any badges.');
            }
            break;
        }
       
        $widget->SetParam('id', $this->id);
        $widget->SetParam('pos-x', $this->x);
        $widget->SetParam('pos-y', $this->y);
        $widget->SetParam('pos-z', $this->z);
        $widget->SetParam('skin', $this->skin);
       
        if (isset($_SESSION['EditHome']))
        {
            if ($_SESSION['EditHome'] == $this->GetHome()->linkId)
            {
                $widget->SetParam('edit-home', '<h3>
                                        <img src="'deltahotel.co/web-gallery/images/myhabbo/icon_edit.gif" width="19" height="18" class="edit-button" id="widget-'.$this->id.'-edit" />
                                        <script type="text/javascript">
                                            var editButtonCallback = function(e)
                                            {
                                                openEditMenu(e, '.$this->id.', "widget", "widget-'.$this->id.'-edit");
                                            };
                                            Event.observe("widget-'.$this->id.'-edit", "click", editButtonCallback);
                                            Event.observe("widget-'.$this->id.'-edit", "editButton:click", editButtonCallback);
                                        </script>');
            }
        }
        else
        {
            $widget->SetParam('edit-home', '<h3>');
        }
       
        return $widget->GetHtml();
    }
}
?>
Can anybody help??
 

Users who are viewing this thread

Top