Jump to content

Headers already sent problem


devinruark

Recommended Posts

Hello, I am currently having a problem with my webpage.  I'm getting "Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\default.asp:1) - February 12, 2014, 2:04 pm Location: C:\xampp\htdocs\default.asp (259)" I changed line 259 a bunch of times with different versions of the code but nothing will work. Can someone explain what I'm doing wrong.

<?php
require_once getenv('SiteRoot').'config.asp';
require_once getenv('SiteRoot').'classes/class.content.php';
require_once getenv('SiteRoot').'classes/class.bbcodes.php';
require_once getenv('SiteRoot').'classes/class.data.php';
require_once getenv('SiteRoot').'addons/geoip/geoip.inc';
require_once getenv('SiteRoot').'addons/gamehandler.php';

$Maximum = new stdClass();
$Maximum->Level = 65009;
$Maximum->ClassPoints = 302500;    
	


if (strlen(session_id()) < 1) {
    session_start();
} 

switch ((isset($_SESSION['udata']) OR strtolower(key($_GET)) == 'register' OR strtolower(key($_GET)) == 'disclaimer') ? strtolower(key($_GET)) : 'login') {
case 404:
    $Handler = new Handler();
    $Handler->Output = $Handler->RetrieveTemp('default');
    $Handler->Variables['{Site_Content}'] = $Handler->RetrieveTemp('notfound');
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
    $Handler->FlushContent();
case 403:
    $Handler = new Handler();
    $Handler->Output = $Handler->RetrieveTemp('forbidden');
    $Handler->Variables['{Site_Content}'] = null;
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
    $Handler->FlushContent();
case 'ranking':
    $Handler = new Handler();
    switch($_GET[key($_GET)]) {
    case 'worldAccess':
        $Handler->connectDB();
	    $GeoIP = new GeoIP();
		$CountryList = $JSOrder = null;
		$Row = 0;

        $MYSQL_QUERY = $Handler->DBase('Query', array( 0 => 'SELECT COUNT(*) AS Total FROM meh_users WHERE LastLogin BETWEEN date_sub(now(),INTERVAL 1 WEEK) AND NOW()'));
        $Data = $MYSQL_QUERY->fetch_assoc();
		
        $MYSQL_QUERY = $Handler->DBase('Query', array( 0 => 'SELECT Country, COUNT(*) AS People, ROUND((COUNT(*) / ' . $Data['Total'] . ') * 100, 2) AS Percentage FROM meh_users WHERE LastLogin BETWEEN date_sub(now(),INTERVAL 1 WEEK) AND NOW() GROUP BY Country ORDER BY People DESC'));
        while ($obj = $MYSQL_QUERY->fetch_object()) {
		    if (empty($obj->Country)) continue;
		
            $Row++;
			$Country = $GeoIP->GEOIP_COUNTRY_NAMES[array_search($obj->Country, $GeoIP->GEOIP_COUNTRY_CODES)];
			$JSOrder .= "\ndata.setValue(".$Row.", 0, '".$Country."');\n";
			$JSOrder .= "data.setValue(".$Row.", 1, ".$obj->Percentage.");\n";
			
			if ($Row <= 10) {
				$CountryList .='<div class="sixteen columns">';
				$CountryList .='<div class="item">';
				$CountryList .='<div class="square" style="background:none"><a href="services.html"><img src="http://flagpedia.net/data/flags/small/'.strtolower($obj->Country).'.png" alt=""></a></div>';
				$CountryList .='<h3><a href="services.html" style="font-size:200%;"><span style="color:#dd4d1b;">'.$Row.':</span> '.$Country.'</a></h3>';
				$CountryList .='<p>'.number_format($obj->People).' Players playing in the last 7 days</p>';
				$CountryList .='</div>';
				$CountryList .='</div>';
			}
	    }
		
        $Handler->Output = $Handler->RetrieveTemp('default');
        $Handler->Variables['{Site_Content}'] = $Handler->RetrieveTemp('worldranking');
        $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
        $Handler->Variables['{Site_Template}'] = Configurations::Template;
        $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
        $Handler->Variables['{Server_Host}'] = $_SERVER['HTTP_HOST'];   
        $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
        $Handler->Variables['{Javascript_Order}'] = $JSOrder;
        $Handler->Variables['{Total_Country}'] = $Row + 1;
        $Handler->Variables['{Country_List}'] = $CountryList;
        $Handler->Variables['{Time_Interval}'] = date('F j, Y', strtotime('-7 days')) . ' - ' . date("F j, Y");
        $Handler->FlushContent();
	break;
	case 'topCharacters':
        $Handler->connectDB();
		$ResultSet = $Handler->DBase('Query', array( 0 => "SELECT * FROM `meh_users` WHERE access < 40 AND access > 0 ORDER BY `Level` DESC, `PVPKills` DESC, `PVPDeaths` ASC, `Exp` DESC LIMIT 10" ));
        $Top50 = $Featured = $Rank = null;
		while ($obj = $ResultSet->fetch_object()) {
			$Rank++;
			$Thropy = $Rank;
			switch ($Rank) {
			case 1:
				$Thropy = '<img src="{Site_Root}templates/{Site_Template}/images/trophy-silver-icon.png">';
			    $CharacterData = '&intColorHair='.$obj->ColorHair.'&intColorSkin='.$obj->ColorSkin.'&intColorEye='.$obj->ColorEye.'&intColorTrim='.$obj->ColorTrim.'&intColorBase='.$obj->ColorBase.'&intColorAccessory='.$obj->ColorAccessory.'&ia1=0&strGender='.$obj->Gender.'&strHairFile='.$obj->HairFile.'&strHairName='.$obj->HairName.'&strName='.$obj->Username.'&intLevel='.$obj->Level;
			    $UserInventory = $Handler->Initialize('UserInventory', array( 0 => $Handler->Initialize('UserItems', array( 0 => $obj->id)) ));

                $Featured .= '<li class="one-third column">';
                $Featured .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="231">';
                $Featured .= '<param name="movie" value="{Site_Root}gamefiles/face.swf?ver=2" />';
                $Featured .= '<param name="quality" value="high" />';
                $Featured .= '<param name="wmode" value="transparent" />';
                $Featured .= '<param name="flashvars" value="'.$CharacterData . $UserInventory->SwfData.'" />';
                $Featured .= '<embed src="{Site_Root}gamefiles/face.swf?ver=2" width="300" height="231" quality="high" wmode="transparent"  pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="'.$CharacterData . $UserInventory->SwfData.'"></embed>';
                $Featured .= '</object><h3>';
                $Featured .= '<img src="{Site_Root}templates/{Site_Template}/images/trophy-silver-icon.png" style="margin: -3px 5px;">';
                $Featured .= $obj->Username;
                $Featured .= '<p><a href="{Site_Root}?profile='.$obj->Username.'">[View character profile page]</a></p>';
                $Featured .= '</h3>';
                $Featured .= '</li>';
			break;
			case 2:
				$Thropy = '<img src="{Site_Root}templates/{Site_Template}/images/trophy-icon.png">';
			    $CharacterData = '&intColorHair='.$obj->ColorHair.'&intColorSkin='.$obj->ColorSkin.'&intColorEye='.$obj->ColorEye.'&intColorTrim='.$obj->ColorTrim.'&intColorBase='.$obj->ColorBase.'&intColorAccessory='.$obj->ColorAccessory.'&ia1=0&strGender='.$obj->Gender.'&strHairFile='.$obj->HairFile.'&strHairName='.$obj->HairName.'&strName='.$obj->Username.'&intLevel='.$obj->Level;
			    $UserInventory = $Handler->Initialize('UserInventory', array( 0 => $Handler->Initialize('UserItems', array( 0 => $obj->id)) ));

                $Featured .= '<li class="one-third column">';
                $Featured .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="231">';
                $Featured .= '<param name="movie" value="{Site_Root}gamefiles/face.swf?ver=2" />';
                $Featured .= '<param name="quality" value="high" />';
                $Featured .= '<param name="wmode" value="transparent" />';
                $Featured .= '<param name="flashvars" value="'.$CharacterData . $UserInventory->SwfData.'" />';
                $Featured .= '<embed src="{Site_Root}gamefiles/face.swf?ver=2" width="300" height="231" quality="high" wmode="transparent"  pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="'.$CharacterData . $UserInventory->SwfData.'"></embed>';
                $Featured .= '</object><h3>';
                $Featured .= '<img src="{Site_Root}templates/{Site_Template}/images/trophy-icon.png" style="margin: -3px 5px;">';
                $Featured .= $obj->Username;
                $Featured .= '<p><a href="{Site_Root}?profile='.$obj->Username.'">[View character profile page]</a></p>';
                $Featured .= '</h3>';
                $Featured .= '</li>';
			break;
		    case 3:
				$Thropy = '<img src="{Site_Root}templates/{Site_Template}/images/trophy-bronze-icon.png">';
			    $CharacterData = '&intColorHair='.$obj->ColorHair.'&intColorSkin='.$obj->ColorSkin.'&intColorEye='.$obj->ColorEye.'&intColorTrim='.$obj->ColorTrim.'&intColorBase='.$obj->ColorBase.'&intColorAccessory='.$obj->ColorAccessory.'&ia1=0&strGender='.$obj->Gender.'&strHairFile='.$obj->HairFile.'&strHairName='.$obj->HairName.'&strName='.$obj->Username.'&intLevel='.$obj->Level;
			    $UserInventory = $Handler->Initialize('UserInventory', array( 0 => $Handler->Initialize('UserItems', array( 0 => $obj->id)) ));

                $Featured .= '<li class="one-third column">';
                $Featured .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="231">';
                $Featured .= '<param name="movie" value="{Site_Root}gamefiles/face.swf?ver=2" />';
                $Featured .= '<param name="quality" value="high" />';
                $Featured .= '<param name="wmode" value="transparent" />';
                $Featured .= '<param name="flashvars" value="'.$CharacterData . $UserInventory->SwfData.'" />';
                $Featured .= '<embed src="{Site_Root}gamefiles/face.swf?ver=2" width="300" height="231" quality="high" wmode="transparent"  pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="'.$CharacterData . $UserInventory->SwfData.'"></embed>';
                $Featured .= '</object><h3>';
                $Featured .= '<img src="{Site_Root}templates/{Site_Template}/images/trophy-bronze-icon.png" style="margin: -3px 5px;">';
                $Featured .= $obj->Username;
                $Featured .= '<p><a href="{Site_Root}?profile='.$obj->Username.'">[View character profile page]</a></p>';
                $Featured .= '</h3>';
                $Featured .= '</li>';
			break;
			}
			
  			$UserExp = $obj->Exp / $Handler->Initialize('UserLevel', array( 0 => $obj->Level, 1 => $Maximum->Level ));
	
			$Top50 .= '<tr>';
			$Top50 .= '<td><b style="color: #669;">'.$Thropy.'</b></td>';
			$Top50 .= '<td><a href="{Site_Root}?profile='.$obj->Username.'">'.$obj->Username.'</a></td>';
			$Top50 .= '<td>'.$obj->Level.'</td>';
			$Top50 .= '<td><div class="meter"><span style="width: '.(($obj->Exp > $Handler->Initialize('UserLevel', array( 0 => $obj->Level, 1 => $Maximum->Level )) OR $obj->Level >= $Maximum->Level) ? 175 : round($UserExp * 175, 2)).'px;"></span></div></td>';
			$Top50 .= '<td>'.number_format($obj->Gold).'</td>';
			$Top50 .= '<td>'.number_format($obj->Coins).'</td>';
			$Top50 .= '<td>'.$obj->PVPKills.'</td>';
			$Top50 .= '<td>'.$obj->PVPDeaths.'</td>';
			$Top50 .= '</tr>' ;
		}
		
        $Handler->Output = $Handler->RetrieveTemp('default');
        $Handler->Variables['{Site_Content}'] = $Handler->RetrieveTemp('ladderboard');
        $Handler->Variables['{Top_Characters}'] = $Top50; 
        $Handler->Variables['{Featured}'] = $Featured; 
        $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
        $Handler->Variables['{Site_Template}'] = Configurations::Template;
        $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
        $Handler->Variables['{Server_Host}'] = $_SERVER['HTTP_HOST'];   
        $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
        $Handler->FlushContent();
	break;
	}
case 'validate':
    $Handler = new Handler(true);
    $Handler->connectDB();
    switch ($_GET[key($_GET)]) {
    case 'user':
        if (isset($_POST['txtUsername']) AND isset($_POST['txtPassword'])) {
            $result = array();
            $result[0] = $Handler->HandleUser('Login', array( 1 => $_POST['txtUsername'], 2 => $_POST['txtPassword'] ));    
            $result[1] = json_decode($result[0]);
            $Handler->Output = json_encode(($result[1]->{'output'} == 'success' ? array('response' => true, 'callBack' => empty($_POST['callbackFunction']) ? 'window.location.reload()' : $_POST['callbackFunction']) : array('errorMessage' => 'Invalid Credentials')));
            $Handler->FlushContent(false);
        }
        break;
    case 'exit':
        $Handler->DestroySessions();
        $Handler->Output = json_encode(array('response' => true, 'callBack' => $_POST['callbackFunction']));
        $Handler->FlushContent(false);
        break;
    }    
    break;
case 'register':  
case 'playme':    
    $Handler = new Handler();
    $Handler->connectDB();
    $Handler->Output = $Handler->RetrieveTemp('default');
    $Handler->Variables['{Site_Content}'] = $Handler->RetrieveTemp('gameboard');
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName; 
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Server_Company}'] = Configurations::ServerCompany;  
    $Handler->Variables['{Server_Host}'] = $_SERVER['HTTP_HOST'];   
    $Handler->Variables['{Server_Request_Uri}'] = $_SERVER['REQUEST_URI'];   
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
    $Handler->Variables['{Game_File}'] = strtolower(key($_GET)) == 'register' ? Configurations::RegistrationFile : Configurations::GameLoader;
    $Handler->Variables['{Game_Width}'] = 960;
    $Handler->Variables['{Game_Height}'] = 550;
    $Handler->Variables['{Total_Online}'] = $Handler->getUserOnline();    
    $Handler->FlushContent();
    break;
