|
![]() |
#1
|
|||
|
|||
![]()
I have download the latest version of svn tt 2.81, but now I have this concern: Fatal error: Call to undefined function gmp_strval () in C: \ xampp \ htdocs \ backend \ functions.php on line 1371
help me please ![]() Last edited by tristan57; 21st November 2012 at 17:04. |
#2
|
||||
|
||||
![]()
__________________
"FFS PPL READ GOD DAMMIT, WHAT AM I GOOGLE?" "I Kill You!" simples
|
#3
|
|||
|
|||
![]()
yes this is the version 2.08 I, I'm wrong
|
#4
|
|||
|
|||
![]()
Please
![]() config mi edit and You didn't edit your config correctly. ![]() |
#5
|
|||
|
|||
![]()
TT 2.81
windows 7 Xampp Version: 1.8.1 |
The Following User Says Thank You to tristan57 For This Useful Post: | ||
z3ro (21st November 2012)
|
#6
|
|||
|
|||
![]()
My windows 8
|
#7
|
|||
|
|||
![]()
function.php
Code:
<?php /** * @file * @author TorrentTrader <http://www.TorrentTrader.org> * * Main functions file. * @section Modified * - $LastChangedDate$ * - $LastChangedBy$ */ error_reporting(E_ALL ^ E_NOTICE); // Prefer unescaped. Data will be escaped as needed. if (ini_get("magic_quotes_gpc")) { $_POST = array_map_recursive("unesc", $_POST); $_GET = array_map_recursive("unesc", $_GET); $_REQUEST = array_map_recursive("unesc", $_REQUEST); $_COOKIE = array_map_recursive("unesc", $_COOKIE); } if (function_exists("date_default_timezone_set")) date_default_timezone_set("Europe/London"); // Do NOT change this. All times are converted to user's chosen timezone. define("BASEPATH", str_replace("backend", "", dirname(__FILE__))); $BASEPATH = BASEPATH; define("BACKEND", dirname(__FILE__)); $BACKEND = BACKEND; require_once(BACKEND."/mysql.php"); //Get MYSQL Connection Info require_once(BACKEND."/config.php"); //Get Site Settings and Vars ($site_config) require(BACKEND."/tzs.php"); // Get Timezones require_once(BACKEND."/cache.php"); // Caching require_once(BACKEND."/mail.php"); // Mail functions require_once(BACKEND."/mysql.class.php"); require_once(BACKEND."/languages.php"); $GLOBALS['tstart'] = array_sum(explode(" ", microtime())); /** * Connect to the database and load user details * * @param $autoclean * (optional) boolean - Check whether or not to run cleanup (default: false) */ function dbconn($autoclean = false) { global $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $THEME, $LANGUAGE, $LANG, $site_config; $THEME = $LANGUAGE = null; if (!ob_get_level()) { if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) ob_start('ob_gzhandler'); else ob_start(); } header("Content-Type: text/html;charset=$site_config[CHARSET]"); function_exists("mysql_connect") or die("MySQL support not available."); @mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('DATABASE: mysql_connect: ' . mysql_error()); @mysql_select_db($mysql_db) or die('DATABASE: mysql_select_db: ' . mysql_error()); unset($mysql_pass); //security userlogin(); //Get user info //Get language and theme $CURUSER = $GLOBALS["CURUSER"]; $ss_a = mysql_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" . ( $CURUSER ? $CURUSER['stylesheet'] : $site_config['default_theme'] ) . "'")); $THEME = $ss_a["uri"]; $lng_a = mysql_fetch_assoc(SQL_Query_exec("select uri from languages where id='" . ( $CURUSER ? $CURUSER['language'] : $site_config['default_language'] ) . "'")); $LANGUAGE = $lng_a["uri"]; require_once("languages/$LANGUAGE"); if ($autoclean) autoclean(); } // Main Cleanup function autoclean() { global $site_config; require_once("cleanup.php"); $now = gmtime(); $res = SQL_Query_exec("SELECT last_time FROM tasks WHERE task='cleanup'"); $row = mysql_fetch_row($res); if (!$row) { SQL_Query_exec("INSERT INTO tasks (task, last_time) VALUES ('cleanup',$now)"); return; } $ts = $row[0]; if ($ts + $site_config["autoclean_interval"] > $now) return; SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts"); if (!mysql_affected_rows()) return; do_cleanup(); } // IP Validation function validip($ip) { if (extension_loaded("filter")) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE); } if (preg_match('![:a-f0-9]!i', $ip)) return true; 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; } return false; } function getip() { return $_SERVER["REMOTE_ADDR"]; } function userlogin() { $ip = getip(); // If there's no IP a script is being ran from CLI. Any checks here will fail, skip all. if ($ip == "") return; GLOBAL $CURUSER; unset($GLOBALS["CURUSER"]); //Check IP bans if (is_ipv6($ip)) $nip = ip2long6($ip); else $nip = ip2long($ip); $res = SQL_Query_exec("SELECT * FROM bans"); while ($row = mysql_fetch_assoc($res)) { $banned = false; if (is_ipv6($row["first"]) && is_ipv6($row["last"]) && is_ipv6($ip)) { $row["first"] = ip2long6($row["first"]); $row["last"] = ip2long6($row["last"]); $banned = bccomp($row["first"], $nip) != -1 && bccomp($row["last"], $nip) != -1; } else { $row["first"] = ip2long($row["first"]); $row["last"] = ip2long($row["last"]); $banned = $nip >= $row["first"] && $nip <= $row["last"]; } if ($banned) { header("HTTP/1.0 403 Forbidden"); echo "<html><head><title>Forbidden</title></head><body><h1>Forbidden</h1>Unauthorized IP address.<br />". "Reason for banning: $row[comment]</body></html>"; die; } } //Check The Cookie and get CURUSER details if (strlen($_COOKIE["pass"]) != 40 || !is_numeric($_COOKIE["uid"])) { logoutcookie(); return; } //Get User Details And Permissions $res = SQL_Query_exec("SELECT * FROM users INNER JOIN groups ON users.class=groups.group_id WHERE id=$_COOKIE[uid] AND users.enabled='yes' AND users.status = 'confirmed'"); $row = mysql_fetch_assoc($res); if (!$row || sha1($row["id"].$row["secret"].$row["password"].$ip.$row["secret"]) != $_COOKIE["pass"]) { logoutcookie(); return; } $where = where ($_SERVER["SCRIPT_FILENAME"], $row["id"], 0); SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip).", page=".sqlesc($where)." WHERE id=" . $row["id"]); $GLOBALS["CURUSER"] = $row; unset($row); } function logincookie($id, $password, $secret, $updatedb = 1, $expires = 0x7fffffff) { $hash = sha1($id.$secret.$password.getip().$secret); setcookie("pass", $hash, $expires, "/"); setcookie("uid", $id, $expires, "/"); if ($updatedb) SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()."' WHERE id = $id"); } function logoutcookie() { setcookie("pass", null, time(), "/"); setcookie("uid", null, time(), "/"); } function stdhead($title = "") { global $site_config, $CURUSER, $THEME, $LANGUAGE; //Define globals //site online check if (!$site_config["SITE_ONLINE"]){ if ($CURUSER["control_panel"] != "yes") { echo '<br /><br /><br /><center>'. stripslashes($site_config["OFFLINEMSG"]) .'</center><br /><br />'; die; }else{ echo '<br /><br /><br /><center><b><font color="#ff0000">SITE OFFLINE, STAFF ONLY VIEWING! DO NOT LOGOUT</font></b><br />If you logout please edit backend/config.php and set SITE_ONLINE to true </center><br /><br />'; } } //end check if (!$CURUSER) guestadd(); if ($title == "") $title = $site_config['SITENAME']; else $title = $site_config['SITENAME']. " : ". htmlspecialchars($title); require_once("themes/" . $THEME . "/block.php"); require_once("themes/" . $THEME . "/header.php"); } function stdfoot() { global $site_config, $CURUSER, $THEME, $LANGUAGE; require_once("themes/" . $THEME . "/footer.php"); mysql_close(); } function leftblocks() { global $site_config, $CURUSER, $THEME, $LANGUAGE, $TTCache, $blockfilename; //Define globals if (($blocks=$TTCache->get("blocks_left", 900)) === false) { $res = SQL_Query_exec("SELECT * FROM blocks WHERE position='left' AND enabled=1 ORDER BY sort"); $blocks = array(); while ($result = mysql_fetch_assoc($res)) { $blocks[] = $result["name"]; } $TTCache->Set("blocks_left", $blocks, 900); } foreach ($blocks as $blockfilename){ include("blocks/".$blockfilename."_block.php"); } } function rightblocks() { global $site_config, $CURUSER, $THEME, $LANGUAGE, $TTCache, $blockfilename; //Define globals if (($blocks=$TTCache->get("blocks_right", 900)) === false) { $res = SQL_Query_exec("SELECT * FROM blocks WHERE position='right' AND enabled=1 ORDER BY sort"); $blocks = array(); while ($result = mysql_fetch_assoc($res)) { $blocks[] = $result["name"]; } $TTCache->Set("blocks_right", $blocks, 900); } foreach ($blocks as $blockfilename){ include("blocks/".$blockfilename."_block.php"); } } function middleblocks() { global $site_config, $CURUSER, $THEME, $LANGUAGE, $TTCache; //Define globals if (($blocks=$TTCache->get("blocks_middle", 900)) === false) { $res = SQL_Query_exec("SELECT * FROM blocks WHERE position='middle' AND enabled=1 ORDER BY sort"); $blocks = array(); while ($result = mysql_fetch_assoc($res)) { $blocks[] = $result["name"]; } $TTCache->Set("blocks_middle", $blocks, 900); } foreach ($blocks as $blockfilename){ include("blocks/".$blockfilename."_block.php"); } } function show_error_msg($title, $message, $wrapper = "1") { if ($wrapper) { ob_start(); ob_clean(); stdhead($title); } begin_frame("<font class='error'>". htmlspecialchars($title) ."</font>"); print("<center><b>" . $message . "</b></center>\n"); end_frame(); if ($wrapper){ stdfoot(); die(); } } function health($leechers, $seeders) { if (($leechers == 0 && $seeders == 0) || ($leechers > 0 && $seeders == 0)) return 0; elseif ($seeders > $leechers) return 10; $ratio = $seeders / $leechers * 100; if ($ratio > 0 && $ratio < 15) return 1; elseif ($ratio >= 15 && $ratio < 25) return 2; elseif ($ratio >= 25 && $ratio < 35) return 3; elseif ($ratio >= 35 && $ratio < 45) return 4; elseif ($ratio >= 45 && $ratio < 55) return 5; elseif ($ratio >= 55 && $ratio < 65) return 6; elseif ($ratio >= 65 && $ratio < 75) return 7; elseif ($ratio >= 75 && $ratio < 85) return 8; elseif ($ratio >= 85 && $ratio < 95) return 9; else return 10; } // MySQL escaping function sqlesc($x) { if (!is_numeric($x)) { $x = "'".mysql_real_escape_string($x)."'"; } return $x; } function unesc($x) { if (get_magic_quotes_gpc()) return stripslashes($x); return $x; } /** * Convert bytes to readable format * * @param $s * integer: bytes * @param $precision * (optional) integer: decimal precision (default: 2) * @return * string: formatted size */ function mksize ($s, $precision = 2) { $suf = array("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"); for ($i = 1, $x = 0; $i <= count($suf); $i++, $x++) { if ($s < pow(1024, $i) || $i == count($suf)) // Change 1024 to 1000 if you want 0.98GB instead of 1,0000MB return number_format($s/pow(1024, $x), $precision)." ".$suf[$x]; } } function escape_url($url) { $ret = ''; for($i = 0; $i < strlen($url); $i+=2) $ret .= '%'.$url[$i].$url[$i + 1]; return $ret; } /** * Scrape torrent and return stats * * @param $scrape * string: Scrape URL * @param $hash * string: SHA1 hash (info_hash) of torrent * @return * array: * All -1 if failed * - seeds: integer - number of seeders * - leechers: integer - number of leechers * - downloaded: integer - number of complete downloads * */ function torrent_scrape_url($scrape, $hash) { if (function_exists("curl_exec")) { $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $scrape.'?info_hash='.escape_url($hash)); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_HEADER, false); $fp = curl_exec($ch); curl_close($ch); } else { ini_set('default_socket_timeout',10); $fp = @file_get_contents($scrape.'?info_hash='.escape_url($hash)); } $ret = array(); if ($fp) { $stats = BDecode($fp); $binhash = pack("H*", $hash); $binhash = addslashes($binhash); $seeds = $stats['files'][$binhash]['complete']; $peers = $stats['files'][$binhash]['incomplete']; $downloaded = $stats['files'][$binhash]['downloaded']; $ret['seeds'] = $seeds; $ret['peers'] = $peers; $ret['downloaded'] = $downloaded; } if ($ret['seeds'] === null) { $ret['seeds'] = -1; $ret['peers'] = -1; $ret['downloaded'] = -1; } return $ret; } function mkprettytime($s) { if ($s < 0) $s = 0; $t = array(); $t["day"] = floor($s / 86400); $s -= $t["day"] * 86400; $t["hour"] = floor($s / 3600); $s -= $t["hour"] * 3600; $t["min"] = floor($s / 60); $s -= $t["min"] * 60; $t["sec"] = $s; if ($t["day"]) return $t["day"] . "d " . sprintf("%02d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]); if ($t["hour"]) return sprintf("%d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]); return sprintf("%d:%02d", $t["min"], $t["sec"]); } function gmtime() { return sql_timestamp_to_unix_timestamp(get_date_time()); } function loggedinonly() { global $CURUSER; if (!$CURUSER) { header("Refresh: 0; url=account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"])); exit(); } } function validfilename($name) { return preg_match('/^[^\0-\x1f:\\\\\/?*\xff#<>|]+$/si', $name); } function validemail($email) { if (function_exists("filter_var")) return filter_var($email, FILTER_VALIDATE_EMAIL); return preg_match('/^([a-z0-9._-](\+[a-z0-9])*)+@[a-z0-9.-]+\.[a-z]{2,6}$/i', $email); } function mksecret($len = 20) { $chars = array_merge(range(0, 9), range("A", "Z"), range("a", "z")); shuffle($chars); $x = count($chars) - 1; for ($i = 1; $i <= $len; $i++) $str .= $chars[mt_rand(0, $x)]; return $str; } function deletetorrent($id) { global $site_config; $row = @mysql_fetch_assoc(@SQL_Query_exec("SELECT image1,image2 FROM torrents WHERE id=$id")); foreach(explode(".","peers.comments.ratings.files.announce") as $x) SQL_Query_exec("DELETE FROM $x WHERE torrent = $id"); SQL_Query_exec("DELETE FROM completed WHERE torrentid = $id"); if (file_exists($site_config["torrent_dir"] . "/$id.torrent")) unlink($site_config["torrent_dir"] . "/$id.torrent"); if ($row["image1"]) { unlink($site_config['torrent_dir'] . "/images/" . $row["image1"]); } if ($row["image2"]) { unlink($site_config['torrent_dir'] . "/images/" . $row["image2"]); } @unlink($site_config["nfo_dir"]."/$id.nfo"); SQL_Query_exec("DELETE FROM torrents WHERE id = $id"); SQL_Query_exec("DELETE FROM reports WHERE votedfor = $id AND type = 'torrent'"); } function deleteaccount($userid) { SQL_Query_exec("DELETE FROM users WHERE id = $userid"); SQL_Query_exec("DELETE FROM warnings WHERE userid = $userid"); SQL_Query_exec("DELETE FROM ratings WHERE user = $userid"); SQL_Query_exec("DELETE FROM peers WHERE userid = $userid"); SQL_Query_exec("DELETE FROM completed WHERE userid = $userid"); SQL_Query_exec("DELETE FROM reports WHERE addedby = $userid"); SQL_Query_exec("DELETE FROM reports WHERE votedfor = $userid AND type = 'user'"); SQL_Query_exec("DELETE FROM forum_readposts WHERE userid = $userid"); SQL_Query_exec("DELETE FROM pollanswers WHERE userid = $userid"); } function genrelist() { $ret = array(); $res = SQL_Query_exec("SELECT id, name, parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC"); while ($row = mysql_fetch_assoc($res)) $ret[] = $row; return $ret; } function langlist() { $ret = array(); $res = SQL_Query_exec("SELECT id, name, image FROM torrentlang ORDER BY sort_index, id"); while ($row = mysql_fetch_assoc($res)) $ret[] = $row; return $ret; } function is_valid_id($id){ return is_numeric($id) && ($id > 0) && (floor($id) == $id); } function is_valid_int($id){ return is_numeric($id) && (floor($id) == $id); } function sql_timestamp_to_unix_timestamp($s){ return mktime(substr($s, 11, 2), substr($s, 14, 2), substr($s, 17, 2), substr($s, 5, 2), substr($s, 8, 2), substr($s, 0, 4)); } function write_log($text){ $text = sqlesc($text); $added = sqlesc(get_date_time()); SQL_Query_exec("INSERT INTO log (added, txt) VALUES($added, $text)"); } function get_elapsed_time($ts){ $mins = floor((gmtime() - $ts) / 60); $hours = floor($mins / 60); $mins -= $hours * 60; $days = floor($hours / 24); $hours -= $days * 24; $weeks = floor($days / 7); $days -= $weeks * 7; $t = ""; if ($weeks > 0) return "$weeks wk" . ($weeks > 1 ? "s" : ""); if ($days > 0) return "$days day" . ($days > 1 ? "s" : ""); if ($hours > 0) return "$hours hr" . ($hours > 1 ? "s" : ""); if ($mins > 0) return "$mins min" . ($mins > 1 ? "s" : ""); return "< 1 min"; } function guestadd() { $ip = $_SERVER['REMOTE_ADDR']; $time = gmtime(); SQL_Query_exec("INSERT INTO `guests` (`ip`, `time`) VALUES ('$ip', '$time') ON DUPLICATE KEY UPDATE `time` = '$time'"); } function getguests() { $past = (gmtime() - 2400); SQL_Query_exec("DELETE FROM `guests` WHERE `time` < $past"); return get_row_count("guests"); } function time_ago($addtime) { $addtime = get_elapsed_time(sql_timestamp_to_unix_timestamp($addtime)); return $addtime; } function CutName ($vTxt, $Car) { if (strlen($vTxt) > $Car) { return substr($vTxt, 0, $Car) . "..."; } return $vTxt; } function searchfield($s) { return preg_replace(array('/[^a-z0-9]/si', '/^\s*/s', '/\s*$/s', '/\s+/s'), array(" ", "", "", " "), $s); } function get_row_count($table, $suffix = "") { $res = SQL_Query_exec("SELECT COUNT(*) FROM $table $suffix"); $row = mysql_fetch_row($res); return $row[0]; } function get_date_time($timestamp = 0){ if ($timestamp) return date("Y-m-d H:i:s", $timestamp); else return gmdate("Y-m-d H:i:s"); } // Convert UTC to user's timezone function utc_to_tz ($timestamp=0) { GLOBAL $CURUSER, $tzs; if (method_exists("DateTime", "setTimezone")) { if (!$timestamp) $timestamp = get_date_time(); $date = new DateTime($timestamp, new DateTimeZone("UTC")); $date->setTimezone(new DateTimeZone($CURUSER ? $tzs[$CURUSER["tzoffset"]][1] : "Europe/London")); return $date->format('Y-m-d H:i:s'); } if (!is_numeric($timestamp)) $timestamp = sql_timestamp_to_unix_timestamp($timestamp); if ($timestamp == 0) $timestamp = gmtime(); $timestamp = $timestamp + ($CURUSER['tzoffset']*60); if (date("I")) $timestamp += 3600; // DST Fix return date("Y-m-d H:i:s", $timestamp); } function utc_to_tz_time ($timestamp=0) { GLOBAL $CURUSER, $tzs; if (method_exists("DateTime", "setTimezone")) { if (!$timestamp) $timestamp = get_date_time(); $date = new DateTime($timestamp, new DateTimeZone("UTC")); $date->setTimezone(new DateTimeZone($CURUSER ? $tzs[$CURUSER["tzoffset"]][1] : "Europe/London")); return sql_timestamp_to_unix_timestamp($date->format('Y-m-d H:i:s')); } if (!is_numeric($timestamp)) $timestamp = sql_timestamp_to_unix_timestamp($timestamp); if ($timestamp == 0) $timestamp = gmtime(); $timestamp = $timestamp + ($CURUSER['tzoffset']*60); if (date("I")) $timestamp += 3600; // DST Fix return $timestamp; } function encodehtml($s, $linebreaks = true) { $s = str_replace("<", "<", str_replace("&", "&", $s)); if ($linebreaks) $s = nl2br($s); return $s; } function format_urls($s){ return preg_replace( "/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^<>\s]+)/i", "\\1<a href='http://kpaste.net/redir/\\2' target='_blank'>\\2</a>", $s); } function format_comment($text) { global $site_config, $smilies; $s = $text; $s = htmlspecialchars($s); $s = format_urls($s); //[*] $s = preg_replace("/\[\*\]/", "<li>", $s); // Bold $s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s); // Italic $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s); // Underline $s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s); // Underline $s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/i", "<u>\\1</u>", $s); // |
The Following User Says Thank You to tristan57 For This Useful Post: | ||
z3ro (21st November 2012)
|
#8
|
|||
|
|||
![]()
not good
C:\xampp\htdocs\backend\functions.php on line 742 |
#9
|
|||
|
|||
![]()
resolved :
Under Windows you will need to uncomment the line ;extension=php_gmp.dll within the php.ini and restart Apache. |
The Following User Says Thank You to tristan57 For This Useful Post: | ||
z3ro (21st November 2012)
|
#10
|
|||
|
|||
![]()
Unexpected character in input: '\' (ASCII=92) state=1 in C:\xampp\htdocs\backend\functions.php on line 742
![]() Not understand |
![]() |
Tags |
207 , helperror , install , tt |
|
|