blob: 3ada8b37b60bb78a39e47ff00e32aa98c3d0f5ef (
plain) (
blame)
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
32
33
34
35
36
|
<?php
/*
dbLadmin
author: wushin
License: GPL 3
*/
class dbLadmin {
public function __construct() {
$this->socket = True;
}
public function account_exists($username) {
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('tmw_accounts', array('USERNAME'), 'USERNAME = "'.$username.'"', __METHOD__, array());
foreach ($res as $row) {
return True;
}
return False;
}
public function create_account($username, $userpass, $sex, $email) {
$dbw = wfGetDB(DB_MASTER);
$dbw->insert('tmw_accounts', array('USERNAME' => $username, 'PASSWORD' => $userpass, 'GENDER' => $sex, 'EMAIL' => $email), __METHOD__, 'IGNORE');
if ( $dbw->affectedRows() ) {
return True;
} else {
return False;
}
}
public function close() {
return True;
}
}
|