-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserController.php
More file actions
59 lines (46 loc) · 1.44 KB
/
UserController.php
File metadata and controls
59 lines (46 loc) · 1.44 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
include_once("../service/UserService.php");
include_once("../domain/UserClass.php");
header("Content-type: text/html; charset=utf-8");
$userService = new UserService();
$type = $_POST['type'];
//添加一个客户
if($type == 'addUser') {
//获得用户输入的信息
$name = $_POST['name'];
$nickname= $_POST['nickname'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$authority = $_POST['authority'];
if($password == $password2) {
$user = new User();
$user->setName($name);
$user->setNickname($nickname);
$user->setPassword($password);
$user->setEmail($email);
$user->setAuthority($authority);
//调用UserService类
/* $userService = new UserService();*/
if($userService->addUser($user)){
$id = $userService->getUserId($name);
var_dump($id);
/*header("Location:../view/login.php?id='$id'");*/
header("Location:../view/register.php?id='$id'");
}else{
header("Location:../view/register.php?register_message=errordb");
}
}else{
header("Location:../view/register.php?register_message=error_password");
}
}
//获取客户信息列表
if($type == 'getCustomers'){
//获得客户列表 2014年6月15日 16:42:37 xiaoxin
$result = $userService->getCustomers();
session_start();
$_SESSION [ 'allCustomers' ] = $result;
//var_dump($result);
header("Location:../viewBack/back-customer.php");
}
?>