forked from ferchang/reg8log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_add_account.php
More file actions
43 lines (31 loc) · 1.27 KB
/
Copy pathcode_add_account.php
File metadata and controls
43 lines (31 loc) · 1.27 KB
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
37
38
39
40
41
42
43
<?php
if(ini_get('register_globals')) exit("<center><h3>Error: Turn that damned register globals off!</h3></center>");
if(!isset($parent_page)) exit("<center><h3>Error: Direct access denied!</h3></center>");
require_once $index_dir.'include/code/code_db_object.php';
require_once $index_dir.'include/func/func_random.php';
$table_name='accounts';
$field_name='uid';
require $index_dir.'include/code/code_generate_unique_random_id.php';
$autologin_key=random_string(43);
require_once $index_dir.'include/func/func_secure_hash.php';
if($_POST['password']!=='')
$fields['password']['value']=create_secure_hash($_POST['password']);
$field_names='`uid`, `autologin_key`, `timestamp`, ';
$field_values="'$rid', '$autologin_key', ".$req_time.', ';
$i=0;
unset($fields['captcha']);
$fields['password_hash']=$fields['password'];
unset($fields['password']);
foreach($fields as $field_name=>$specs) {
$field_names.="`$field_name`";
$field_values.=$reg8log_db->quote_smart($specs['value']);
if(++$i==count($fields)) break;
$field_names.=', ';
$field_values.=', ';
}
$query="insert into `accounts` ($field_names) values ($field_values)";
$reg8log_db->query($query);
unset($_SESSION['captcha_verified'], $_SESSION['passed']);
$success_msg=tr('account created msg');
$no_specialchars=true;
?>