SRL Archive - Web Development

Script Errors!


Dynamite

2010-08-17 19:25:55

Ok so I have installed a script called Elite Gaming Ladders.
But when I try to go Site Settings, I get:

Warning: Cannot modify header information - headers already sent by (output started at /home/sniper1/domains/sniperbattles.com/public_html/admincp/index.php:176) in /home/sniper1/domains/xxxxxxxxx.com/public_html/admincp/includes/settings.php on line 385

Please can someone look at the code?

Settings.php:

[php]<?php
/*=======================================================================================================================================*\
|| ##################################################################################################################################### ||
|| # Elite Gaming Ladder v3.x.x # ||
|| # ——————————————————————————————————————————— # ||
|| # Elite Ladders - Copyright ©2007-2009 XLed Limited. # ||
|| # Protected by International Copyright Law accross 163 countries. # ||
|| # # ||
|| # Pursuant to Title 17, United States Code, the owner of this copyright has filed a valid Certificate of Registration # ||
|| # with the United States Copyright Office. # ||
|| # # ||
|| # A copyrighted work may not be copied, reproduced, distributed or publicly displayed without the consent of the author # ||
|| # or copyright owner. Any unauthorized use of this code or any of its contents, in whole or in part, shall be considered # ||
|| # copyright infringement. It is illegal for anyone to violate any of the rights provided by the copyright laws to the # ||
|| # owner of this copyright. # ||
|| # # ||
|| # Should you infringe this copyright, you may be liable to the owner for relief such as injunction, impounding and disposition # ||
|| # of infringing articles, attorney&#8217;s fees, actual damages and any profits resulting from the infringement, or statutory damages # ||
|| # up to $150,000 if the infringement was committed willfully. # ||
|| # # ||
|| # For information regarding the authorized use of any of the contents of this website and code, contact the website owner directly. # ||
|| # # ||
|| # ————————————— Elite Ladders IS NOT FREE SOFTWARE —————————————————— # ||
|| # http://www.eliteladders.com # ||
|| # # ||
|| # Full terms and conditions can be found at http://www.eliteladders.com/terms # ||
|| # # ||
|| ##################################################################################################################################### ||
\*=======================================================================================================================================*/

$admin=mysql_query("SELECT * FROM members WHERE name='{$_SESSION['aname']}' AND password='{$_SESSION['apass']}'");
$admin=mysql_fetch_array($admin);

$group=mysql_query("SELECT * FROM member_groups WHERE id='$admin[gid]'");
$group=mysql_fetch_array($group);

