/
Register1.php
65 lines (55 loc) · 1.99 KB
/
Register1.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
62
63
64
65
<?php
session_start();
include_once ('smarty_init.php');
include_once 'class/Config_user.php';
/**
*
* @param string $username
*/
function is_username_exist($username)
{
include_once('class/DBtraverser.php');
include_once('class/Config.php');
include_once('class/Config_user.php');
include_once 'class/DBcount.php';
$ary = ' where '.Config_user::log_name." = '$username' ";
$myDBcount = new DBcount(Config_user::table_name, $ary);
return $myDBcount->excute_without_conn();
}
if (isset($_POST['next'])
&& $_POST['next']=="true"
){
require_once 'class/Injection.php';
$register_user = Array(
Config_user::is_seller => 1,
Config_user::is_active => 1,
Config_user::create_time=> date('Y-m-d H:i:s',time()),
Config_user::last_log=> date('Y-m-d H:i:s',time()),
Config_user::seller_credit=>5,
Config_user::payer_credit=>5,
Config_user::income=>0,
Config_user::pay=>0,
Config_user::count_publish_course=>0,
Config_user::count_publish_reward=>0,
Config_user::count_choose_course=>0,
Config_user::count_choose_reward=>0,
Config_user::log_name => Injection::excute('input_user'),
Config_user::password => Injection::excute('input_pwd')
);
if(is_username_exist(Injection::excute('input_user'))){
//if already exist
$smarty->display("Login&Register/register-1.html");
/* echo '<script type="text/javascript">
window.onload=function(){
alert("chenggong");
history.go(-1);
}</script>'; */
}else{
$_SESSION['register_user'] = $register_user;
$smarty->display("Login&Register/register-2.html");
}
}else if (isset($_POST['return'])){
$smarty->display("Login&Register/login.html");
}else {
$smarty->display("Login&Register/register-1.html");
}