case 'about':
case 'faq':
case 'contact':
case 'disclaimer':
case 'upgrade':
    if (strtolower(key($_GET)) == 'contact' AND !(empty($_REQUEST['category']) AND empty($_REQUEST['description']))) {
        $Handler = new Handler(true);
        $Handler->connectDB();
	
        $UserID = $Handler->UserData['id'];
        $Category = $Handler->DBase('EscapeString', array( 0 => $_REQUEST['category'] ));
        $Message = $Handler->DBase('EscapeString', array( 0 => $_REQUEST['description'] ));
		
		$ResultSet = $Handler->DBase('Query', array( 0 => "INSERT INTO meh_reports (userid, message, category) VALUES ($UserID, '$Message', '$Category')" ));
		$Handler->Variables['{Site_Content}'] = '<div class="container clearfix">';
		$Handler->Variables['{Site_Content}'] .= '<div class="sixteen columns">';
		$Handler->Variables['{Site_Content}'] .= '<div class="alert success hideit">';
		$Handler->Variables['{Site_Content}'] .= '<p>Thanks for contacting {Site_Title}. You should receive an email response shortly.</p>';
		$Handler->Variables['{Site_Content}'] .= '<span class="close"></span>';
		$Handler->Variables['{Site_Content}'] .= '</div>';
		$Handler->Variables['{Site_Content}'] .= '</div>';
		$Handler->Variables['{Site_Content}'] .= '</div>';
	} else { $Handler = new Handler(); }    
	
    $Handler->Output = $Handler->RetrieveTemp('default');
    $Handler->Variables['{Site_Content}'] = isset($Handler->Variables['{Site_Content}']) ? $Handler->Variables['{Site_Content}'] : $Handler->RetrieveTemp(strtolower(key($_GET)));
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Email}'] = Configurations::OwnerEmail;  
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Server_Host}'] = $_SERVER['HTTP_HOST'];    
    $Handler->Variables['{PayPal_Email}'] = Configurations::PayPalEmail;    
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
    $Handler->Variables['{Character_Name}'] = isset($_SESSION['udata']) ? $Handler->UserData['Username'] : 'Guest';
    $Handler->FlushContent();
    break;