function settings($mes){
global $config;
echo"<body>
<br>
<table class='ucp_fields' cellpadding='4' cellspacing='3' border='0' align='center' width='95%'>
<tr>
<td align='center' height='25' colspan='4' class='ucp_menu'>
<b>Site Settings</b>
</td>
</tr>
<form method='post'>";
$sett = mysql_query("SELECT * FROM configuration");
while ($set = mysql_fetch_array($sett)){
if($set[name] == sitename){$set[namedefined] = 'Site Name';}
if($set[name] == sitemail){$set[namedefined] = 'Site E-Mail';}
if($set[name] == paypalaccount){$set[namedefined] = 'Paypal Account E-Mail (for usergroup fees)';}
if($set[name] == forumlink){$set[namedefined] = 'Link To Forums';}
if($set[name] == phpbb3){$set[namedefined] = 'Enable PHPBB3 (yes/no)';}
if($set[name] == scripturl){$set[namedefined] = 'Script Path';}
if($set[name] == sitelink){$set[namedefined] = 'Site Link';}
if($set[name] == theme){$set[namedefined] = 'Theme Directory';}
if($set[name] == shownews){$set[namedefined] = 'News Articles Per Page';}
if($set[name] == showranks){$set[namedefined] = 'Ranks Per Page';}
if($set[name] == searchresults){$set[namedefined] = 'Nr of Search Results To Display';}
if($set[name] == showmatchesdb){$set[namedefined] = 'Nr of Recent Matches To Display (matchdb.php)';}
if($set[name] == showchallenges){$set[namedefined] = 'Nr of Challenges To Show';}
if($set[name] == nukealogdays){$set[namedefined] = 'Nr of Days Log Entrees Stay In The DB';}
if($set[name] == ticketd){$set[namedefined] = 'Nr of Days Completed Tickets Stay In The DB';}
if($set[name] == hotstreak){$set[namedefined] = 'Number of Wins To Be Considered Hot';}
if($set[name] == coldstreak){$set[namedefined] = 'Number of Losses To Be Considered Cold';}
if($set[name] == uparrow){$set[namedefined] = 'Number of Wins To Get An Up Arrow';}
if($set[name] == downarrow){$set[namedefined] = 'Number of Losses To Get a Down Arrow';}
if($set[name] == maxmembers){$set[namedefined] = 'Maximum Number of Members Per Team';}
if($set[name] == wartime){$set[namedefined] = 'Time Teams Must Wait In Hours Before Warring Each Other Again';}
if($set[name] == maxmail){$set[namedefined] = 'Maximum Number of Messages Per Member';}
if($set[name] == newslength){$set[namedefined] = 'Number of Characters Before News Is Cut Off';}
if($set[name] == shutdown){$set[namedefined] = 'Site Shutdown Message (If Set, Site Will Go Into Lockdown)';}
if($set[name] == license){$set[namedefined] = 'License Key';}
if($set[name] == nchange){$set[namedefined] = 'Allow Name Changes (yes/no)';}
if($set[name] == emailactivation){$set[namedefined] = 'Activate Accounts Through Email Links (yes/no)';}
if($set[name] == youtube){$set[namedefined] = 'Youtube (youtube link)';}
if($set[name] == ticker){$set[namedefined] = 'News Ticker (txt)';}
echo"
<tr valign='top'>
<td class='optiontitle' colspan='2'>$set[namedefined] </td><td align='right'><input type='text' name='set[$set[name]]' value='$set[value]' size='50' maxlength='40'></td>
</td>
</tr>
";
}
echo"
<tr valign='top'>
<td class='alt1'><div class='smallfont' align='center'>
<input type='hidden' name='act' value='updateset'>
<input type='submit' name='submit' value='Update Settings'></td></tr>
</div>
</form>
</td>
</tr>
</tbody>
</table>
";
}
function updatesettings($set){
global $config;
$settings=mysql_query("SELECT name,value FROM configuration");
while(list($name,$value)=mysql_fetch_row($settings)){
mysql_query("UPDATE configuration SET value='$set[$name]' WHERE name='$name'");
}
$mes=" (Settings Have Been Updated!)";
settings($mes);
$adminlog[admin]="{$_SESSION['aname']}";
$adminlog[details]="[Updated Settings] Updated Site Settings";
adminlog($adminlog);
}


// licence
$license="$config[license]";
$servers = array();
$servers[] = 'http://eliteladders.com/clientarea/'; // main server


# You can ignore everything below this line if you want to ————————–

$query_string="license=".$license;
$query_string.="&product_id=17";

$per_server=false;
$per_install=false;
$per_site=true;

$enable_dns_spoof='yes';

# functions ————————————————————————-

// added v2.0.10
function make_token() { return md5('592256c680f494f1f1eec5670c9e9bb0'.time()); }
// END added v2.0.10

function get_key()
{
$data=@file("key.php");

if (!$data) { return false; }

$buffer=false;
foreach ($data as $line) { $buffer.=$line; }
if (!$buffer) { return false; }

$buffer=@str_replace("<?PHP", "", $buffer);
$buffer=@str_replace("?>", "", $buffer);
$buffer=@str_replace("/*–", "", $buffer);
$buffer=@str_replace("–*/", "", $buffer);

return @str_replace("\n", "", $buffer);
}

function parse_local_key()
{
if (!@file_exists("key.php")) { return false; }

$raw_data=@base64_decode(get_key());
$raw_array=@explode("|", $raw_data);
if (@is_array($raw_array)&&@count($raw_array)<8) { return false; }

return $raw_array;
}

function validate_local_key($array)
{
$raw_array=parse_local_key();

if (!@is_array($raw_array)||$raw_array===false)
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' />";
}

if ($raw_array[9]&&@strcmp(@md5("592256c680f494f1f1eec5670c9e9bb0".$raw_array[9]), $raw_array[10])!=0)
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' />";
}

