Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phith0n/ctfdbbuilder
a database query builder for CTFer(出题专用/开发阶段/慎用)
https://github.com/phith0n/ctfdbbuilder
Last synced: 2 months ago
JSON representation
a database query builder for CTFer(出题专用/开发阶段/慎用)
- Host: GitHub
- URL: https://github.com/phith0n/ctfdbbuilder
- Owner: phith0n
- Created: 2018-05-24T08:21:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-28T04:02:32.000Z (over 6 years ago)
- Last Synced: 2024-10-14T11:19:39.664Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 32
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DB Builder for CTFer
一个无任何防护的PHP数据库Builder,支持Mysql/Postgresql/Sqlite。
## Install
```
composer require phith0n/ctfdbbuilder:dev-master
```## Usage
```php
'mysql', // Db driver
'host' => 'localhost',
'database' => 'your-database',
'username' => 'root',
'password' => 'your-password',
'charset' => 'utf8mb4', // Optional
'options' => [ // PDO constructor options, optional
\PDO::ATTR_TIMEOUT => 5,
\PDO::ATTR_EMULATE_PREPARES => false,
],
]);
$builder = $connect->getBuilder();
```### Select (SQL injection)
```php
table('articles')->where('id', '=', $_GET['id'])->first();
``````php
table('users')->where('age', '>', $_GET['age'])->first();
``````php
table('users')->orderBy('age', 'desc')->get();
``````php
table('users')->select('COUNT() AS `cnt`')->first();
``````php
table('users')->where('username', $_POST['username'])->where('password', md5($_POST['password']))->first();
```