case 'login':
	$Handler = new Handler(true);
    $Handler->connectDB(); 
		
    if (isset($_POST['txtUsername']) AND isset($_POST['txtPassword'])) {
        $result = array();
        $result[0] = $Handler->HandleUser('Login', array( 1 => $_POST['txtUsername'], 2 => $_POST['txtPassword'] ));    
        $result[1] = json_decode($result[0]);
        if ($result[1]->{'output'} == 'success') header('Location: ' . getenv('SiteRoot'));
		/* Tryed replacing with */
		//if ($result[1]->{'output'} == 'success') header('Location: / ' . getenv('SiteRoot'));
		/* and a few other thigs but still getting the same error */
    }

    $Handler->Output = $Handler->RetrieveTemp('restrictedlogin');
    $Handler->Variables['{Site_Content}'] = null;
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Server_Host}'] = getenv('SiteRoot');
    $Handler->FlushContent();
    break;
case 'newsboard':
    $Handler = new Handler();
    $BBCodes = new BBCodes();
    $Handler->connectDB();    
    $Handler->Output = $Handler->RetrieveTemp('default');
    
    $NewsContent = null;
    $QueryString = (isset($_GET['p']) AND ctype_digit($_GET['p'])) ? "SELECT * FROM `cms_news` WHERE id=" . $_GET['p'] :  "SELECT * FROM `cms_news` ORDER BY `id` DESC";

    $ResultSet = $Handler->DBase('Query', array( 0 => $QueryString ));
    while ($obj = $ResultSet->fetch_object()) {
        $Avatar['Clean'] = 'images/avatars/avatar-' . trim($obj->Author) . '.png';       
        $Avatar['Width'] = 118;
        $Avatar['Height'] = 115;        
        
        if (file_exists($Avatar['Clean'])) {
            $Avatar['Clean'] = 'images/avatars/avatar-' . trim($obj->Author) . '.png';
            list($Avatar['Width'], $Avatar['Height']) = getimagesize($Avatar['Clean']);
            $Avatar['Width'] = $Avatar['Width'] > 118 ? 118 : $Avatar['Width'];
            $Avatar['Height'] = $Avatar['Height'] > 115 ? 115 : $Avatar['Height'];
        } else
        $Avatar['Clean'] = 'images/avatars/noAvatar.png';
        
        $Avatar['HTML'] = '<img src="'.$Avatar['Clean'].'" width="'.$Avatar['Width'].'" height="'.$Avatar['Height'].'" alt="'.$obj->Author.'" >';
        $NewsContent .= '<article class="post hmboxesBGC">';
        $NewsContent .= '<div class="avatarContainer"><div class="avatarBorder">'.$Avatar['HTML'].'</div></div>';
        $NewsContent .= '<div class="postContent">';      
        $NewsContent .= '<span class="title"><a href="#">'.$obj->Title.'</a></span>';      
        $NewsContent .= '<span class="publishDetails">posted by <a href="#">'.$obj->Author.'</a> on <time datetime="'.$obj->Date.'">'.$obj->Date.'</time></span>';      
        $NewsContent .= '<p>'.$BBCodes->Format($obj->Content).'</p>';      
        $NewsContent .= '<br /><div class="fb-comments" data-href="http://{Server_Host}{Server_Request_Uri}?p='.trim($obj->id).'" data-num-posts="2" data-width="455" data-colorscheme="dark"></div>';      
        $NewsContent .= '</div>';      
        $NewsContent .= '<div class="clear"></div>';      
        $NewsContent .= '</article>';      
    }    
    
    $Handler->Variables['{Site_Content}'] = $Handler->RetrieveTemp('newsboard');
    $Handler->Variables['{Site_Header}'] = $Handler->RetrieveTemp('header');
    $Handler->Variables['{Site_Header_Type}'] = 'subBanner';
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Description}'] = 'Newsboard'; 
    $Handler->Variables['{Site_News}'] = $NewsContent;     
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;        
    $Handler->Variables['{Total_Online}'] = $Handler->getUserOnline();    
    $Handler->Variables['{Server_Company}'] = Configurations::ServerCompany;  
    $Handler->Variables['{Server_Host}'] = $_SERVER['HTTP_HOST'];   
    $Handler->Variables['{Server_Request_Uri}'] = $_SERVER['REQUEST_URI'];          
    $Handler->FlushContent();    
    break;