if (@strcmp(@md5("592256c680f494f1f1eec5670c9e9bb0".$raw_array[1]), $raw_array[2])!=0)
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}

if ($raw_array[1]<time()&&$raw_array[1]!="never")
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}

if ($array['per_server'])
{
$server=phpaudit_get_mac_address();
$mac_array=@explode(",", $raw_array[6]);
if (!@in_array(@md5("592256c680f494f1f1eec5670c9e9bb0".$server[0]), $mac_array))
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}

$host_array=@explode(",", $raw_array[4]);
if (!@in_array(@md5("592256c680f494f1f1eec5670c9e9bb0".@gethostbyaddr(@gethostbyname($server[1]))), $host_array))
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}
}
else if ($array['per_install']||$array['per_site'])
{
if ($array['per_install'])
{
$directory_array=@explode(",", $raw_array[3]);
$valid_dir=path_translated();
$valid_dir=@md5("592256c680f494f1f1eec5670c9e9bb0".$valid_dir);
if (!@in_array($valid_dir, $directory_array))
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}
}

$host_array=@explode(",", $raw_array[4]);
if (!@in_array(@md5("592256c680f494f1f1eec5670c9e9bb0".$_SERVER['HTTP_HOST']), $host_array))
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}

$ip_array=@explode(",", $raw_array[5]);
if (!@in_array(@md5("592256c680f494f1f1eec5670c9e9bb0".server_addr()), $ip_array))
{
return "<verify status='invalid_key' message='Please contact support for a new license key.' ".$raw_array[9]." />";
}
}

return "<verify status='active' message='The license key is valid.' ".$raw_array[9]." />";
}

function phpaudit_exec_socket($http_host, $http_dir, $http_file, $querystring)
{
$fp=@fsockopen($http_host, 80, $errno, $errstr, 10); // was 5
if (!$fp) { return false; }
else
{
$header="POST ".($http_dir.$http_file)." HTTP/1.0\r\n";
$header.="Host: ".$http_host."\r\n";
$header.="Content-type: application/x-www-form-urlencoded\r\n";
$header.="User-Agent: PHPAudit v2 (http://www.phpaudit.com)\r\n";
$header.="Content-length: ".@strlen($querystring)."\r\n";
$header.="Connection: close\r\n\r\n";
$header.=$querystring;

$data=false;
if (@function_exists('stream_set_timeout')) { stream_set_timeout($fp, 20); }
@fputs($fp, $header);

if (@function_exists('socket_get_status')) { $status=@socket_get_status($fp); }
else { $status=true; }

while (!@feof($fp)&&$status)
{
$data.=@fgets($fp, 1024);

if (@function_exists('socket_get_status')) { $status=@socket_get_status($fp); }
else
{
if (@feof($fp)==true) { $status=false; }
else { $status=true; }
}
}

@fclose ($fp);

# echo "<textarea rows='100' cols='100'>".$data."</textarea>"; die;

if (!strpos($data, '200')) { return false; }

if (!$data) { return false; }

$data=@explode("\r\n\r\n", $data, 2);

if (!$data[1]) { return false; }
if (@strpos($data[1], "verify")===false) { return false; }

return $data[1];
}
}

# DOES NOT WORK FOR WINDOWS!!!!!!!
# No good way to get the mac address for win.
function phpaudit_get_mac_address()
{
$fp=@popen("/sbin/ifconfig", "r");

if (!$fp) { return -1; } # returns invalid, cannot open ifconfig

$res=@fread($fp, 4096);
@pclose($fp);

$array=@explode("HWaddr", $res);
if (@count($array)<2) { $array=@explode("ether", $res); } # FreeBSD
$array=@explode("\n", $array[1]);
$buffer[]=@trim($array[0]);

$array=@explode("inet addr:", $res);
if (@count($array)<2) { $array=@explode("inet ", $res); } # FreeBSD
$array=@explode(" ", $array[1]);
$buffer[]=@trim($array[0]);

return $buffer;
}

