forked from orangetw/My-CTF-Web-Challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
31 lines (21 loc) · 774 Bytes
/
config.php
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
<?php
$host = 'localhost';
$port = 5435;
$user = 'sa';
$pass = 'sa';
$dbname = '/www/h2/name';
$conn = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$pass") or die('connect error');
function error($sql){
$error = pg_last_error();
$sql .= "\n" . $error . "\n\n\n";
file_put_contents( '/www/h2/__log__.txt', $sql, FILE_APPEND|LOCK_EX );
// return $error;
return 'query error';
}
/*
CREATE TABLE users( id SERIAL PRIMARY KEY, role text NOT NULL, username text NOT NULL, password text NOT NULL, ip text NOT NULL );
INSERT INTO users(role, username,password,ip) values('user', 'orange','i_am_normal_user_too', '127.0.0.1')
*/
// $r = pg_query($_POST[sql]) or die( pg_last_error() );
// print_r( pg_fetch_object($r) );
?>