-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSign.php
More file actions
53 lines (47 loc) · 1.4 KB
/
Copy pathSign.php
File metadata and controls
53 lines (47 loc) · 1.4 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
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sign extends QB_Controller {
public function index(){
$args_header = array(
'title'=>'sign-index'
);
$this->render('common/header',$args_header);//todo 放到角落中去
$this->render();
$this->render('common/footer');//todo 放到角落中去
}
//邮箱登录
public function in(){
$email = $this->input->post('email');
$password = $this->input->post('password');
if(empty($email) || empty($password)){
show_error('Email or Password is empty');
}
$this->load->model("User");
$user = $this->User->find($email,$password);
if(!$user){
$url = $this->url('sign','in');
header( "refresh:5;url=$url" );
}else{
session_start();
$url = $this->url('home','index','&from=sign-in&uid='.$user->id);
redirect($url);
}
}
//邮箱注册
public function up(){
$email = $this->input->post('email');
$password = $this->input->post('password');
if(empty($email) || empty($password)){
show_error('Email or Password is empty');
}
$this->load->model("User");
$user_exist = $this->User->exist($email);
if($user_exist){
die('user exist');
}
$user_id = $this->User->create($email,$password);
//todo set session_start;
$url = $this->url('home','index','&from=sign-up&uid='.$user_id);
redirect($url);
}
}