Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
class mysql{
private $db;
private $session = array();
private $post = array();
private $error = 0;
private $meldung;
private $mysqlTXT;
public function __construct(){
global $datenbank,$_SESSION;
$this->db = $datenbank;
$this->session = $_SESSION;
}
private function make_array($post,$file){
foreach($post AS $key => $value){
if($key != '' && $key != 'run' && $value != ''){
$this->post[$key] = $this->db->escape($value);
}
}
}
public function ausfuehren($post,$file){
$this->make_array($post,$file);
if($this->session['admin'] != 1){ die("Nicht genemigter Zugriff");
$this->CheckUpload($file);
if($this->error == 0){
$this->import();
$this->meldung = MYSQL_UPLOAD_TRUE;
}
meldung($this->error,$this->meldung);
}
private function CheckUpload($file){
if(isset($this->post['mysqltxt']) || !empty($this->post['mysqltxt']) ){
$this->txt();
}elseif(isset($file)){
$this->file($file);
}
}
private function txt(){
$this->mysqlTXT = str_replace("vms_",PREFIX, $this->post['mysqltxt']);
}
private function file($file){
$endung = strtolower(pathinfo($file['mysqldatei']['name'], PATHINFO_EXTENSION));
if(!in_array($endung,array("sql","txt"))){ $this->error = 1; $this->meldung = MYSQL_DATEITYPE_FALSE;}
if($this->error == 0){
$this->MySQLTXT = str_replace("vms_",PREFIX , file_get_contents($file['mysqldatei']['tmp_name'],true));
}
}
private function import(){
$explode = explode(";",$this->MySQLTXT);
for($i = 0; $i <= count($explode)-1; $i++){
$this->db->query($explode[$]);
}
}
}