function path_translated()
{
if (isset($_SERVER['PATH_TRANSLATED']) && strlen($_SERVER['PATH_TRANSLATED']) > 0 && @realpath($_SERVER['PATH_TRANSLATED']))
{
$path = (substr( php_uname( ), 0, 7 ) == "Windows")? str_replace('\\\\', '/', $_SERVER['PATH_TRANSLATED']): $_SERVER['PATH_TRANSLATED'];
$path= @substr($path, 0, @strrpos($path, "/"));
}

if ($_SERVER['SCRIPT_FILENAME'])
{
return @substr($_SERVER['SCRIPT_FILENAME'], 0, @strrpos($_SERVER['SCRIPT_FILENAME'], "/"));
}

return @substr($_SERVER['ORIG_PATH_TRANSLATED'], 0, @strrpos($_SERVER['ORIG_PATH_TRANSLATED'], "\\"));
}

function server_addr()
{
return ($_SERVER['SERVER_ADDR'])?$_SERVER['SERVER_ADDR']:$_SERVER['LOCAL_ADDR'];
}

# END functions ———————————————————————

if ($per_server)
{
$server_array=phpaudit_get_mac_address();
$query_string.="&access_host=".@gethostbyaddr(@gethostbyname($server_array[1]));
$query_string.="&access_mac=".$server_array[0];
}
else if ($per_install)
{
$query_string.="&access_directory=".path_translated();
$query_string.="&access_ip=".server_addr();
$query_string.="&access_host=".$_SERVER['HTTP_HOST'];
}
else if ($per_site)
{
$query_string.="&access_ip=".server_addr();
$query_string.="&access_host=".$_SERVER['HTTP_HOST'];
}

// added v2.0.10
$query_string.='&access_token=';
$query_string.=$token=make_token();
// END added v2.0.10

foreach($servers as $server)
{
$sinfo=@parse_url($server);

$data=phpaudit_exec_socket($sinfo['host'], $sinfo['path'], '/validate_internal.php', $query_string);
if ($data) { break; }
}

// $data=false; // Uncomment this to test the local keys
$skip_dns_spoof=false;
if (!$data)
{
$array['per_server']=$per_server;
$array['per_install']=$per_install;
$array['per_site']=$per_site;
$data=validate_local_key($array);
$skip_dns_spoof=true;
}

$parser=@xml_parser_create('');
@xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
@xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
@xml_parse_into_struct($parser, $data, $values, $tags);
@xml_parser_free($parser);

$returned=$values[0]['attributes'];

if (empty($returned)) { $returned['status']="invalid"; }
if ($returned['status']!="active") { $sinfo=@parse_url($servers[0]); }

if ($returned['status']=="invalid")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_invalid.php");
exit;
}

if ($returned['status']=="suspended")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_suspended.php");
exit;
}

if ($returned['status']=="expired")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_expired.php");
exit;
}

if ($returned['status']=="pending")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_pending.php");
exit;
}

if ($returned['status']=="invalid_key")
{
?>

<SCRIPT LANGUAGE="JavaScript">
<!– Begin
alert('Your local license key is missing or invalid. We will now try to redirect you to create a new key. If this operation fails or you feel it is in error please contact our support department.');

window.location="<?PHP

echo "http://";
echo $sinfo['host'];
echo $sinfo['path'];
echo "license_key_invalid.php?access=".urlencode(base64_encode($query_string));

?>";

// End –>
</script>

<?PHP
exit;
}

// added v2.0.10
if ($returned['status']=='active'
&&strcmp(md5('592256c680f494f1f1eec5670c9e9bb0'.$token), $returned['access_token'])!=0
&&$enable_dns_spoof=='yes'
&&!$skip_dns_spoof)
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_invalid.php");
exit;
}
// END added v2.0.10

unset($query_string);
unset($per_server);
unset($per_install);
unset($per_site);
unset($server);
unset($data);
unset($parser);
unset($values);
unset($tags);
unset($sinfo);
unset($token); // added v2.0.10

?>[/php]

Line 385 and around:

[php]if ($returned['status']=="invalid")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_invalid.php"); {Line 385}
exit;
}

if ($returned['status']=="suspended")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_suspended.php");
exit;
}

if ($returned['status']=="expired")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_expired.php");
exit;
}

if ($returned['status']=="pending")
{
header("Location: http://".$sinfo['host'].$sinfo['path']."license_pending.php");
exit;
}

if ($returned['status']=="invalid_key")
{[/php]


Thank you :)

PS. Nulled.