public function writeStationConf($Sc_serv_conf_id) { # Einlesen der Daten für SC_Serv $Sc_Serv_conf = \DB::queryFirstRow("SELECT * FROM sc_serv_conf WHERE id=%s", $Sc_serv_conf_id); # Proof if Dir exist if (is_dir("userconf/" . $Sc_Serv_conf['PortBase']) == false) { $this->creatDirHome($Sc_Serv_conf['PortBase']); } # ColumList aus der Datenbank $columns = \DB::columnList('sc_serv_conf'); $Sc_Serv['conf'] = ''; # Array für die Spalte # Datei öffnen $datei = fopen("userconf/" . $Sc_Serv_conf['PortBase'] . "/sc_serv.conf", "w+"); foreach ($columns as $column) { $Sc_Serv['conf'][$column] = $Sc_Serv_conf[$column]; # Speichert alles in einem Array für Fehlerauswerung } foreach ($Sc_Serv['conf'] as $name => $wert) { if ($name == 'id' or $wert == '') { } else { fwrite($datei, $name . '=' . $wert . "\r\n"); } } fclose($datei); # Datei schließen }
public function writeSc_TransConf($Sc_serv_conf_id) { # Einlesen der Daten für SC_Serv $Sc_Serv_conf = \DB::queryFirstRow("SELECT * FROM sc_trans_conf WHERE id=%s", $Sc_serv_conf_id); # Proof if Dir exist if (is_dir("userconf/" . $Sc_Serv_conf['serverport']) == false) { $this->creatDirHome($Sc_Serv_conf['serverport']); } # ColumList aus der Datenbank $columns = \DB::columnList('sc_trans_conf'); $Sc_Serv['trans'] = ''; # Array für die Spalte # Datei öffnen $datei = fopen($_SERVER['DOCUMENT_ROOT'] . '/userconf/' . $Sc_Serv_conf['serverport'] . '/sc_trans.conf', 'w'); foreach ($columns as $column) { $Sc_Serv['trans'][$column] = $Sc_Serv_conf[$column]; # Speichert alles in einem Array für Fehlerauswerung } foreach ($Sc_Serv['trans'] as $name => $wert) { if ($name == 'id' or $wert == '') { } else { fwrite($datei, $name . '=' . $wert . "\r\n"); } } // DJ Konfiguration in de SC_Trans schreiben $sc_rel_id = \DB::queryFirstRow("SELECT id FROM sc_rel WHERE sc_serv_conf_id=%s AND sc_trans_id=%s", $Sc_serv_conf_id, $Sc_Serv_conf['id']); $dj_prio_Data = \DB::query("SELECT * FROM dj_accounts WHERE dj_of_sc_rel_id=%s", $sc_rel_id['id']); $merker = '1'; foreach ($dj_prio_Data as $row) { $userConf = \DB::queryFirstRow("SELECT * FROM accounts WHERE id=%s", $row['dj_accounts_id']); fwrite($datei, 'djlogin_' . $merker . '=' . $userConf['kundennummer'] . "\r\n"); fwrite($datei, 'djpassword_' . $merker . '=' . $userConf['dj_clearpass'] . "\r\n"); fwrite($datei, 'djpriority_' . $merker . '=' . $row['dj_prio'] . "\r\n"); $merker++; } fclose($datei); # Datei schließen }
?> </h3> <a href="javascript:parent.jQuery.fancybox.close();" class="btn">Close</a> <div style="float: right; margin-bottom: 10px"> <label style="display: inline-block; margin-right: 50px"><input type="checkbox" id="autoopen" style="vertical-align: baseline"> auto-open next field</label> <button id="enable" class="btn"><?php echo $txtEnableButton; ?> </button> </div> <table id="editform" class="table table-bordered table-striped table-hover"> <tbody> <?php $FieldType = explode(',', $strFieldType); $record = DB::queryFirstRow("SELECT * FROM {$db_Table} WHERE {$arrFieldNames['0']}=%i", $key); $columns = DB::columnList($db_Table); $count = count($columns); for ($i = 0; $i <= $count - 1; $i++) { if (substr($strDisplayViewEdit, $i, 1) == 1 || substr($strDisplayViewEdit, $i, 1) == 2 || substr($strDisplayViewEdit, $i, 1) == 3) { if (substr($strRequired, $i, 1) == 1) { $required = "<font color='red'>*</font>"; } else { $required = ''; } echo '<tr><td id="fieldnames" class="editfieldname">' . $arrFieldNames[$i] . ':' . $required . '</td>'; // check if field type is checkkist or select2 and see if it needs to be unserialized if (!empty($FieldType[$i]) && $FieldType[$i] == 'checklist' || $FieldType[$i] == 'select2') { $data = @unserialize($record[$arrFieldNames[$i]]); if ($data !== false || $record[$arrFieldNames[$i]] === 'b:0;') { $record[$arrFieldNames[$i]] = json_encode(unserialize($record[$arrFieldNames[$i]])); $remove = array('[', ']', '"');
function test_5_insert_blobs() { DB::query("CREATE TABLE `store data` (\n `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n `picture` BLOB\n ) ENGINE = InnoDB"); $columns = DB::columnList('store data'); $this->assert(count($columns) === 2); $this->assert($columns[1] === 'picture'); $smile = file_get_contents('smile1.jpg'); DB::insert('store data', array('picture' => $smile)); DB::queryOneRow("INSERT INTO %b (picture) VALUES (%s)", 'store data', $smile); $getsmile = DB::queryFirstField("SELECT picture FROM %b WHERE id=1", 'store data'); $getsmile2 = DB::queryFirstField("SELECT picture FROM %b WHERE id=2", 'store data'); $this->assert($smile === $getsmile); $this->assert($smile === $getsmile2); }
</style> <?php require_once 'includes/MeekroDB/meekrodb.2.1.class.php'; DB::debugMode(); DB::$user = '******'; DB::$password = '******'; DB::$dbName = 'a1-sales'; $dbTable = 'customers'; DB::$port = '3307'; $mysqli_result = DB::queryRaw("SELECT * FROM " . $dbTable); $row = $mysqli_result->fetch_assoc(); $field_cnt = count($row); echo "FieldCount = " . $field_cnt . "<br>"; $columns = DB::columnList('customers'); echo "COPY THIS STRING FOR THE FIELD NAMES: "; foreach ($columns as $column) { echo "{$column}\n,"; } echo "<br>"; /* Get field information for all columns */ $finfo = $mysqli_result->fetch_fields(); echo "1) length is the Max-length allowed in that field" . "<br>"; echo "2) Max-length is the longest string in that field" . "<br>"; echo "3) Type is the mySQLi Field Tyoe" . "<br>"; echo "<table class='table'>"; echo "<tr class='details'>"; echo "<td>#</td><td>NAME</td><td>length</td><td>Max-length</td><td>Type</td>"; echo "</tr>"; $a = 1;
$where = new WhereClause('and'); // create a WHERE statement of pieces joined by ANDs $where->add($arrWhere[0], $arrWhere[1]); //$results = DB::query("SELECT * FROM $db_Table WHERE %l ", $where->text()); $results = DB::query("SELECT * FROM {$db_Table} WHERE {$arrWhere['0']}", $arrWhere[1]); } else { if (!empty($db_OrderBy)) { $results = DB::query("SELECT * FROM {$db_Table} ORDER BY {$db_OrderBy}"); } else { $results = DB::query("SELECT * FROM {$db_Table}"); } } } // SETTING DEFAULTS IF NOT SET IN CONFIG //Lets get the FieldNames, FieldCount and RcordCount $arrFieldNames = DB::columnList($db_Table); $intFieldCount = count($arrFieldNames); $intRecordCount = DB::count(); // The Real_Field Names from the db // Used for Readinf Writting To and From the db $Field_Names = $arrFieldNames; //Defined FIELD NAMES from Config // Used for display onlu if (!empty($strFieldNames)) { $FieldNames = explode(',', $strFieldNames); } else { $FieldNames = $Field_Names; } if (empty($db_ImageFieldName)) { $db_ImageFieldName = null; }
<!DOCTYPE html> <html lang="en"> <head> <title>Simple-ConnectDB</title><?php // get id of record from db_List.php $key = $_GET['id']; require_once 'includes/db_Config.php'; require_once 'includes/db_Language.php'; require_once 'includes/db_Connection.php'; $db_Page = 'db_Delete'; require_once 'includes/db_Functions.php'; if (empty($dbCanDelete)) { $dbCanDelete = 0; } if ($dbCanDelete == 1) { // lets get the Record ID Field $names = DB::columnList($db_Table); echo "Key = ", $key, "<br>"; echo "ID = ", $names[0], "<br>"; //DB::debugMode(); // delete the Record DB::delete($db_Table, $names[0] . "=%i", $key); header("Location: index.php"); } else { header("Location: noRights.php"); }