diff --git a/.gitignore b/.gitignore
index 0dc8f54..c025c01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,7 @@ phpMyAdmin/
application/config/config.php
application/config/database.php
application/config/email.php
-assets/images/*
+# assets/images/*
assets/images/!essentials/
node_modules/
*/config/development
@@ -14,5 +14,6 @@ node_modules/
*/cache/!.htaccess
# Custom
+*.json
*.swp
*.mp4
diff --git a/application/config/constants.php b/application/config/constants.php
index 8798abf..e856e53 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -45,23 +45,45 @@
*
*/
+// $PROVINCES = array(
+// '北京地区(北京市)',
+// '天津地区(天津市)',
+// '河北地区(河北省)',
+// '东北地区(黑龙江省、吉林省、辽宁省、内蒙古自治区)',
+// '山东地区(山东省)',
+// '山西地区(山西省)',
+// '其他地区(其他省、市、自治区)'
+// );
+// $PROVINCES_SHORT = array(
+// '北京地区',
+// '天津地区',
+// '河北地区',
+// '东北地区',
+// '山东地区',
+// '山西地区',
+// '其他地区'
+// );
+
+//edit in 2023.
$PROVINCES = array(
- '北京地区(北京市)',
- '天津地区(天津市)',
- '河北地区(河北省)',
- '东北地区(黑龙江省、吉林省、辽宁省、内蒙古自治区)',
- '山东地区(山东省)',
- '山西地区(山西省)',
- '其他地区(其他省、市、自治区)'
+ '华北地区一(京、津)',
+ '华北地区二(冀、鲁、晋)',
+ '东北地区(黑、吉、辽、内蒙古)',
+ '西北地区(陕、甘、宁、青、新)',
+ '西南地区(云、贵、川、渝、藏)',
+ '华中地区(鄂、湘、赣、豫)',
+ '华南地区(粤、桂、琼、闽)',
+ '华东地区(沪、苏、浙、皖)'
);
$PROVINCES_SHORT = array(
- '北京地区',
- '天津地区',
- '河北地区',
+ '华北地区一',
+ '华北地区二',
'东北地区',
- '山东地区',
- '山西地区',
- '其他地区'
+ '西北地区',
+ '西南地区',
+ '华中地区',
+ '华南地区',
+ '华东地区'
);
/*
@@ -76,7 +98,8 @@
'202' => '用户尚未通过审核,请您稍后登录!',
'204' => '用户不存在,请注册!',
'205' => '注册已截止',
- '400' => '存在不合法输入,请检查手机号、邮箱等信息是否正确填写!',
+ '206' => '您已开始报名,不能修改资料!',
+ '400' => '存在不合法输入,或者邮箱已被使用。请检查信息是否正确填写!如有疑问请联系我们。',
'401' => '密码错误,请重新输入!',
// Individual Registration Error.
'999' => '人员名单不能为空。',
@@ -140,6 +163,7 @@
$ID_TYPE = array(
'identity' => '身份证',
'passport' => '护照',
+ 'taiwan' => '台胞证'
);
$IFRACE = array(
@@ -172,14 +196,25 @@
'1' => '参赛'
);
+// race == mountain-bike; rdb == road-bike!!
+
+// $RACE_M_QUOTA = 190;
+// $RACE_ELITE_QUOTA = 190;
+// $RACE_F_QUOTA = 190;
+// $RDB_M_QUOTA = 150;
+// $RDB_F_QUOTA = 55;
+// $RDB_ELITE_QUOTA = 75;
+// $RACE_TEAM_QUOTA = 60;
-$RACE_M_QUOTA = 190;
-$RACE_ELITE_QUOTA = 190;
-$RACE_F_QUOTA = 190;
-$RDB_M_QUOTA = 150;
-$RDB_F_QUOTA = 55;
-$RDB_ELITE_QUOTA = 75;
+// edit in 2023
+$RACE_M_QUOTA = 30;
+$RACE_ELITE_QUOTA = 30;
+$RACE_F_QUOTA = 30;
+$RDB_M_QUOTA = 180;
+$RDB_F_QUOTA = 60;
+$RDB_ELITE_QUOTA = 50;
$RACE_TEAM_QUOTA = 60;
+// team race to be updated.
$AUDIENCE_QUOTA = 230;
$AUD_QUOTA_PER_SCHOOL = 3;
@@ -200,8 +235,8 @@
* Date and Time Settings
*/
-$SIGN_UP_DEADLINE = '2019-06-21';
-
+$SIGN_UP_DEADLINE = '2023-05-04';
+$REGISTRATION_START = '2023-05-06 09:00:00';
/*
* Admin user list
*/
diff --git a/application/config/form_validation.php b/application/config/form_validation.php
index 8975529..0c8a623 100644
--- a/application/config/form_validation.php
+++ b/application/config/form_validation.php
@@ -59,6 +59,33 @@
'label' => '密码',
'rules' => 'required|md5'
)
+ ),
+ 'edit' => array(
+ array(
+ 'field' => 'school',
+ 'label' => '学校',
+ 'rules' => 'required|xss_clean'
+ ),
+ array(
+ 'field' => 'leader',
+ 'label' => '领队',
+ 'rules' => 'required|xss_clean'
+ ),
+ array(
+ 'field' => 'tel',
+ 'label' => '联系电话',
+ 'rules' => 'required|exact_length[11]|xss_clean'
+ ),
+ array(
+ 'field' => 'association_name',
+ 'label' => '车协名称',
+ 'rules' => 'trim|required|xss_clean'
+ ),
+ array(
+ 'field' => 'province',
+ 'label' => '所在地区',
+ 'rules' => 'required|xss_clean'
+ )
)
);
diff --git a/application/controllers/admin.php b/application/controllers/admin.php
index 57f07bd..78fd6d5 100644
--- a/application/controllers/admin.php
+++ b/application/controllers/admin.php
@@ -81,9 +81,9 @@ public function pay() {
}
}
- public function confirm() {
+ public function unstarted() {
if ($this->input->server('REQUEST_METHOD') == 'GET') {
- $data['unconfirmed'] = $this->user->get_unconfirmed();
+ $data['unstarted'] = $this->user->get_unstarted();
$this->load->view('header_admin');
$this->load->view('admin_confirm', $data);
$this->load->view('footer_admin');
@@ -120,8 +120,9 @@ public function logout() {
}
public function info() {
- $data['nschools'] = $this->db->query('select count(*) as nschools from users where activated=1 and confirmed=1;')->result_array()[0]['nschools'];
- $data['nverified'] = $this->db->query('select count(*) as nverified from users where editable=0 and activated=1 and confirmed=1;')->result_array()[0]['nverified'];
+ $data['nschools'] = $this->db->query('select count(*) as nschools from users where activated=1;')->result_array()[0]['nschools'];
+ $data['nstart'] = $this->db->query('select count(*) as nstart from users where activated=1 and start_register=1;')->result_array()[0]['nstart'];
+ $data['nverified'] = $this->db->query('select count(*) as nverified from users where editable=0 and activated=1 and start_register=1;')->result_array()[0]['nverified'];
$data['npaid'] = $this->db->query('select count(*) as npaid from users where paid=1;')->result_array()[0]['npaid'];
$data['nlook'] = $this->db->query('select count(*) as nlook from people where deleted=0 and ifrace=0;')->result_array()[0]['nlook'];
$data['nrace'] = $this->db->query('select count(*) as nrace from people where deleted=0 and ifrace=1;')->result_array()[0]['nrace'];
diff --git a/application/controllers/registration.php b/application/controllers/registration.php
index df70cf6..ad6efb4 100644
--- a/application/controllers/registration.php
+++ b/application/controllers/registration.php
@@ -20,32 +20,47 @@ function __construct()
$this->load->model('team_model', 'team');
$this->load->model('user_model', 'user');
$this->load->model('info_model', 'info');
-
+
if (! $this->session->userdata('logged_in')) {
redirect(site_url('user/login'), 'refresh');
}
-
+
if (! $this->session->userdata('editable')) {
redirect(site_url('user/result'));
}
}
-
+
public function index() {
- $this->load->view('header_homepage');
- $this->load->view('add_hilight_nav2');
- $query = $this->info->get_info('register-readme');
- $data = array(
- 'text' => $query['text'],
- 'publish' => $query['isdraft']
- );
- $this->load->view('registration_index', $data);
- $this->load->view('footer');
+
+ date_default_timezone_set('PRC');
+
+ if ($this->input->server('REQUEST_METHOD') == 'GET') {
+ $this->load->view('header_homepage');
+ $this->load->view('add_hilight_nav2');
+ $query = $this->info->get_info('register-readme');
+ $data = array(
+ 'text' => $query['text'],
+ 'publish' => $query['isdraft']
+ );
+ $this->load->view('registration_index', $data);
+ $this->load->view('footer');
+ }
+ if ($this->input->server('REQUEST_METHOD') == 'POST') {
+ $id = $this->session->userdata('id');
+ header('Content-Type: application/json');
+ $this->user->start_register($id);
+ $this->session->set_userdata('start_register', TRUE);
+ exit();
+ }
}
/*
- * This method let the users register individuals.
+ * This method let the users register individuals.
*/
public function individual() {
+ if (! $this->session->userdata('start_register')) {
+ redirect(site_url('registration/index'));
+ }
if ($this->input->server('REQUEST_METHOD') == 'GET') {
$quota_results = $this->people->get_race_quota();
$this->load->view('header_homepage');
@@ -292,6 +307,9 @@ public function individual() {
* This method let the users register teams.
*/
public function team() {
+ if (! $this->session->userdata('start_register')) {
+ redirect(site_url('registration/index'));
+ }
$school_id = $this->session->userdata('id');
if ($this->input->server('REQUEST_METHOD') == 'GET') {
$data['male'] = $this->people->get_male_athlete_from_school($school_id);
diff --git a/application/controllers/user.php b/application/controllers/user.php
index a409e7f..76c0273 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -27,8 +27,8 @@ function __construct()
public function login() {
//for link to CUCA in 2019 User: DetectiveHelen Date: 19/5/8
- header("Location: http://ucenter.hiwedo.cn/index.php?p=24&a=view&r=20");
- exit();
+ // header("Location: http://ucenter.hiwedo.cn/index.php?p=24&a=view&r=20");
+ // exit();
if ($this->input->server('REQUEST_METHOD') == 'GET') {
if ($this->session->userdata('logged_in')) {
@@ -56,8 +56,8 @@ public function login() {
$err_code = '204';
} elseif (!$user_info['activated']) {
$err_code = '201';
- } elseif (!$user_info['confirmed']) {
- $err_code = '202';
+ // } elseif (!$user_info['confirmed']) {
+ // $err_code = '202';
} elseif ($login_info['password'] != $user_info['password']) {
$err_code = '401';
} else {
@@ -66,6 +66,7 @@ public function login() {
$this->session->set_userdata('id', $user_info['id']);
$this->session->set_userdata('school', $user_info['school']);
$this->session->set_userdata('editable', $user_info['editable']);
+ $this->session->set_userdata('start_register', $user_info['start_register']);
}
exit(err_msg($err_code));
@@ -79,14 +80,16 @@ public function logout() {
$this->session->unset_userdata('logged_in');
$this->session->unset_userdata('id');
$this->session->unset_userdata('school');
+ $this->session->unset_userdata('editable');
+ $this->session->unset_userdata('start_register');
redirect(base_url(), 'refresh');
}
public function signup() {
- //for link to CUCA in 2019 User: DetectiveHelen Date: 19/5/8
- header("Location: http://ucenter.hiwedo.cn/index.php?p=24&a=view&r=20");
- exit();
+ // //for link to CUCA in 2019 User: DetectiveHelen Date: 19/5/8
+ // header("Location: http://ucenter.hiwedo.cn/index.php?p=24&a=view&r=20");
+ // exit();
date_default_timezone_set('PRC');
@@ -196,7 +199,7 @@ public function activate() {
$status = $this->user->activate($token);
$data = array('info' => '');
if ($status == 0)
- $data['info'] = '激活成功!请等待北大车协同学线下联系,我们将于 24 小时内完成您的注册审核,审核通过之后车协同学将通知您。谢谢!';
+ $data['info'] = '激活成功!请等待报名开始,报名开始时间为' . $GLOBALS['REGISTRATION_START'] . '。
在您开始报名之前,您可以修改注册时填写的信息。';
elseif ($status == 1)
$data['info'] = '激活码无效或您已成功激活。';
elseif ($status == 2)
@@ -205,6 +208,38 @@ public function activate() {
$this->load->view('activate_footer');
}
+ /*
+ * Edit the account.
+ */
+ public function edit() {
+ $id = $this->session->userdata('id');
+ $user_info = $this->user->get_user_by_id($id);
+ if ($this->input->server('REQUEST_METHOD') == 'GET') {
+ if (! $this->session->userdata('logged_in')) {
+ redirect(site_url('user/login'));
+ }
+ $this->load->view('header_homepage');
+ $this->load->view('add_hilight_nav2');
+ $this->load->view('edit_form', $user_info);
+ $this->load->view('footer');
+ }
+
+ if ($this->input->server('REQUEST_METHOD') == 'POST') {
+ $data = $this->input->post();
+ header('Content-Type: application/json');
+
+ if ($this->form_validation->run('edit') == false) {
+ $err_code = '400';
+ } elseif ($user_info['start_register']) {
+ $err_code = '206';
+ } else {
+ $err_code = '200';
+ $this->user->update($id, $data);
+ }
+
+ exit(err_msg($err_code));
+ }
+ }
/*
* Export an Excel file containing all the information.
*/
diff --git a/application/helpers/lib_helper.php b/application/helpers/lib_helper.php
index abb919a..e661362 100644
--- a/application/helpers/lib_helper.php
+++ b/application/helpers/lib_helper.php
@@ -160,7 +160,7 @@ function validate_mobile($tel) {
*/
if (! function_exists('validate_id_number')) {
function validate_id_number($id_number, $id_type, $gender) {
- if ($id_type == "passport") return true;
+ if ($id_type == "passport" || "taiwan") return true;
if ($id_type == "identity") {
if (strlen($id_number) == 15){
if (substr($id_number, 14, 1) % 2 == (2 - $gender)) {
diff --git a/application/libraries/MY_Email.php b/application/libraries/MY_Email.php
index 6e6da1d..bd1e1b8 100644
--- a/application/libraries/MY_Email.php
+++ b/application/libraries/MY_Email.php
@@ -48,7 +48,7 @@ public function send_mail(
$this->initialize($mail_config);
$this->set_mailtype('html');
$this->from($from_mail, $from_name);
- $this->reply_to('beidachexie@126.com', $from_name);
+ $this->reply_to('capurace@163.com', $from_name);
$this->to($to_mail);
$this->subject($subject);
$this->message($message);
@@ -59,12 +59,12 @@ public function send_mail(
* Send account confirmation email.
*/
public function send_account_confirm_mail($mail) {
- $subject = '第十六届全国高校自行车交流赛帐户确认(含ID)';
+ $subject = '第十七届全国高校自行车交流赛帐户确认(含ID)';
$token = $this->ci->user->get_token($mail);
$link = site_url('user/activate') . '/' . $token;
$id = $this->ci->user->get_id($mail);
$id_message='
贵高校本次比赛的ID是' . $id . ',请领队同学务必牢记,并在比赛签到时出示。
祝好!
北京大学自行车协会';
- $message = '请点击以下链接激活帐户' . $link . $id_message;
+ $message = '请点击以下链接激活帐户 ' . '' . $link . '' . $id_message;
$this->send_mail($mail, $subject, $message);
}
@@ -72,7 +72,7 @@ public function send_account_confirm_mail($mail) {
* Send mail after money is received.
*/
public function send_fee_received_mail($mail, $school, $fee) {
- $subject = '第十六届全国高校自行车交流赛缴费确认';
+ $subject = '第十七届全国高校自行车交流赛缴费确认';
$id = $this->ci->user->get_id($mail);
$id_message='
贵高校本次比赛的ID是' . $id . ',请领队同学务必牢记,并在比赛签到时出示。
祝好!
北京大学自行车协会';
$message = $school . ',
贵校车协交来的' . $fee . '元参赛费用已经收到,感谢你们对北大赛的大力支持!如有任何问题,请直接与各地区负责联系。' . $id_message;
diff --git a/application/models/user_model.php b/application/models/user_model.php
index d3a5bcb..5a7b662 100644
--- a/application/models/user_model.php
+++ b/application/models/user_model.php
@@ -125,18 +125,31 @@ public function get_all($order = 'school') {
return $res->result_array();
}
+ // /*
+ // * Confirm a new user.
+ // *
+ // * ====argument====
+ // * $id, the id of the user to be confirmed.
+ // *
+ // */
+ // public function confirm($id) {
+ // $confirm = array('confirmed' => TRUE);
+ // $this->db->where('id', $id)->update('users', $confirm);
+ // }
+
/*
- * Confirm a new user.
+ * A user starts registration.
*
* ====argument====
- * $id, the id of the user to be confirmed.
+ * $id, the id of the user to be tagged.
*
*/
- public function confirm($id) {
- $confirm = array('confirmed' => TRUE);
- $this->db->where('id', $id)->update('users', $confirm);
+ public function start_register($id) {
+ $start_register = array('start_register' => TRUE);
+ $this->db->where('id', $id)->update('users', $start_register);
}
+
/*
* Set the user to be paid.
* ====argument====
@@ -180,11 +193,11 @@ public function add_to_group($id, $group_name) {
}
/*
- * Get the unconfirmed users.
+ * Get the register-unstarted users.
*
*/
- public function get_unconfirmed() {
- $query = $this->db->where('confirmed', false)->where('activated', true)->order_by('province', 'asc')->get('users');
+ public function get_unstarted() {
+ $query = $this->db->where('start_register', false)->where('activated', true)->order_by('province', 'asc')->get('users');
return $query->result_array();
}
@@ -294,7 +307,7 @@ public function freeze_all() {
* This function gets all verified users.
*/
public function get_verified() {
- $query = $this->db->where('editable', 0)->where('activated', 1)->where('confirmed', 1)->where('deleted', 0)->order_by('paid', 'asc')->order_by('province', 'asc')->get('users');
+ $query = $this->db->where('editable', 0)->where('activated', 1)->where('start_register', 1)->where('deleted', 0)->order_by('paid', 'asc')->order_by('province', 'asc')->get('users');
return $query->result_array();
}
@@ -310,7 +323,7 @@ public function get_paid() {
* This function gets all users confirmed but not verified.
*/
public function get_registering() {
- return $this->db->where('confirmed', 1)->where('activated', 1)->where('editable', 1)->where('deleted', 0)->order_by('province', 'asc')->get('users')->result_array();
+ return $this->db->where('start_register', 1)->where('activated', 1)->where('editable', 1)->where('deleted', 0)->order_by('province', 'asc')->get('users')->result_array();
}
/*
diff --git a/application/views/activate_header.php b/application/views/activate_header.php
index 66bae66..7f720ba 100644
--- a/application/views/activate_header.php
+++ b/application/views/activate_header.php
@@ -3,6 +3,6 @@
手机号 | 邮寄地址 | 邮政编码 | -操作 | +||
---|---|---|---|---|---|
=$user['id']?> | =$user['school']?> | @@ -27,15 +27,15 @@=$user['tel']?> | =$user['address']?> | =$user['zipcode']?> | -+ |