Git Product home page Git Product logo

php_pdo_ornekleri's Introduction

PHP_PDO_Ornekleri

PHP için temel konuları baz alarak, herhangi bir kütüphane kullanmaksızın sadece PDO'yu kullanarak INSERT, UPDATE, DELETE, QUERY vb. temel konular.

Proje içerisinde mümkün olduğunda HTML ve CSS karmaşasından kurtulmak için Bootstrap, Jquery vs kullanmadım. Belki ileride farklı repolar yaparak onları da dahil ederim. Burada temel olarak en basit şekilde PHP hakkında bilgi vermek istedim.


Eğer GET veya POST ile gelen veriyi ekrana basacaksanız. Bazı basit kuralları baz alabilirsiniz. Mesela noicehackerdefender.php dosyasındaki

function cleanInput($data) {
    if (is_array($data)) {
        foreach ($data as $key => $value) {
            $data[$key] = cleanInput($value);
        }
    } else {
        $data = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
    }
    return $data;
}
foreach($_POST as $key => $value) { $$key = cleanInput($value); }
foreach($_GET as $key => $value) {  $$key = cleanInput($value); }

bu kullanımda gelen özel karakterleri temizler. böylece

echo $_POST['deger'] veya $_GET['deger']

yerine direk $deger olarak kullanabilirsiniz biri

index.php?id=<img src=x onerror=prompt(/OPENBUGBOUNTY/)>

şeklinde bir veri gönderirse. arkaplanda aşağıdaki gibi işleyecek fakat görüntüde

"<img src=x onerror=prompt(/OPENBUGBOUNTY/)>"

bu şekilde gösterecektir.

&lt;img src=x onerror=prompt(/OPENBUGBOUNTY/)&gt;

Zaten veritabanı için insert, update, delete, query gibi işlemler de PDO kurallarını kullanacağımız için de bindValue yüksek oranda SQL injection saldırılarından sizi koruyacaktır.

php_pdo_ornekleri's People

Contributors

suleymanozcan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.