/
submit_reg.php
executable file
·61 lines (49 loc) · 1.05 KB
/
submit_reg.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
include 'database_class.php';
include 'conf.php';
include 'log.php';
class register {
var $conf_file;
var $db;
var $array;
function __construct($conf_file, &$ret)
{
$this->conf_file = $conf_file;
$this->array = array();
$this->db = new DataBase($conf_file, $ret);
if ($ret == FALSE) {
return;
}
}
function generate_query_array()
{
$this->array["insert"] = TRUE;
$this->array["register"] = TRUE;
$this->array["user"] = $_POST["user_name"];
$this->array["password"] = $_POST["password1"];
}
function run()
{
$this->generate_query_array();
return $this->db->DB_request_handler($this->array);
}
function stop()
{
$this->db->DB_close_mysql();
}
}
$ret = "";
$main = new register("./conf.xml", $ret);
if ($ret == FALSE) {
exit();
}
$ret = $main->run();
if ($ret == 0) {
// printf("register sucess");
setcookie("user", $_POST["user_name"], time() + 3600);
header("Location:/main_page.php");
} else {
printf("register fail");
}
$main->stop();
?>