Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server > Flyff PServer Guides & Releases
You last visited: Today at 10:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PHP Datenbankklasse mit Escapefunktion

Discussion on PHP Datenbankklasse mit Escapefunktion within the Flyff PServer Guides & Releases forum part of the Flyff Private Server category.

Reply
 
Old   #1
 
xsrf's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 871
Received Thanks: 642
PHP Datenbankklasse mit Escapefunktion



Datenbankklasse:

Features:
  • automatisierte Query Construction
  • automatisierte Escape Funktion
  • dynamische Verwaltung
  • sehr simple Anwendung

Anwendung:

Allgemein:
PHP Code:
require_once('class.Database.php'); 
PHP Code:
Man übergibt ein Array ähnlich wie bei Timmy welches auf dem Standart Port 1433 läuft und nur über SQLEXPRESS

new Database($config['mssqlCredentials']);

oder für fortgeschrittene Entwickler auch einen ganzen Connectionstring:

new 
Database(odbc_connect('Driver={SQL Server};Server=' HOSTNAME;Port=PORT', 'USERNAME', 'PASSWORT', ...)); 
PHP Code:
class YourClass extends Database {} 
________________________________________________

Update:
PHP Code:
//Ihr könnt einfach bei einem Formular das $_POST Array übergeben.

self::Update($_POST'Account''account_tbl);

//Update($mixedInput, $usedDatabase, $table) 
Insert:
PHP Code:

//Ihr könnt einfach bei einem Formular das $_POST Array übergeben.

self::Insert($_POST'Account''account_tbl);

//Insert($mixedInput, $usedDatabase, $table) 
Select:
PHP Code:
$search = array('account''password''dcoins');


self::Select($search'Account''account_tbl')
 
!!! 
Wenn ihr KEINEN Vergleichswert benötigt lasst $mixedWhere einfach wegansonsten: !!!

$where = array('id' => 1,'character' => 'AMAZEN');

self::Select($search'Account''account_tbl'$_POST);
oder
self
::Select($search'Account''account_tbl');
//Select($mixedInput, $usedDatabase, $table, $mixedWhere = false) 

Credits:

- Datenbankklasse: AMAZEN


xsrf is offline  
Thanks
2 Users
Old 08/22/2015, 14:41   #2



 
Sedrika's Avatar
 
elite*gold: 18
The Black Market: 103/0/0
Join Date: Sep 2009
Posts: 20,174
Received Thanks: 14,475
Die Validierungen sind ok, aber ich würde die Werte alle, ausgenommen integer, als Hex an die Datenbank weiterleiten.

In PHP folgend:
Code:
<?php
'0x'.bin2hex( $input );
?>
Dann interpritiert der SQL Server nichts mehr als Befehl und du kannst sogar den Shutdown Befehl abschicken, was zwar sinnfrei wäre aber möglich.

Absolutes Escapen halt in einem Befehl
Sedrika is offline  
Thanks
7 Users
Old 08/22/2015, 14:50   #3
 
xsrf's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 871
Received Thanks: 642
Muss jetzt leider los. Werde es mir bei Gelegenheit mal ansehen, danke

Das:

PHP Code:
private function InputCheck($mixedInput){
        foreach(
$mixedInput as $key => $value){
            
$mixedInput[$key] = self::Secure($value);
        }
        return 
$mixedInput;
    } 
wurde zu dem:

PHP Code:
private function InputCheck($mixedInput){
        foreach(
$mixedInput as $key => $value){
            if(
gettype($value) != 'integer'){
                
$mixedInput[$key] = htmlspecialchars($value);
                
$mixedInput[$key] = htmlentities($value);
                
$mixedInput[$key] = strip_tags($value);
                
$mixedInput[$key] = '0x'.bin2hex($value);
            }else {
                
$mixedInput[$key] = $value;
            }
        }
        return 
$mixedInput;
    } 
Außerdem wurden die Escape Funktionen entfernt da diese nun nicht mehr benötigt werden.
xsrf is offline  
Reply




All times are GMT +1. The time now is 10:37.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.