Errore script php

giuse940

Nuovo Utente
26 Mar 2014
3
0
0
ciao ragazzi ho installato uno script php sul mio spazio web, ma quando lo apro mi presenta questo errore:

Parse error: syntax error, unexpected '{' in /home/u828566234/public_html/includes/class/_class_mysql.php on line 1

questo è il codice del file:

PHP:
<?php

if (extension_loaded('mysqli') AND version_compare("5.0.5", phpversion(), "!=") )
{
	class mysqldb
		{
			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 = 'mysql.hostinger.it', $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", "utf8");
				}
				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(MYSQLDBUSER, MYSQLDBPASS, MYSQLDBNAME, MYSQLHOST);
				
				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_list[] = array( 'time'  => ($this->get_real_time() - $time_before), 
		//										 'query' => $query,
		//										 'num'   => (count($this->query_list) + 1));
				
				$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)
			{
				if(!$multi) {
					$this->query($query);
					$data = $this->get_row();
					$this->free();			
					return $data;
				} else {
					$this->query($query);
					
					$rows = array();
					while($row = $this->get_row()) {
						$rows[] = $row;
					}
					$this->free();			
					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";
				}
				
				$sqlerror="<table cellpadding=\"0\" cellspacing=\4\" class=\"smallgrey\" border=\"0\" align=\"center\">\n";
				$sqlerror.="<tr><td class=\"smallorange\"><font size=4><B><U>".$error."</U></B></td></tr>\n";
				$sqlerror.="<tr><td height=\"10\"></td></tr>\n";
				$sqlerror.="<tr><td>MySQL Error </td><td>: ".$query_str."</td></tr>\n";
				$sqlerror.="<tr><td>Error Number</td><td>: ".$error_num."</td></tr>\n";
				$sqlerror.="<tr><td>Date</td><td>: ".date("D, F j, Y H:i:s")."</td></tr>\n";
				$sqlerror.="<tr><td>IP</td><td>: ".getenv("REMOTE_ADDR")."</td></tr>\n";
				$sqlerror.="<tr><td>Browser</td><td>: ".getenv("HTTP_USER_AGENT")."</td></tr>\n";
				$sqlerror.="<tr><td>Script</td><td>: ".getenv("REQUEST_URI")."</td></tr>\n";
				$sqlerror.="<tr><td>Referer</td><td>: ".getenv("HTTP_REFERER")."</td></tr>\n";
				$sqlerror.="<tr><td>PHP Version </td><td>: ".PHP_VERSION."</td></tr>\n";
				$sqlerror.="<tr><td>OS</td><td>: ".PHP_OS."</td></tr>\n";
				$sqlerror.="<tr><td>Server</td><td>: ".getenv("SERVER_SOFTWARE")."</td></tr>\n";
				$sqlerror.="<tr><td>Server Name</td><td>: ".getenv("SERVER_NAME")."</td></tr>\n";
				$sqlerror.="</table>";

				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>MySQL Fatal Error</title>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
				<style type="text/css">
				<!--
					BODY {
					FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal;  FONT-FAMILY: Arial, Verdana;
					SCROLLBAR-FACE-COLOR: #e8e8e8; SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; OVERFLOW: auto; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #cccccc; SCROLLBAR-ARROW-COLOR: #e8e8e8; SCROLLBAR-TRACK-COLOR: #eeeeee; SCROLLBAR-DARKSHADOW-COLOR: #cccccc
					}
					.smallorange {
					FONT-SIZE: 8pt; COLOR: #FF6600; FONT-FAMILY: Arial, Verdana
					}
				-->
				</style>
				</head>
				<body>
				'.$sqlerror.'
				</body>
				</html>';
				
				exit();
			}
		}

}
else
{
	class mysqldb
		{
			var $db_id = false;
			var $connected = false;
			var $query_num = 0;
			var $query_list = array();
			var $mysql_error = '';
			var $mysql_version = '';
			var $mysql_error_num = 0;
			var $mysql_extend = "MySQL";
			var $MySQL_time_taken = 0;
			var $query_id = false;
			
			function connect($db_user, $db_pass, $db_name, $db_location = 'localhost', $show_error=1)
			{
				if(!$this->db_id = @mysql_connect($db_location, $db_user, $db_pass)) {
					if($show_error == 1) {
						$this->display_error(mysql_error(), mysql_errno());
					} else {
						return false;
					}
				} 
				if([email protected]_select_db($db_name, $this->db_id)) {
					if($show_error == 1) {
						$this->display_error(mysql_error(), mysql_errno());
					} else {
						return false;
					}
				}
				$this->mysql_version = mysql_get_server_info();
				if(!defined('COLLATE'))
				{ 
					define ("COLLATE", "utf8");
				}
				if (version_compare($this->mysql_version, '4.1', ">=")) mysql_query("/*!40101 SET NAMES '" . COLLATE . "' */");
				$this->connected = true;
				return true;
			}
			
			function query($query, $show_error=true)
			{
				$time_before = $this->get_real_time();
				if(!$this->connected) $this->connect(MYSQLDBUSER, MYSQLDBPASS, MYSQLDBNAME, MYSQLHOST);
				
				if(!($this->query_id = mysql_query($query, $this->db_id) )) {
					$this->mysql_error = mysql_error();
					$this->mysql_error_num = mysql_errno();
					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_list[] = array( 'time'  => ($this->get_real_time() - $time_before), 
		//										 'query' => $query,
		//										 'num'   => (count($this->query_list) + 1));
				$this->query_num ++;
				return $this->query_id;
			}
			
			function get_row($query_id = '')
			{
				if ($query_id == '') $query_id = $this->query_id;
				return mysql_fetch_assoc($query_id);
			}
			function get_array($query_id = '')
			{
				if ($query_id == '') $query_id = $this->query_id;
				return mysql_fetch_array($query_id);
			}
			
			
			function super_query($query, $multi = false)
			{
				if(!$multi) {
					$this->query($query);
					$data = $this->get_row();
					$this->free();			
					return $data;
				} else {
					$this->query($query);
					
					$rows = array();
					while($row = $this->get_row()) {
						$rows[] = $row;
					}
					$this->free();			
					return $rows;
				}
			}
			
			function num_rows($query_id = '')
			{
				if ($query_id == '') $query_id = $this->query_id;
				return mysql_num_rows($query_id);
			}
			
			function insert_id()
			{
				return mysql_insert_id($this->db_id);
			}
			function get_result_fields($query_id = '') {
				if ($query_id == '') $query_id = $this->query_id;
				while ($field = mysql_fetch_field($query_id))
				{
		            $fields[] = $field;
				}
				
				return $fields;
		   	}
			function safesql( $source )
			{
				if ($this->db_id) return mysql_real_escape_string ($source, $this->db_id);
				else return mysql_escape_string($source);
			}
			function free( $query_id = '' )
			{
				if ($query_id == '') $query_id = $this->query_id;
				@mysql_free_result($query_id);
			}
			function close()
			{
				@mysql_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";
				}
				
				$sqlerror="<table cellpadding=\"0\" cellspacing=\4\" class=\"smallgrey\" border=\"0\" align=\"center\">\n";
				$sqlerror.="<tr><td class=\"smallorange\"><font size=4><B><U>".$error."</U></B></td></tr>\n";
				$sqlerror.="<tr><td height=\"10\"></td></tr>\n";
				$sqlerror.="<tr><td>MySQL Error </td><td>: ".$query_str."</td></tr>\n";
				$sqlerror.="<tr><td>Error Number</td><td>: ".$error_num."</td></tr>\n";
				$sqlerror.="<tr><td>Date</td><td>: ".date("D, F j, Y H:i:s")."</td></tr>\n";
				$sqlerror.="<tr><td>IP</td><td>: ".getenv("REMOTE_ADDR")."</td></tr>\n";
				$sqlerror.="<tr><td>Browser</td><td>: ".getenv("HTTP_USER_AGENT")."</td></tr>\n";
				$sqlerror.="<tr><td>Script</td><td>: ".getenv("REQUEST_URI")."</td></tr>\n";
				$sqlerror.="<tr><td>Referer</td><td>: ".getenv("HTTP_REFERER")."</td></tr>\n";
				$sqlerror.="<tr><td>PHP Version </td><td>: ".PHP_VERSION."</td></tr>\n";
				$sqlerror.="<tr><td>OS</td><td>: ".PHP_OS."</td></tr>\n";
				$sqlerror.="<tr><td>Server</td><td>: ".getenv("SERVER_SOFTWARE")."</td></tr>\n";
				$sqlerror.="<tr><td>Server Name</td><td>: ".getenv("SERVER_NAME")."</td></tr>\n";
				$sqlerror.="</table>";

				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>MySQL Fatal Error</title>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
				<style type="text/css">
				<!--
					BODY {
					FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal;  FONT-FAMILY: Arial, Verdana;
					SCROLLBAR-FACE-COLOR: #e8e8e8; SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; OVERFLOW: auto; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #cccccc; SCROLLBAR-ARROW-COLOR: #e8e8e8; SCROLLBAR-TRACK-COLOR: #eeeeee; SCROLLBAR-DARKSHADOW-COLOR: #cccccc
					}
					.smallorange {
					FONT-SIZE: 8pt; COLOR: #FF6600; FONT-FAMILY: Arial, Verdana
					}
				-->
				</style>
				</head>
				<body>
				'.$sqlerror.'
				</body>
				</html>';
				
				exit();
			}
		}

}
?>
 
Discussioni simili
Autore Titolo Forum Risposte Data
F errore script php PHP 30
P [Javascript] errore su script .js.... Javascript 1
L script errore Only variables PHP 2
M Upload di files - script mi da errore PHP 1
francesco7 Errore collegamento script a Mysql Aruba PHP 0
R Errore Slideshow - "Attenzione lo script non risponde" Joomla 1
K Errore in script creando il form PHP 0
giancadeejay Script che da 2 immagini in errore PHP 10
L continuare script dopo errore PHP 4
C script non va bene, dove è l'errore? Javascript 3
S Errore funzione elimina script PHP 4
F Disperato: 'errore nello script della pagina' Javascript 0
Monital Errore 500. ma script eseguito. Come trovarlo? PHP 3
D Script banale ma non trovo l'errore PHP 5
neo996sps Errore con script per invio mail PHP 3
G Errore script PHP 0
SolidSnake4 errore su script PHP 10
I Errore in script sul sito PHP 2
T Errore Shop Script Free. Aiutatemi Vi Pregoo PHP 1
T errore 80004005 - script "accesso ad aree protette" Classic ASP 7
M Script segnalazione errore PHP 2
B errore script scambio click Classic ASP 2
felino Windows 7: errore 80072EFE su Windows Update Windows e Software 1
A errore http://datatables.net/tn/7 PHP 4
M Errore visualizzazione meta tag title e description SEO e Posizionamento 1
A Errore durante il salvataggio Photoshop 0
M Errore configurazione motion detection nvr Hikvision DS-7616 IP Cam e Videosorveglianza 0
voldemort [c] Errore di segmentazione (core dump creato) C/C++ 1
T SSD - errore sistema Hardware 2
R Navigare sito con cURL, mi restituisce errore PHP 0
L File CSV con app inventor da errore Sviluppo app per Android 2
A Errore visualizzazione selezione testo Photoshop 0
S Errore PHP - Notice: Undefined index ... PHP 14
U Campo vuoto data errore Fatal error: PHP 2
R Errore UPDATE tabella mysql PHP 1
R W10 Segnalazione di errore su terminale USB Windows e Software 0
G non riesco a capire quale sia l'errore [SQL] MySQL 2
I Errore 80040220 nella newsletter con paginazione Classic ASP 0
E Errore di lettura php in html PHP 8
A php metodo post jquery non da mai errore jQuery 4
W Errore di run-time di Microsoft VBScript error '800a0035' Impossibile trovare il file Classic ASP 0
B Errore unexpected '$variabile' (T_VARIABLE) in your code on line PHP 2
M errore dopo passaggio Php 7.2 PHP 6
S -> Errore PHP 8
S Errore "ftp_put(): Can't open that file: Permission denied" PHP 1
P Errore telecamere hdcvi dahua IP Cam e Videosorveglianza 16
L form multipla php sql,errore in inserimento MySQL 0
M Errore JavaScript per php [objeto HTMLParagraphElement] PHP 0
F [PHP]Errore registrazione PHP 8
MarcoGrazia [PHP] Download di file con errore all'interno. PHP 1

Discussioni simili