this is char ű not -- or \ '
if (!$GLOBALS["SITE_ONLINE"])
{
die("Die Seite ist momentan aufgrund von Wartungsarbeiten nicht verfügbar.<br>");
}
// Power-Switch
$GLOBALS["SITE_ONLINE"] = TRUE;
Quote:
Minimum Requirements:
- Apache2, PHP5, MySQL
- VPS
- 4 GB of RAM, dual-core processor ~ 2 GHz
- A resource package
- PHP / SQL knowledge
Recommended Requirements:
- Apache2, PHP5, tuned MySQL server which acts only on MyISAM
- Debian 7.5 or Gentoo
- Dedicated server (root or managed)
- 16 GB RAM, quad core processor ~ 3 GHz
- PHP / SQL / JS / AJAX knowledge
- A resource package
1 de
2 http://img.playa-games.com/res/sfgame/
3 http://img.playa-games.com/res/sfgame/
7 domain.com
8 http://domain.com/
9 0
10 http://www.elitepvpers.com
11 http://domain.com/support.php
12 http://www.gamepsf.de/
13 http://domain.com/rules.html
14 http://domain.com/shop.php
17 3
18 domain
21 3
23 1
25 http://domain.com/req.php?req=%1&random=%2
29 support@domain.com
30 http://domain.com/papaya44.swf
31 http://domain.com/papaya_cfg.php
32 1
34 2
35 http://domain.com/spenden.php
36 gamestaff@domain.com
42 1
43 1337
48 http://domain.com/res/sfgame_low/
46 de/ar/cs/da/en/es/fr/el/hu/it/ja/nl/pl/pt/pt-br/ru/sv/tr
47 german/arabic/czech/danish/english/spanish/french/greek/hungarian/italian/japanese/dutch/polish/portuguese/brazilian portuguese/russian/swedish/turkish
26 166;;http://domain.com/cid/cid.php?cid=%cid%&action=166&playerid=%playerid%&mushbought=%mushbought%&bid=<bid>&token=<token>&serverid=3&gameid=1
26 1;;http://domain.com/cid/cid.php?cid=%cid%&action=1&playerid=%playerid%&mushbought=%mushbought%&bid=<bid>&token=<token>&serverid=3&gameid=1
//26 188;;http://domain.com/cid/cid.php?cid=%cid%&action=188&playerid=%playerid%&mushbought=%mushbought%&bid=<bid>&token=<token>&serverid=3&gameid=1
12 http://www.gamepsf.de/
<?php
class MySQL
{
/**
* gobale MySQL-Definition.
*
* @access protect
* @var string
*/
protected $mysql = null;
/**
* Server der MySQL-Datenbank.
*
* @access protect
* @var string
*/
protected $mysqlHost = null;
/**
* Port des MySQL-Servers.
*
* @access protect
* @var string
*/
protected $mysqlPort = null;
/**
* User-Name der MySQL-Datenbank.
*
* @access protect
* @var string
*/
protected $mysqlUser = null;
/**
* Passwort der MySQL-Datenbank.
*
* @access protect
* @var string
*/
protected $mysqlPassword = null;
/**
* Name der MySQL-Datenbank.
*
* @access protect
* @var string
*/
protected $mysqlDatabase = null;
/**
* Techniker-Mail-Adresse.
*
* @access protect
* @var string
*/
protected $mysqlTechMail = null;
/**
* MySQL-Verbindung.
*
* @access protect
* @var resource
*/
protected $connectionHandle = null;
/**
* Anzeigen und Stoppen bei SQL-Fehlern
*
* @access protect
* @var boolean
*/
protected $reporterror = true;
/**
* Zähler für die SQL-Abfragen.
*
* @access protect
* @var integer
*/
protected $sqlcounter = 0;
/**
* Anzahl der Zeilen innerhalb der Abfrage.
*
* @access protect
* @var integer
*/
protected $rowcount = 0;
/**
* Zeitpsanne der SQL-Abfragen.
*
* @access protect
* @var integer
*/
protected $dbtime = 0;
/**
* Gesamtzeit aller SQL-Abfragen.
*
* @access protect
* @var float
*/
protected $starttime = 0;
/**
* fertige SQL-Abfrage.
*
* @access private
* @var string
*/
private $sql_query = '';
/**
* Nachkomma-Stellen.
*
* @access private
* @var integer
*/
private $rounded = 4;
/**
* MySQL-Klasse erstellen
*
* @access public
* @return boolean
* @param registry Registry object
*/
public function __construct()
{
require_once('./config.php');
if( is_array($config['Database']) )
{
$this -> mysqlHost = $config['Database']['servername'];
$this -> mysqlPort = $config['Database']['port'];
$this -> mysqlUser = $config['Database']['username'];
$this -> mysqlPassword = $config['Database']['password'];
$this -> mysqlDatabase = $config['Database']['dbname'];
$this -> mysqlTechMail = $config['Database']['technicalemail'];
}
else
{
trigger_error("MySQL::Config fail to load Data", E_USER_ERROR);
}
$this -> db_connect();
if (!$this -> connectionHandle)
{
$this -> db_error('Keine Verbindung zur Datenbank möglich');
$this -> mysql = FALSE;
}
if(!@mysql_select_db($this -> mysqlDatabase,
$this -> connectionHandle))
{
$this -> db_error('Keine Verbindung zur Datenbank möglich');
$this -> mysql = FALSE;
}
$this -> starttime = $this -> microtime_float();
}
/**
* MySQL-Verbindung herstellen
*
* @access private
*/
private function db_connect()
{
$link = mysql_connect($this -> mysqlHost . ':' . $this -> mysqlPort,
$this -> mysqlUser,
$this -> mysqlPassword);
restore_error_handler();
$this -> connectionHandle = $link;
}
/**
* MySQL-Klasse und MySQL-Verbindung löschen
*
* @access public
*/
public function __destruct()
{
if ($this -> connectionHandle)
{
if (!@mysql_close($this -> connectionHandle))
{
$this -> db_error('Datenbank kann nicht geschlossen werden!');
}
}
}
/**
* Klassenzeitmessung
*
* @access private
* @return float
*/
private function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return (floatval($usec) + floatval($sec));
}
/**
* Datenfilter für Eingabedaten
*
* @param mixed
* $value mixed zu überprüfende Daten
* @return mixed gefilterte und überprüfte Daten
*/
private function validate_value($value)
{
if ( is_null($value) )
{
return 'NULL';
}
else if ( is_string($value) )
{
return "'" . mysql_escape_string($value) . "'";
}
else if ( is_numeric($value) AND (floatval($value) == $value) )
{
return floatval($value);
}
else if ( is_bool($value) )
{
return $value ? 1 : 0;
}
else
{
return "'" . mysql_escape_string($value) . "'";
}
}
/**
* ergänzt die MySQL-Abfrage um die Condition
*
* @access private
* @param mixed
* $condition string String-Condition zur Ergänzung
* $condition array Array mit Operator=>Condition als Daten
* @return null
*/
private function add_condition($condition = NULL)
{
if( is_null($condition) )
{
return TRUE;
}
if( is_string($condition) )
{
$cond_array = array('WHERE', 'ORDER');
$condition = trim($condition);
if( $condition != '' )
{
$first = strtoupper( substr($condition, 0, 5) );
$first = trim($first);
if( in_array($first, $cond_array, TRUE) )
{
$this -> sql_query .= ' ' . $condition;
}
else
{
$this -> sql_query .= ' WHERE ' . $condition;
}
}
}
elseif( is_array($condition) AND count($condition) )
{
$new_cond = '';
foreach($condition AS $operator => $cond)
{
$new_cond .= strtoupper($operator) . ' ' . $cond . ' ';
}
$this -> sql_query .= ' WHERE ' . trim($new_cond);
}
}
/**
* MySQL-Abfrage aus übergebenem Datenarray erstellen
*
* @access private
* @param mixed
* $type string Typ der Abfrage
* $array array Array mit Abfrage-Werten
* @return string fertige SQL-Abfrage; bei Fehlern FALSE
*/
private function compile_sql($type = '', $array = NULL)
{
$allow_action = array('INSERT', 'INSERT_SELECT', 'UPDATE', 'SELECT');
$type = strtoupper($type);
if ( $type == "" OR !is_array($array) OR !in_array($type, $allow_action) )
{
return FALSE;
}
$fields = array();
$values = array();
if ( ($type == 'INSERT') OR ($type == 'INSERT_SELECT') )
{
foreach ($array AS $key => $val)
{
$fields[] = $key;
$values[] = $this -> validate_value($val);
}
if ($type == 'INSERT')
{
$this -> sql_query = ' (`' . implode('`, `', $fields) . '`) VALUES (' . implode(', ', $values) . ')';
}
else
{
$this -> sql_query = ' (`' . implode('`, `', $fields) . '`) SELECT ' . implode(', ', $values) . ' ';
}
}
else if ( ($type == 'UPDATE') OR ($type == 'SELECT') )
{
foreach ($array AS $key => $val)
{
if ($type == 'UPDATE')
{
$values[] = "`" . $key . "` = " . $this -> validate_value($val);
}
else
{
$values[] = substr($this -> validate_value($val), 1, strlen( $this -> validate_value($val) )-2 );
}
}
// $this -> sql_query = implode( ($type == 'SELECT') ? ', ' : ' AND ', $values );
$this -> sql_query = implode( ', ', $values );
}
else
{
return FALSE;
}
}
/**
* normale MySQL-Abfrage ausführen
*
* @access private
* @param string
* $sql string SQL-Abfrage
* @return resource oder bei Fehlern FALSE
*/
private function query()
{
$time = $this -> microtime_float();
if ($result = @ mysql_query($this -> sql_query, $this -> connectionHandle))
{
$this -> dbtime += $this -> microtime_float() - $time;
$this -> sqlcounter ++;
$this -> rowcount ++;
return $result;
mysql_free_result($result);
}
else
{
$this -> db_error();
$this -> sql_query = '';
}
}
/**
* Anzahl von Datensätzen ermitteln
*
* @access public
* @param string
* $table string Name der Tabelle
* $cond string Parameter für die Abfrage
* @return integer Anzahl der Datensätze; bei Fehlern FALSE
*/
public function queryCount($table = '', $cond = NULL)
{
if ( ($table == '') )
{
return FALSE;
}
else
{
$this -> sql_query = 'SELECT COUNT(*) FROM ' . $table;
$this -> add_condition($cond);
if ( $result = $this -> query() )
{
if( mysql_num_rows($result) )
{
$row = mysql_fetch_array($result);
return $row[0];
}
else
{
return FALSE;
}
}
}
}
/**
* einzelne SELECT-MySQL-Abfrage ausführen und Array zurückliefern
*
* @access public
* @param string
* $table string Name der Tabelle
* $array array Array mit Tabellen-Namen
* $cond string Parameter für die Abfrage
* @return array SQL-Ergebniss; bei Fehlern FALSE
*/
public function queryObjectArray($table = '', $array = NULL, $cond = NULL)
{
if ( !is_array($array) OR ($table == '') )
{
return FALSE;
}
else
{
$this -> compile_sql('SELECT', $array);
$this -> sql_query = 'SELECT ' . $this -> sql_query . ' FROM ' . $table;
$this -> add_condition($cond);
if ( $result = $this -> query() )
{
if (mysql_num_rows($result))
{
while ($row = mysql_fetch_array($result))
{
$result_array[] = $row;
}
$this -> rowcount += count($result_array);
return $result_array;
}
else
{
return FALSE;
}
}
}
}
/**
* einzelne SELECT-MySQL-Abfrage ausführen
*
* @access public
* @param string
* $table string Name der Tabelle
* $value string Name des Feldes
* $cond string Parameter für die Abfrage
* @return string SQL-Ergebniss; bei Fehlern FALSE
*/
public function querySingleItem($table = '', $value = '', $cond = NULL)
{
if ( ($value == '') OR ($table == '') )
{
return FALSE;
}
else
{
$array = array();
$array[] = $value;
$this -> compile_sql('SELECT', $array);
$this -> sql_query = 'SELECT ' . $this -> sql_query . ' FROM ' . $table;
$this -> add_condition($cond);
if ( (strpos($this -> sql_query, 'LIMIT') == 0) AND (strpos($this -> sql_query, 'limit') == 0) )
{
$this -> sql_query .= ' LIMIT 1';
}
if ( $result = $this -> query() )
{
if( mysql_num_rows($result) )
{
$row = mysql_fetch_array($result);
return $row[0];
}
else
{
return FALSE;
}
}
}
}
/**
* einzelne SELECT-MySQL-Abfrage ausführen
*
* @access public
* @param string
* $table string Name der Tabelle
* $array array Array mit Zellen-Namen
* $cond string Parameter für die Abfrage
* @return mixed Array oder bei Fehlern FALSE
*/
public function querySingleArray($table = '', $array = NULL, $cond = NULL)
{
if ( !is_array($array) OR ($table == '') )
{
return FALSE;
}
else
{
if ($array[0] == '*')
{
$this -> sql_query = '*';
}
else
{
$this -> compile_sql('SELECT', $array);
}
$this -> sql_query = 'SELECT ' . $this -> sql_query . ' FROM ' . $table;
$this -> add_condition($cond);
if ( $result = $this -> query() )
{
if( mysql_num_rows($result) )
{
return mysql_fetch_array($result);
}
else
{
return FALSE;
}
}
}
}
/**
* Tabellen-Struktur abfragen
*
* @access public
* @param string
* $table string Name der Tabelle
* @return mixed Array oder bei Fehlern FALSE
*/
public function describe_Table($table = '')
{
if ( trim($table) == '' )
{
return FALSE;
}
$result_array = array();
$this -> sql_query = 'SHOW FULL COLUMNS FROM ' . $table;
if ( $result = $this -> query() )
{
if( mysql_num_rows($result) )
{
while ($row = mysql_fetch_array($result))
{
$result_array[] = $row;
}
$this -> rowcount += count($result_array);
return $result_array;
}
else
{
return FALSE;
}
}
}
/**
* einzelnes MySQL-Komando ausführen
* INSERT, DELETE, etc.
*
* @access public
* @param string
* $sql string SQL-Abfrage
* @return boolean
*/
public function execute($sql)
{
if ( trim($sql) == '' )
{
return FALSE;
}
else
{
$this -> sql_query = trim($sql);
}
if ( $this -> query() )
{
return TRUE;
}
else
{
return FALSE;
}
}
/**
* Anzeige der ID des zuletzt eingefügten Datensatzes
*
* @access public
* @param string
* $table string Name der Tabelle
* @return integer bei Fehlern FALSE
*/
public function insertID($table = "")
{
if ( trim($table) != "" )
{
$this -> sql_query = 'SELECT LAST_INSERT_ID() FROM ' . $table;
$res = $this -> query();
return mysql_num_rows($res); // + 1;
}
else
{
return FALSE;
}
}
/**
* Anzeige der ID des letzten Datensatzes
*
* @access public
* @param string
* $table string Name der Tabelle
* @return integer bei Fehlern FALSE
*/
public function tableCount($table = "")
{
if (trim($table) != "")
{
$this -> sql_query = 'SELECT COUNT(*) FROM ' . $table;
$res = $this -> query();
$row = mysql_fetch_array($res);
return $row[0];
}
else
{
return FALSE;
}
}
/**
* liefert die größte ID innerhalb der Tabelle
*
* @access public
* @param string
* $field string Name des Abfragefeldes
* $table string Name des Tabelle
* @return integer bei Fehlern FALSE
*/
public function maxID($field = "id", $table = "")
{
if ( (trim($field) != "") AND (trim($table) != "") )
{
$this -> sql_query = 'SELECT MAX(' . $field . ') FROM ' . $table;
$res = $this -> query();
$row = mysql_fetch_array($res);
return $row[0];
}
else
{
return FALSE;
}
}
/**
* liefert die kleinste ID innerhalb der Tabelle
*
* @access public
* @param string
* $field string Name des Abfragefeldes
* $table string Name des Tabelle
* @return integer bei Fehlern -1
*/
public function minID($field = "id", $table = "")
{
if ( (trim($field) != "") AND (trim($table) != "") )
{
$this -> sql_query = 'SELECT MIN(' . $field . ') FROM ' . $table;
$res = $this -> query();
$row = mysql_fetch_array($res);
return $row[0];
}
else
{
return FALSE;
}
}
/**
* SQL-Injection-Geschütztes einfügen einer Tabellenzeile
*
* @access public
* @param string
* $array array Datenarray mit den Einfügedaten
* $table string Name der Tabelle
* @return boolean bei Fehlern FALSE sonst ID des Datensatzes
*/
public function insertRow($array = null, $table = "")
{
if ( is_array($array) AND trim($table) != '' AND count($array) > 0 )
{
$this -> compile_sql('INSERT', $array);
$this -> sql_query = 'INSERT INTO ' . $table . ' ' . $this -> sql_query;
$this -> query();
return $this -> insertID($table);
}
else
{
return FALSE;
}
}
/**
* SQL-Injection-Geschütztes updaten einer Tabellenzeile
*
* @access public
* @param string
* $array array Datenarray mit den Einfügedaten
* $table string Name der Tabelle
* $condition string Zusätzliche Parameter zum udaten
* @return boolean bei Fehlern FALSE
*/
public function updateRow($array = null, $table = "", $condition = NULL)
{
if ( is_array($array) AND trim($table) != '' AND count($array) > 0 )
{
$this -> compile_sql('UPDATE', $array);
$this -> sql_query = 'UPDATE ' . $table . ' SET ' . $this -> sql_query;
$this -> add_condition($condition);
$this -> query();
return TRUE;
}
else
{
return FALSE;
}
}
/**
* Anzeige der Laufzeitinformationen
*
* @access public
* @return string
*/
public function showStatistics()
{
$totalTime = $this -> microtime_float() - $this -> starttime;
return '<div style="width: 100%; text-align: center;">' . $this -> rowcount . ' Zeile(n) / ' . $this -> sqlcounter . ' Abfrage(n) - ' .
round( $totalTime, $this -> rounded ) . ' Sekunden (' . round( ($totalTime - $this -> dbtime), $this -> rounded ) .
' Sekunden PHP / ' . round( $this -> dbtime, $this -> rounded ) . ' Sekunden SQL)</div>';
}
/**
* Anzeigen der letzten SQL-Abfrage in kompilierter Form
*
* @access public
*/
public function get_mysql_query()
{
return $this -> sql_query;
}
/**
* Returns the text of the error message from previous database operation
*
* @return string
*/
function error()
{
if ($this -> connectionHandle === null)
{
$this -> error = '';
}
else
{
$this -> error = mysql_error($this -> connectionHandle);
}
return $this -> error;
}
/**
* Returns the numerical value of the error message from previous database operation
*
* @return integer
*/
function errno()
{
if ($this -> connectionHandle === null)
{
$this -> errno = 0;
}
else
{
$this -> errno = mysql_errno($this -> connectionHandle);
}
return $this -> errno;
}
/**
* Switches database error display ON
*/
function show_errors()
{
$this -> reporterror = true;
}
/**
* Switches database error display OFF
*/
function hide_errors()
{
$this -> reporterror = false;
}
/**
* Rücksetzen der Laufzeitinformationen
*
* @access public
*/
public function resetStatistics()
{
$this -> sqlcounter = 0;
$this -> rowcount = 0;
$this -> dbtime = 0;
$this -> starttime = $this -> microtime_float();
}
/**
* Erzeugt eine komplette Error-Meldung
*
* @access public
*/
public function db_error($errortext = '')
{
if ($this -> connectionHandle)
{
$this -> error = $this -> error($this -> connectionHandle);
$this -> errno = $this -> errno($this -> connectionHandle);
}
if ($errortext == '')
{
$this -> sql_query = "Fehlerhafte SQL:\r\n" . trim($this -> sql_query) . ';';
$errortext =& $this -> sql_query;
}
$technicalemail =& $this -> mysqlTechMail;
$mysqlversion = 'Unknown';
$requestdate = date('l, d.m.Y @ H:i:s', ( defined(TIMENOW) ? TIMENOW : time() ) );
$date = date('l, d.m.Y @ H:i:s');
$scriptpath = str_replace('&', '&', $_SERVER['REQUEST_URI']);
$referer = $_SERVER['PHP_SELF'];
$ipaddress = $_SERVER['REMOTE_ADDR'];
$classname = get_class($this);
if ( $this -> connectionHandle )
{
$this -> hide_errors();
list($mysqlversion) = @ mysql_fetch_array(@ mysql_query('SELECT VERSION() AS version'));
$this->show_errors();
}
eval('$message = "' . str_replace('"', '\"', file_get_contents('database_error_message.html')) . '";');
$message = '<textarea rows="20" cols="100" wrap="off" id="message">' . htmlspecialchars($message) . '</textarea>';
eval('$message = "' . str_replace('"', '\"', file_get_contents('database_error_page.html')) . '";');
die($message);
}
}
?>
<?php
$config['Database']['dbtype'] = 'mysql';
$config['Database']['dbname'] = 'Datenbankname';
$config['Database']['servername'] = 'localhost';
$config['Database']['port'] = 3306;
$config['Database']['username'] = 'Datenbankuser';
$config['Database']['password'] = 'Datenbankpasswort';
$config['Database']['technicalemail'] = '[Only registered and activated users can see links. Click Here To Register...]';
?>
Datenbankfehler: $errortext MySQL-Fehler : $this->error Fehler-Nr. : $this->errno Fehler-Zeit : $requestdate Datum : $date Skript : http://$_SERVER[HTTP_HOST]$scriptpath Referrer : $referer IP-Adresse : $ipaddress Klassenname : $classname MySQL-Version : $mysqlversion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Datenbankfehler</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" /> <link rel="stylesheet" type="text/css" href="../../css/error.css" /> </head> <body> <table cellpadding="3" cellspacing="5" id="container"> <tr> <td id="bodytitle" width="100%">Datenbankfehler</td> </tr> <tr> <td class="bodytext" colspan="2">Es trat ein Problem mit der Datenbank auf.</td> </tr> <tr> <td colspan="2"><hr /></td> </tr> <tr> <td class="bodytext" colspan="2"> Versuchen Sie Folgendes: <ul> <li>Laden Sie die Seite über die <a href="#" onclick="window.location = window.location;">Aktualisieren</a> Schaltfläche in Ihrem Browser neu.</li> <li>Öffnen Sie die <a href="/">$_SERVER[HTTP_HOST]</a> Homepage und versuchen Sie eine andere Seite zu öffnen.</li> <li>Klicken Sie auf <a href="javascript:history.back(1)">Zurück</a>, um einen anderen Link zu versuchen.</li> </ul> </td> </tr> <tr> <td class="bodytext" colspan="2">Der technische Administrator von $_SERVER[HTTP_HOST] wurde über den Fehler informiert. Falls das Problem jedoch weiterhin auftritt, können Sie ihn auch <a href="mailto:$technicalemail">kontaktieren</a>.</td> </tr> <tr> <td class="bodytext" colspan="2"> <br />Wir entschuldigen uns für die Unannehmlichkeiten.</td> </tr> </table> <p>$message</p> </body> </html>
body {
margin : auto;
text-align : center;
background-color : #FF0000;
}
p {
border : solid 2px #808080;
border-top-width : 1px;
border-left-width : 1px;
border-top-color : #C0C0C0;
border-left-color : #C0C0C0;
margin-left : 100px;
margin-right : 100px;
padding : 10px;
background-color : #0000FF;
color : #FFFFFF;
text-align : left;
}
$db -> queryObjectArray('Tabelle', array('*'), 'ORDER BY id, name ASC');
$db -> queryObjectArray('tabelle', array('spalte1','spalte2'));
$db -> querySingleArray('tabelle', array('*'), "WHERE id= " . $id . " LIMIT 1");
$db -> querySingleArray('tabelle', array('spalte1', 'spalte2'), "WHERE id= " . $id . " LIMIT 1");
$db -> queryCount('tabelle', "WHERE name = " . $name);
$$mySite -> db -> insertID("tabelle");
$db -> execute('DELETE');
$db -> updateRow($data-array, "tabelle", "id = " . $id);
echo $db -> get_mysql_query();
if( is_string($condition) )
{
$cond_array = array('WHERE', 'ORDER');
if( is_string($condition) )
{
$cond_array = array('WHERE', 'ORDER', 'JOIN', 'LEFT', 'RIGHT');