case 'url':
    Header('Location: ' . $_GET[key($_GET)]);
    break;
case 'profile':
default:
    $Handler = new Handler();
    $Handler->connectDB();
    if (strtolower(key($_GET)) == 'profile') {
	    if (isset($_GET['id'])) {
            $USERID = $Handler->DBase('EscapeString', array( 0 => $_GET['id'] ));
            $MYSQL_QUERY = $Handler->DBase('Query', array( 0 => "SELECT * FROM meh_users WHERE id = $USERID" ));
            if ($MYSQL_QUERY->num_rows < 1) { Header('Location: ' . getenv('SiteRoot'));            
            } else { $Handler->UserData = $MYSQL_QUERY->fetch_assoc(); }		
		} else if ($_GET[key($_GET)] != $Handler->UserData['Username']) {
            $USERNAME = $Handler->DBase('EscapeString', array( 0 => $_GET[key($_GET)] ));
            $MYSQL_QUERY = $Handler->DBase('Query', array( 0 => "SELECT * FROM meh_users WHERE Username = '$USERNAME'" ));
            if ($MYSQL_QUERY->num_rows < 1) { Header('Location: ' . getenv('SiteRoot'));            
            } else { $Handler->UserData = $MYSQL_QUERY->fetch_assoc(); }
		}
    } else {
        $result[0] = $Handler->HandleUser('Login', array( 1 => $Handler->UserData['Password'] ));    
        $result[1] = json_decode($result[0]);
        if ($result[1]->{'output'} != 'success') header('Location: /');
    }
    
    $CharacterData = '&intColorHair=' . $Handler->UserData['ColorHair'] . '&intColorSkin=' . $Handler->UserData['ColorSkin'] . '&intColorEye=' . $Handler->UserData['ColorEye'] . '&intColorTrim=' . $Handler->UserData['ColorTrim'] . '&intColorBase=' . $Handler->UserData['ColorBase'] . '&intColorAccessory=' . $Handler->UserData['ColorAccessory'] . '&ia1=0&strGender=' . $Handler->UserData['Gender'] . '&strHairFile=' . $Handler->UserData['HairFile'] . '&strHairName=' . $Handler->UserData['HairName'] . '&strName=' . $Handler->UserData['Username'] . '&intLevel=' . $Handler->UserData['Level'];
    $UserInventory = $Handler->Initialize('UserInventory', array( 0 => $Handler->Initialize('UserItems', array( 0 => $Handler->UserData['id'] )) ));
    $UserExp = $Handler->UserData['Exp'] / $Handler->Initialize('UserLevel', array( 0 => $Handler->UserData['Level'], 1 => $Maximum->Level ));
    $UserCP = ($UserInventory->ClassPoints > $Maximum->ClassPoints ? $Maximum->ClassPoints : $UserInventory->ClassPoints) / $Maximum->ClassPoints;

    $Handler->Output = $Handler->RetrieveTemp('default');
    $Handler->Variables['{Site_Content}'] = strtolower(key($_GET)) == 'profile' ? $Handler->RetrieveTemp('profile') : $Handler->RetrieveTemp('homepage');
    $Handler->Variables['{Character_Overview}'] = $Handler->RetrieveTemp('overview');
    $Handler->Variables['{Site_Title}'] = Configurations::ServerName;
    $Handler->Variables['{Site_Template}'] = Configurations::Template;
    $Handler->Variables['{Site_Root}'] = getenv('SiteRoot');
    $Handler->Variables['{Facebook_Id}'] = Configurations::FacebookId;   
    $Handler->Variables['{Character_Id}'] = $Handler->UserData['id'];
    $Handler->Variables['{Character_Access}'] = $Handler->UserData['Access'];
    $Handler->Variables['{Character_Name}'] = $Handler->UserData['Username'];
    $Handler->Variables['{Character_Items}'] = $UserInventory->Weapons;
    $Handler->Variables['{Character_Armors}'] = $UserInventory->Armors;
    $Handler->Variables['{Character_Houses}'] = $UserInventory->Houses . $UserInventory->HouseItems;
    $Handler->Variables['{Character_File}'] = Configurations::CharacterFile;
    $Handler->Variables['{Character_Data}'] = $CharacterData . $UserInventory->SwfData;
    $Handler->Variables['{Character_Gold}'] = number_format($Handler->UserData['Gold']);
    $Handler->Variables['{Character_Coins}'] = number_format($Handler->UserData['Coins']);
    $Handler->Variables['{Character_Kills}'] = number_format($Handler->UserData['PVPKills']);
    $Handler->Variables['{Character_Deaths}'] = number_format($Handler->UserData['PVPDeaths']); 
    $Handler->Variables['{Character_ExpPercentage}'] = ($Handler->UserData['Exp'] > $Handler->Initialize('UserLevel', array( 0 => $Handler->UserData['Level'], 1 => $Maximum->Level )) OR $Handler->UserData['Level'] >= $Maximum->Level) ? 100 : round($UserExp * 100, 2);
    $Handler->Variables['{Character_ExpWidth}'] = ($Handler->UserData['Exp'] > $Handler->Initialize('UserLevel', array( 0 => $Handler->UserData['Level'], 1 => $Maximum->Level )) OR $Handler->UserData['Level'] >= $Maximum->Level) ? 300 : round($UserExp * 300, 2);
    $Handler->Variables['{Character_CPPercentage}'] = round($UserCP * 100, 2);
    $Handler->Variables['{Character_CPWidth}'] = round($UserCP * 300, 2);
    $Handler->FlushContent(false);
    $Handler->UserData = null;
}
?>

Any help would be greatly appreciated.  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.