Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Yuna Scatari Edition (YSE) (http://www.bvlist.com/forumdisplay.php?f=22)
-   -   syntax error from functions_announce.php (http://www.bvlist.com/showthread.php?t=3376)

radio 10th September 2009 08:53

syntax error from functions_announce.php
 
Server: Microsoft-IIS/6.0
PHP/5.2.6
Version: YSE v2.2 PRE7 by kp380lv

the installation was smooth, but utorrent got the error "tracker sending invalid data" when trying to seed a torrent.

here is the syntax error from httpanalyzer:

Code:

Parse error:  syntax error, unexpected $end in 《wwwroot》Yuna Scatari Edition PRE7 2.2\include\functions_announce.php on line 230
user-Agent: uTorrent/1840(16381)
Accept-Encoding: gzip

but line 230 is the end of functions_announce.php

btw, the server is now running tsse 5.1 without errors.

Does someone know how to fix this? thanks!

ferdis 10th September 2009 19:14

If your code looks to be ok, I have found that this is often caused by the use of Short Open tags in PHP.

The full tag is :
Quote:


but the short open tag can be used as well.
Quote:


However, you must allow short open tags in your PHP.INI file. Look for the SHORT_OPEN_TAG directive in your PHP.INI file and set it to "1"

I hope this helps.

radio 11th September 2009 10:45

thank you, but the SHORT_OPEN_TAG is "on" in my php.ini already, so i think it's something else.

now i am also trying other scripts, xbtit with xbt backend seems good, but the theme is...:sad: i like the tbdev and gazelle themes:bubble:

PHP Code:

 
<?php
# IMPORTANT: Do not edit below unless you know what you are doing!
if(!defined('IN_ANNOUNCE'))
  die(
'Hacking attempt!');
require_once(
$rootpath 'include/config_announce.php');
require_once(
$rootpath 'include/secrets.php');
  function 
checkconnect ($ip ''$port '')
  {
    return (!@
fsockopen ($ip$port$errno$errstr5) ? 'no' : (@fclose ($sockres) ? 'yes' 'yes'));
  }
function 
err($msg) {
 
benc_resp(array("failure reason" => array(type => "string"value => $msg)));
 exit();
}
function 
benc_resp($d) {
 
benc_resp_raw(benc(array(type => "dictionary"value => $d)));
}
function 
benc_resp_raw($x) {
 
header("Content-Type: text/plain");
 
header("Pragma: no-cache");
 print(
$x);
}
function 
get_date_time($timestamp 0) {
 if (
$timestamp)
  return 
date("Y-m-d H:i:s"$timestamp);
 else
  return 
date("Y-m-d H:i:s");
}
function 
gmtime() {
    return 
TIMENOW;
}
function 
strip_magic_quotes($arr) {
 foreach (
$arr as $k => $v)
 {
  if (
is_array($v))
   { 
$arr[$k] = strip_magic_quotes($v); }
  else
   { 
$arr[$k] = stripslashes($v); }
 }
 return 
$arr;
}
function 
mksize($bytes) {
 if (
$bytes 1000 1024)
  return 
number_format($bytes 10242) . " kB";
 elseif (
$bytes 1000 1048576)
  return 
number_format($bytes 10485762) . " MB";
 elseif (
$bytes 1000 1073741824)
  return 
number_format($bytes 10737418242) . " GB";
 else
  return 
number_format($bytes 10995116277762) . " TB";
}
function 
emu_getallheaders() {
   foreach(
$_SERVER as $name => $value)
    if(
substr($name05) == 'HTTP_')
     
$headers[str_replace(' ''-'ucwords(strtolower(str_replace('_'' 'substr($name5)))))] = $value;
   return 
$headers;
}
function 
clientbancheck($client='',$agent='',$uagent='')
{
 global 
$SITENAME$bannedclientdetect$self$event;
 if (
$bannedclientdetect == 'yes') {
  
$array = Array('BS''\0\2BS''\0\3BS''exbc\0L''exbcL''exbcLORD''-TS''Mbrst''-BB''-SZ''XBT''turbo''A301''A310''-UT11''-UT12''-UT13''-UT14''-UT15''FUTB''exbc\08''exbc\09''exbc\0:''-BC0059-''-BC0060-''-BC0061-''-BC0062-''-BC0063-''-BC0064-''-BC0065-''-BC0066-''-BC0067-''-BC0068-''-BC0069-''-BC0070-''-BC0071-''-BC0072-''-BC0073-''-BC0074-''-BC0075-''-BC0076-''-BC0077-''-BC0078-''-BC0079-''-BC0080-''-BC0081-''M4''AZ2500BT',);
  
  foreach(
$array as $bannedclient){
   if(
$bannedclient == substr($client,0,strlen($bannedclient)))
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  }
  
  if (
ereg('^Mozilla\\/'$agent) || ereg('^Opera\\/'$agent) || ereg('^Links '$agent) || ereg('^Lynx\\/'$agent))
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif(
ereg('^BitTorrent\\/S-'$agent))
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif(
ereg('^ABC\\/ABC'$agent))
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif(
ereg('^Python-urllib\\/2.4'$agent))
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif((
$agent == "uTorrent/1300") || ($agent == "ABC 3.01/ABC-3.0.1") || (substr($agent,0,15) == "Azureus 2.3.0.6")  )
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif (
"text/html, */*" == $_SERVER["HTTP_ACCEPT"] || "Close" == $_SERVER["HTTP_CONNECTION"] && "gzip, deflate" != $_SERVER["HTTP_ACCEPT_ENCODING"])
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  elseif (
$_SERVER['HTTP_ACCEPT'] == 'text/html, */*' && $_SERVER['HTTP_ACCEPT_ENCODING'] == 'identity')
   
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  if (!isset(
$self))
  {
   if (
$agent == "BitTorrent/ABC-2.6.9" && $_SERVER["SERVER_PROTOCOL"] == "HTTP/1.1")
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
   elseif (
$agent == "uTorrent/1300" && $_GET["event"] == "started" && $_GET["uploaded"] == 30)
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
   elseif ((
$agent == "uTorrent/1400" || $agent == "uTorrent/1300") && strtoupper($_GET["key"]) != $_GET["key"])
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
   elseif (
$_GET["event"] == "stopped" && $_GET["compact"] == && preg_match("/^Azureus 2\.2\.0\.[0-2].*/"$agent))
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
   elseif (
preg_match("/ABC-/"$agent) && $event == "started")
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  }
  
$bua mysql_query('SELECT agent FROM banned_agent') or err('Tracker error (1)');
  while (
$nea mysql_fetch_array($bua)){
   
$n $nea['agent'];
   
$nr preg_replace('/\//''\/'$n);
   
$neadle '/\b'.$nr.'\b/i';
   if (
preg_match($neadle$uagent))
    
err($SITENAME.' has banned this client. Please use 礣orrent or Azerus.');
  }
 }
}

function 
portblacklisted($port) {
 if (
$port >= 411 && $port <= 413)
  return 
true;
 if (
$port >= 6881 && $port <= 6889)
  return 
true;
 if (
$port == 1214)
  return 
true;
 if (
$port >= 6346 && $port <= 6347)
  return 
true;
 if (
$port == 4662)
  return 
true;
 if (
$port == 6699)
  return 
true;
 return 
false;
}
function 
validip($ip) {
 if (!empty(
$ip) && $ip == long2ip(ip2long($ip)))
 {
    
$reserved_ips = array (
    array(
'0.0.0.0','2.255.255.255'),
    array(
'10.0.0.0','10.255.255.255'),
    array(
'127.0.0.0','127.255.255.255'),
    array(
'169.254.0.0','169.254.255.255'),
    array(
'172.16.0.0','172.31.255.255'),
    array(
'192.0.2.0','192.0.2.255'),
    array(
'192.168.0.0','192.168.255.255'),
    array(
'255.255.255.0','255.255.255.255')
  );
  foreach (
$reserved_ips as $r)
  {
    
$min ip2long($r[0]);
    
$max ip2long($r[1]);
    if ((
ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
  }
  return 
true;
 }
 else return 
false;
}
function 
getip() {
   if (isset(
$_SERVER)) {
     if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) {
       
$ip $_SERVER['HTTP_X_FORWARDED_FOR'];
     } elseif (isset(
$_SERVER['HTTP_CLIENT_IP']) && validip($_SERVER['HTTP_CLIENT_IP'])) {
       
$ip $_SERVER['HTTP_CLIENT_IP'];
     } else {
       
$ip $_SERVER['REMOTE_ADDR'];
     }
   } else {
     if (
getenv('HTTP_X_FORWARDED_FOR') && validip(getenv('HTTP_X_FORWARDED_FOR'))) {
       
$ip getenv('HTTP_X_FORWARDED_FOR');
     } elseif (
getenv('HTTP_CLIENT_IP') && validip(getenv('HTTP_CLIENT_IP'))) {
       
$ip getenv('HTTP_CLIENT_IP');
     } else {
       
$ip getenv('REMOTE_ADDR');
     }
   }
   return 
$ip;
 }
function 
dbconn() {
 global 
$mysql_host$mysql_user$mysql_pass$mysql_db$mysql_charset;
 if (!@
mysql_connect($mysql_host$mysql_user$mysql_pass))
    {
  
err('dbconn: mysql_connect: ' mysql_error());
    }
    
mysql_select_db($mysql_db) or err('dbconn: mysql_select_db: ' mysql_error());
 
mysql_query('SET NAMES '.$mysql_charset);

function 
sqlesc($value) {
    
// Stripslashes
   /*if (get_magic_quotes_gpc()) {
       $value = stripslashes($value);
   }*/
   // Quote if not a number or a numeric string
   
if (!is_numeric($value)) {
       
$value "'" mysql_real_escape_string($value) . "'";
   }
   return 
$value;
}
function 
hash_pad($hash) {
    return 
str_pad($hash20);
}
function 
hash_where($name$hash) {
    
$shhash preg_replace('/ *$/s'""$hash);
    return 
"($name = " sqlesc($hash) . " OR $name = " sqlesc($shhash) . ")";
}
function 
unesc($x) {
 if (
get_magic_quotes_gpc())
  return 
stripslashes($x);
 return 
$x;
}
function 
gzip() {
 if (@
extension_loaded('zlib') && @ini_get('zlib.output_compression') != '1' && @ini_get('output_handler') != 'ob_gzhandler') {
  @
ob_start('ob_gzhandler');
 }
}
?>



All times are GMT +2. The time now is 03:08.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.