diff --git a/adminforce/lib/funktionen/db_backup/wiederherstellen.php b/adminforce/lib/funktionen/db_backup/wiederherstellen.php index 4ba760107d881044398cc7ae0a6450cc49519717..fbf9e6ecd17d560ee0a997960a7cfb52c06062c9 100644 --- a/adminforce/lib/funktionen/db_backup/wiederherstellen.php +++ b/adminforce/lib/funktionen/db_backup/wiederherstellen.php @@ -10,8 +10,8 @@ $qres = db_query("SHOW TABLES") or die(mysqli_error($sql_open)); while (list($tabelle) = mysqli_fetch_row($qres)){ db_query("DROP TABLE IF EXISTS ". $tabelle); } - -$command='mysql -h' .$db_host .' -u' .$db_user .' -p' .$db_pass .' ' .$db_base .' < backup/' .$_POST['datei']; +// DB_PASS on cli ... happy person watching process list +$command='mysql -h' .DB_HOST .' -u' .DB_USER .' -p' .DB_PASS .' ' . DB_BASE .' < backup/' .$_POST['datei']; exec($command,$output=array(),$worked); $meldung = meldung(0,'Die Daten aus der Datei <b>' .$_POST['datei'] .'</b> wurden erfolgreich eingespielt in der Datenbank <b>' .$_POST['datei'] .'</b>'); @@ -21,4 +21,4 @@ if (is_writable('backup/' .$_POST['datei'])) { $fp = versch($fp); file_put_contents('backup/' .$_POST['datei'], $fp); } -?> \ No newline at end of file +?> diff --git a/install/index.php b/install/index.php index 70db8cea2ffe5961e94c068f0adffbd813151e11..e98db10d1991ec6f7fd527bc746aee4e1fd5fc1a 100644 --- a/install/index.php +++ b/install/index.php @@ -6,12 +6,11 @@ if(!isset($_GET['step'])){ $_GET['step'] = 0;} require('../lib/functions.lib.php'); if(isset($_POST['datenbank_anlegen'])){ - $inhalt = ' - <?php + $inhalt = '<?php define("DB_HOST","'.$_POST['host'].'"); define("DB_USER","'.$_POST['nutzername'].'"); define("DB_PASS","'.$_POST['passwort'].'"); - define("DB_BASS","'.$_POST['db'].'"); + define("DB_BASE","'.$_POST['db'].'"); define("PREFIX","'.$_POST['prefix'].'"); @@ -20,8 +19,7 @@ if(isset($_POST['datenbank_anlegen'])){ // Verschlsselungspasswort define("VER_SCHLUESSEL","'. create_code(16) .'"); - ?> - '; + ?>'; $datei = fopen("../lib/db_config.php","w"); fwrite($datei, $inhalt,100000); @@ -373,147 +371,6 @@ if(!isset($_GET['step'])){ $_GET['step'] = 0;} require('../lib/functions.lib.php'); -if(isset($_POST['datenbank_anlegen'])){ - $inhalt = ' - <?php - $db_host = "'.$_POST['host'].'"; - // Mysql User - $db_user = "'.$_POST['nutzername'].'"; - // Mysql PW - $db_pass = "'.$_POST['passwort'].'"; - // Datenbank - $db_base = "'.$_POST['db'].'"; - //Datenbank Prefix - $db_prefix = "'.$_POST['prefix'].'"; - - //Passwort zusatz - $pw_zusatz = '. create_code(5) .'; - - // Verschlüsselungspasswort - $ver_schluessel = '. create_code(16) .'; - - //Datenbankverbindung herstellen - $sql_open = @mysqli_connect($db_host, $db_user, $db_pass, $db_base) or die(\'Verbindung zum Mysql Server fehlgeschlagen! <br>Tipp: <a href="http://www.vms-tutorial.de/wiki//Lib/Functions">http://www.vms-tutorial.de/wiki//Lib/Functions</a>\'); - $sql_base = @mysqli_select_db($sql_open,$db_base) or die("Keine oder falsche Datenbank gewählt! Tipp: <br><a href=\'http://www.vms-tutorial.de/wiki//Lib/Functions\'>http://www.vms-tutorial.de/wiki//Lib/Functions</a>"); - - /** - * db_connect() - * - * @author designerscripte.net - * @category system Database - * @version 2.5.0 - * @example db_query("SELECT `field` FROM `table` WHERE `field` = `value` "); - * @param mixed $sql_tag - * @return 0 bei Fehler Mysql_resource. - * - */ - function db_query($sql_tag) { - global $count_query,$sql_open; - $count_query++; - $fargs = func_get_args(); - - if (!empty($fargs)) { - $vargs = array(); - foreach($fargs as $key => $arg) { - $vargs[$key] = mysqli_real_escape_string($sql_open,$arg); - } - array_shift($vargs); - if (!empty($vargs))$sql_tag = vsprintf($sql_tag, $vargs); - } - if ($ret = mysqli_query($sql_open,$sql_tag)) { - return $ret; - }else { - return 0; - } - } - -/* -* taken from nieprzeklinaj at gmail dot com -* http://php.net/manual/de/mysqli-stmt.bind-result.php -*/ -function db_fetch($result) -{ - $array = array(); - - if($result instanceof mysqli_stmt) - { - $result->store_result(); - - $variables = array(); - $data = array(); - $meta = $result->result_metadata(); - - while($field = $meta->fetch_field()) - $variables[] = &$data[$field->name]; // pass by reference - - call_user_func_array(array($result, 'bind_result'), $variables); - - $i=0; - while($result->fetch()) - { - $array[$i] = array(); - foreach($data as $k=>$v) - $array[$i][$k] = $v; - $i++; - - // don\'t know why, but when I tried $array[] = $data, I got the same one result in all rows - } - } - elseif($result instanceof mysqli_result) - { - while($row = $result->fetch_assoc()) - $array[] = $row; - } - - return $array; -} - - - function pw_erstellen($pw){ - global $pw_zusatz; - $pw_er = hash("sha256",$pw.$pw_zusatz); - return $pw_er; - } - - /** - * db_close() - * - * @author designerscripte.net - * @category system Database - * @version 2.5.0 - * @example db_close(); - * @return die(\'\'); bei fehler nichts bei erfolg - */ - function db_close() { - global $sql_open; - @mysqli_close($sql_open) or die(\'Konnte die Verbindung mit Datenbank nicht schliessen!\'); - } - - $daten = mysqli_fetch_array(db_query("SELECT domain,seitenname,waehrung,betreibermail,cron_pw FROM ".$db_prefix."_seitenkonfig ")); - // Domain (ohne Slash am Ende) - $domain = $daten[\'domain\']; - // Seitenname - $seitenname = $daten[\'seitenname\']; - // Seitenwährung - $waehrung = $daten[\'waehrung\']; - // ID vom Admin - $admin_id = 1; - // Adminmail - $betreibermail = $daten[\'betreibermail\']; - // Passwort für Crons - $cron_pw = $daten[\'cron_pw\']; - // beliebiger Alphanumerischer String hilft beim Schutz vor Autoklickern - $percode = \'551c3d4318d668cc2b00d02b40d1e6cd282817c2be65d401ed0cff2e6b\'; - /* Globale Variablen nichts ändern */ - $ip = $_SERVER[\'REMOTE_ADDR\']; - ?> - '; - - $datei = fopen("../lib/datenbank.inc.php","w"); - fwrite($datei, $inhalt,100000); - fclose($datei); -} - if($_GET['step'] == 4 && $_GET['db'] == true){ require_once('../lib/datenbank.inc.php'); diff --git a/lib/class/chat.class.php b/lib/class/chat.class.php index 0dba0a49383dc3169e0bd0d79f6f78337ea213e9..22859c2d28d78c1ed7e03599477595cd4569dd99 100644 --- a/lib/class/chat.class.php +++ b/lib/class/chat.class.php @@ -2,10 +2,9 @@ class chatClass{ public static function getRestChatLines($id){ - global $db_host,$db_user,$db_pass,$db_base; $arr = array(); $jsonData = '{"results":['; - $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); + $db_connection = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_BASE ); $db_connection->query( "SET NAMES 'UTF8'" ); $statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? "); $statement->bind_param( 'i', $id); @@ -27,8 +26,7 @@ class chatClass{ } public static function setChatLines( $chattext, $usrname, $color) { - global $db_host,$db_user,$db_pass,$db_base; - $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); + $db_connection = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_BASE ); $db_connection->query( "SET NAMES 'UTF8'" ); $statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)"); $statement->bind_param( 'sss', $usrname, $color, $chattext); @@ -37,4 +35,4 @@ class chatClass{ $db_connection->close(); } } -?> \ No newline at end of file +?> diff --git a/lib/datenbank.inc.php b/lib/datenbank.inc.php index e015e84fb8ce89951a98eac8f0731a60999af82f..f5b3890db0edccf2b29a2d12a3607e7e8bea2b20 100644 --- a/lib/datenbank.inc.php +++ b/lib/datenbank.inc.php @@ -1,24 +1,16 @@ - <?php - $db_host = "localhost"; - // Mysql User - $db_user = ""; - // Mysql PW - $db_pass = ""; - // Datenbank - $db_base = ""; - //Datenbank Prefix - $db_prefix = "vms"; - +<?php + require_once( __DIR__ .'/db_config.php'); //Passwort zusatz - $pw_zusatz = ''; + $pw_zusatz = 'fg65en'; // Verschlüsselungspasswort - $ver_schluessel = ''; + $ver_schluessel = 'libh5476H6G4v0TB'; //Datenbankverbindung herstellen - $sql_open = @mysqli_connect($db_host, $db_user, $db_pass, $db_base) or die('Verbindung zum Mysql Server fehlgeschlagen! <br>Tipp: <a href="http://www.vms-tutorial.de/wiki//Lib/Functions">http://www.vms-tutorial.de/wiki//Lib/Functions</a>'); - $sql_base = @mysqli_select_db($sql_open,$db_base) or die("Keine oder falsche Datenbank gewhlt! Tipp: <br><a href='http://www.vms-tutorial.de/wiki//Lib/Functions'>http://www.vms-tutorial.de/wiki//Lib/Functions</a>"); - + $sql_open = @mysqli_connect( DB_HOST, DB_USER, DB_PASS, DB_BASE ) or die('Verbindung zum Mysql Server fehlgeschlagen! <br>Tipp: <a href="http://www.vms-tutorial.de/wiki//Lib/Functions">http://www.vms-tutorial.de/wiki//Lib/Functions</a>'); + // why?: + $sql_base = @mysqli_select_db($sql_open, DB_BASE ) or die("Keine oder falsche Datenbank gewhlt! Tipp: <br><a href='http://www.vms-tutorial.de/wiki//Lib/Functions'>http://www.vms-tutorial.de/wiki//Lib/Functions</a>"); + /** * db_connect() *