public function new_teacher_() { eval(USER); try { $data['name'] = bassert($this, safepost('name'), Error('post')); $data['organization'] = bassert($this, safepost('organization'), Error('post')); $data['job'] = bassert($this, safepost('job'), Error('post')); $data['email'] = bassert($this, safepost('email'), Error('post')); $data['phone'] = bassert($this, safepost('phone'), Error('post')); $res = DBModel::insertDB('cernet_teacher', $data); $config = C('TMPL_PARSE_STRING'); $root = $config['__ROOT__']; header("Location: {$root}/User/new_team"); } catch (Exception $e) { $this->error($e->getMessage(), lastpage()); } }
/** * Password find back handle function. * Usertype: Student */ public function nopassword_() { try { require 'powerdream/Common/Mail.class.php'; $cond['email'] = xassert(safepost('email'), Error('post')); $random = rand(0, 100) . ' This is a salt.'; $pwd = substr(encrypt($random), 0, 8); $data['password'] = encrypt($pwd); if (!DBModel::existUser('cernet_user', $cond)) { $this->error(Error('email'), lastpage()); } else { DBModel::updateDB('cernet_user', $cond, $data); $user = DBModel::selectDB('cernet_user', $cond); $user = $user[0]; $mailto = $cond['email']; $replace['[#password]'] = $pwd; $replace['[#username]'] = $user['username']; $content = Mail::contentTemplate('nopassword'); Mail::autosend($mailto, $content, $replace); $this->success(Success('nopassword'), '__ROOT__'); } } catch (Exception $e) { bassert($this, false, $e->getMessage()); } }