Ребят я недавна начал изучать php кто может икаму не лень перевести вот этат код на php 7 Код (Text): if(!defined('MOZG')) die('Hacking attempt!'); class db{ var $db_id = false; var $query_num = 0; var $query_list = array(); var $mysql_error = ''; var $mysql_version = ''; var $mysql_error_num = 0; var $mysql_extend = "MySQLi"; var $MySQL_time_taken = 0; var $query_id = false; function connect($db_user, $db_pass, $db_name, $db_location = 'localhost', $show_error=1){ $db_location = explode(":", $db_location); if (isset($db_location[1])) { $this->db_id = @mysqli_connect($db_location[0], $db_user, $db_pass, $db_name, $db_location[1]); } else { $this->db_id = @mysqli_connect($db_location[0], $db_user, $db_pass, $db_name); } if(!$this->db_id) { if($show_error == 1) { $this->display_error(mysqli_connect_error(), '1'); } else { return false; } } $this->mysql_version = mysqli_get_server_info($this->db_id); if(!defined('COLLATE')) { define ("COLLATE", "cp1251"); } mysqli_query($this->db_id, "SET NAMES '" . COLLATE . "'"); return true; } function query($query, $show_error=true){ $time_before = $this->get_real_time(); if(!$this->db_id) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST); if(!($this->query_id = mysqli_query($this->db_id, $query) )) { $this->mysql_error = mysqli_error($this->db_id); $this->mysql_error_num = mysqli_errno($this->db_id); if($show_error) { $this->display_error($this->mysql_error, $this->mysql_error_num, $query); } } $this->MySQL_time_taken += $this->get_real_time() - $time_before; $this->query_num ++; return $this->query_id; } function get_row($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_fetch_assoc($query_id); } function get_array($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_fetch_array($query_id); } function super_query($query, $multi = false, $cache_prefix = false, $system_cache = false){ //Если включен кеш, то проверяем на его существование if($cache_prefix){ if($system_cache) $data = system_cache($cache_prefix); else $data = mozg_cache($cache_prefix); } //Если есть ответ с кеша if($data){ $unSerData = unserialize($data); if($unSerData) return $unSerData; else return array(); } else { if(!$multi) { $this->query($query); $data = $this->get_row(); $this->free(); //Если включен кеш, то создаём его if($cache_prefix){ $cache_rows = serialize($data); mozg_create_cache($cache_prefix, $cache_rows); } return $data; } else { $this->query($query); $rows = array(); while($row = $this->get_row()) { $rows[] = $row; } $this->free(); //Если включен кеш, то создаём его if($cache_prefix){ $cache_rows = serialize($rows); if($system_cache) creat_system_cache($cache_prefix, $cache_rows); else mozg_create_cache($cache_prefix, $cache_rows); } return $rows; } } } function num_rows($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_num_rows($query_id); } function insert_id(){ return mysqli_insert_id($this->db_id); } function get_result_fields($query_id = '') { if ($query_id == '') $query_id = $this->query_id; while ($field = mysqli_fetch_field($query_id)) { $fields[] = $field; } return $fields; } function safesql( $source ){ if ($this->db_id) return mysqli_real_escape_string ($this->db_id, $source); else return mysql_escape_string($source); } function free( $query_id = '' ){ if ($query_id == '') $query_id = $this->query_id; @mysqli_free_result($query_id); } function close(){ @mysqli_close($this->db_id); } function get_real_time(){ list($seconds, $microSeconds) = explode(' ', microtime()); return ((float)$seconds + (float)$microSeconds); } function display_error($error, $error_num, $query = ''){ if($query) { // Safify query $query = preg_replace("/([0-9a-f]){32}/", "********************************", $query); // Hides all hashes $query_str = "$query"; } echo $error; echo '<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Ошибка</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> </head> <body> <font size="4">Ошибка сервера, попробуйте обновить страницу позже.</font> </body> </html>'; exit(); } }
ошибка заключаеца вот вэтам коде PHP: function safesql( $source ){ global $db_config; if(!$this->db_id) $this->connect($db_config['user'], $db_config['password'], $db_config['name'], $db_config['host']); return mysqli_real_escape_string($this->db_id, $source); } вот вэтой строке return mysqli_real_escape_string($this->db_id, $source);
@kinlok в приведенным вами коде, эта функция выглядит иначе ошибка в жирной строке. Дело в том, что в PHP7 больше нет функций mysql_. А вот здесь: как раз ошибок нет.
Notice: Undefined index: act in W:\domains\testfd.ru\system\init.php on line 75 Notice: Undefined index: lang in W:\domains\testfd.ru\system\init.php on line 99 Notice: Undefined index: act in W:\domains\testfd.ru\system\modules\functions.php on line 1166 Notice: Undefined index: act in W:\domains\testfd.ru\system\modules\functions.php on line 1167 Notice: Undefined index: mobile_enable in W:\domains\testfd.ru\system\modules\functions.php on line 274 Notice: Undefined index: mobile in W:\domains\testfd.ru\system\modules\functions.php on line 1184 Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in W:\domains\testfd.ru\system\classes\mysql.php:198 Stack trace: #0 W:\domains\testfd.ru\system\modules\login.php(7): db->safesql('127.0.0.1') #1 W:\domains\testfd.ru\system\init.php(135): include('W:\\domains\\test...') #2 W:\domains\testfd.ru\index.php(25): include('W:\\domains\\test...') #3 {main} thrown in W:\domains\testfd.ru\system\classes\mysql.php on line 198
памаги вот сетой ошибкай <br%20/><b>Deprecated</b>:%20%20Methods%20with%20the%20same%20name%20as%20their%20class%20will%20not%20be%20constructors%20in%20a%20future%20version%20of%20PHP;%20thumbnail%20has%20a%20deprecated%20constructor%20in%20<b>W:/domains/testfd.ru/system/classes/images.php</b>%20on%20line%20<b>17</b><br%20/>8 Код (Text): class thumbnail { var $img; var $watermark_image_light; var $watermark_image_dark; function thumbnail($imgfile) { //detect image format $info = @getimagesize($imgfile); if( $info[2] == 2 ) { $this->img['format'] = "JPEG"; $this->img['src'] = @imagecreatefromjpeg( $imgfile ); } elseif( $info[2] == 3 ) { $this->img['format'] = "PNG"; $this->img['src'] = @imagecreatefrompng( $imgfile ); } elseif( $info[2] == 1 ) { $this->img['format'] = "GIF"; $this->img['src'] = @imagecreatefromgif( $imgfile ); } else { echo "Not Supported File! Thumbnails can only be made from .jpg, gif and .png images!"; @unlink( $imgfile ); exit(); } if( !$this->img['src'] ) { echo "Not Supported File! Thumbnails can only be made from .jpg, gif and .png images!"; @unlink( $imgfile ); exit(); } $this->img['lebar'] = @imagesx( $this->img['src'] ); $this->img['tinggi'] = @imagesy( $this->img['src'] ); $this->img['lebar_thumb'] = $this->img['lebar']; $this->img['tinggi_thumb'] = $this->img['tinggi']; //default quality jpeg $this->img['quality'] = 90; } function size_auto($size = 100, $site = 0, $jqCrop = 0) { $size = explode ("x", $size); if($jqCrop){ return $this->jqCrop( intval($size[0]), intval($size[1]), $jqCrop); } else if ( count($size) == 2 ) { $size[0] = intval($size[0]); $size[1] = intval($size[1]); return $this->crop( intval($size[0]), intval($size[1]) ); } else { $size[0] = intval($size[0]); return $this->scale( intval($size[0]), $site); } } function crop($nw, $nh) { $w = $this->img['lebar']; $h = $this->img['tinggi']; if( $w <= $nw AND $h <= $nh ) { $this->img['lebar_thumb'] = $w; $this->img['tinggi_thumb'] = $h; return 0; } $nw = min($nw, $w); $nh = min($nh, $h); $size_ratio = max($nw / $w, $nh / $h); $src_w = ceil($nw / $size_ratio); $src_h = ceil($nh / $size_ratio); $sx = floor(($w - $src_w)/2); $sy = floor(($h - $src_h)/2); $this->img['des'] = imagecreatetruecolor($nw, $nh); if ( $this->img['format'] == "PNG" ) { imagealphablending( $this->img['des'], false); imagesavealpha( $this->img['des'], true); } imagecopyresampled($this->img['des'],$this->img['src'],0,0,$sx,0,$nw,$nh,$src_w,$src_h); $this->img['src'] = $this->img['des']; return 1; } function jqCrop($nw, $nh, $cropData) { $cropDataExp = explode('|', $cropData); $left = $cropDataExp[0]; $top = $cropDataExp[1]; if(!$left OR $left < 0 OR $left > $nw) $left = 0; if(!$top OR $top < 0 OR $top > $nh) $top = 0; if($nw < 100) $nw = 100; if($nh < 100) $nh = 100; $w = $this->img['lebar']; $h = $this->img['tinggi']; if( $w <= $nw AND $h <= $nh ) { $this->img['lebar_thumb'] = $w; $this->img['tinggi_thumb'] = $h; return 0; } $nw = min($nw, $w); $nh = min($nh, $h); $size_ratio = max($nw / $w, $nh / $h); $src_w = ceil($nw / $size_ratio); $src_h = ceil($nh / $size_ratio); $this->img['des'] = imagecreatetruecolor($nw, $nh); if ( $this->img['format'] == "PNG" ) { imagealphablending( $this->img['des'], false); imagesavealpha( $this->img['des'], true); } imagecopyresampled($this->img['des'], $this->img['src'], 0, 0, $left, $top, $nw, $nh, $nw, $nh); $this->img['src'] = $this->img['des']; return 1; } function scale($size = 100, $site = 0) { $site = intval( $site ); if( $this->img['lebar'] <= $size and $this->img['tinggi'] <= $size ) { $this->img['lebar_thumb'] = $this->img['lebar']; $this->img['tinggi_thumb'] = $this->img['tinggi']; return 0; } switch ($site) { case "1" : if( $this->img['lebar'] <= $size ) { $this->img['lebar_thumb'] = $this->img['lebar']; $this->img['tinggi_thumb'] = $this->img['tinggi']; return 0; } else { $this->img['lebar_thumb'] = $size; $this->img['tinggi_thumb'] = ($this->img['lebar_thumb'] / $this->img['lebar']) * $this->img['tinggi']; } break; case "2" : if( $this->img['tinggi'] <= $size ) { $this->img['lebar_thumb'] = $this->img['lebar']; $this->img['tinggi_thumb'] = $this->img['tinggi']; return 0; } else { $this->img['tinggi_thumb'] = $size; $this->img['lebar_thumb'] = ($this->img['tinggi_thumb'] / $this->img['tinggi']) * $this->img['lebar']; } break; default : if( $this->img['lebar'] >= $this->img['tinggi'] ) { $this->img['lebar_thumb'] = $size; $this->img['tinggi_thumb'] = ($this->img['lebar_thumb'] / $this->img['lebar']) * $this->img['tinggi']; } else { $this->img['tinggi_thumb'] = $size; $this->img['lebar_thumb'] = ($this->img['tinggi_thumb'] / $this->img['tinggi']) * $this->img['lebar']; } break; } if ($this->img['lebar_thumb'] < 1 ) $this->img['lebar_thumb'] = 1; if ($this->img['tinggi_thumb'] < 1 ) $this->img['tinggi_thumb'] = 1; $this->img['des'] = imagecreatetruecolor( $this->img['lebar_thumb'], $this->img['tinggi_thumb'] ); if ( $this->img['format'] == "PNG" ) { imagealphablending( $this->img['des'], false); imagesavealpha( $this->img['des'], true); } @imagecopyresampled( $this->img['des'], $this->img['src'], 0, 0, 0, 0, $this->img['lebar_thumb'], $this->img['tinggi_thumb'], $this->img['lebar'], $this->img['tinggi'] ); $this->img['src'] = $this->img['des']; return 1; } function jpeg_quality($quality = 90) { //jpeg quality $this->img['quality'] = $quality; } function save($save = "") { if( $this->img['format'] == "JPG" || $this->img['format'] == "JPEG" ) { //JPEG imagejpeg( $this->img['src'], $save, $this->img['quality'] ); } elseif( $this->img['format'] == "PNG" ) { //PNG imagealphablending( $this->img['src'], false); imagesavealpha( $this->img['src'], true); imagepng( $this->img['src'], $save ); } elseif( $this->img['format'] == "GIF" ) { //GIF imagegif( $this->img['src'], $save ); } imagedestroy( $this->img['src'] ); } function show() { if( $this->img['format'] == "JPG" || $this->img['format'] == "JPEG" ) { //JPEG imageJPEG( $this->img['src'], "", $this->img['quality'] ); } elseif( $this->img['format'] == "PNG" ) { //PNG imagePNG( $this->img['src'] ); } elseif( $this->img['format'] == "GIF" ) { //GIF imageGIF( $this->img['src'] ); } imagedestroy( $this->img['src'] ); } }
Я конечно может совсем бестактный, но, @kinlok, ты вроде из Перми, а не с Точикистона, не коверкай так русский язык, пожалуйста.
@kinlok надо вместо function thumbnail писать function __construct. Но ты теперь обязан перевести текст ошибки и понять, в чем суть.
спосиба тебе бальшое заменил функцию function __construct. и заработала тока точка была лишнея а вастальном все заработала тут еше адна пахоже ета паследния ашибка Fatal error: Uncaught Error: Class 'parse' not found in W:\domains\ivinete.net\core\classes\wall.php:292 вот в этам коде include ROOT_DIR.'core/classes/forwall.php'; $parse = new parse();