public function run() { if (isset($_GET['username']) && isset($_GET['link_pass'])) { // 必要なパラメータがある // データベースを操作します。 $PrememberModel = new PrememberModel(); $userdata = $PrememberModel->check_premember($_GET['username'], $_GET['link_pass']); if (!empty($userdata) && count($userdata) >= 1) { // パラメータが合致する // 仮登録テーブルから削除して、memberへデータを挿入する $PrememberModel->delete_premember_and_regist_member($userdata); $this->title = '登録完了画面'; $this->message = '登録を完了しました。トップページよりログインしてください。'; } else { // パラメータが合致しない $this->title = 'エラー画面'; $this->message = 'このURLは無効です。'; } } else { // 必要なパラメータがない $this->title = 'エラー画面'; $this->message = 'このURLは無効です。'; } $this->file = 'premember.tpl'; $this->view_display(); }
public function run() { if (isset($_GET['mail']) && isset($_GET['link_pass'])) { $PrememberModel = new PrememberModel(); $memberdata = $PrememberModel->check_premember($_GET['mail'], $_GET['link_pass']); if (!empty($memberdata) && count($memberdata) >= 1) { $PrememberModel->delete_premember_and_regist_member($memberdata); $this->title = "登録完了です"; $this->message = "トップページよりログインしてください!l"; } else { $this->title = "!!!エラー!!!"; $this->message = "無効なURLです"; } } else { $this->title = "!!!エラー!!!"; $this->message = "無効なURLです"; } $this->file = "premember.tpl"; $this->view_display(); }
public function screen_modify($auth = "") { $btn = ""; $btn2 = ""; $this->file = "memberinfo_form.tpl"; // データベースを操作します。 $MemberModel = new MemberModel(); $PrememberModel = new PrememberModel(); if ($this->is_system && $this->action == "form") { $_SESSION[_MEMBER_AUTHINFO] = $MemberModel->get_member_data_id($_GET['id']); } // フォーム要素のデフォルト値を設定 $date_defaults = ['Y' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 0, 4), 'm' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 4, 2), 'd' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 6, 2)]; $this->form->setDefaults(['username' => $_SESSION[_MEMBER_AUTHINFO]['username'], 'last_name' => $_SESSION[_MEMBER_AUTHINFO]['last_name'], 'first_name' => $_SESSION[_MEMBER_AUTHINFO]['first_name'], 'ken' => $_SESSION[_MEMBER_AUTHINFO]['ken'], 'birthday' => $date_defaults]); $this->make_form_controle(); // フォームの妥当性検証 if (!$this->form->validate()) { $this->action = "form"; } if ($this->action == "form") { $this->title = '更新画面'; $this->next_type = 'modify'; $this->next_action = 'confirm'; $btn = '確認画面へ'; } else { if ($this->action == "confirm") { $this->title = '確認画面'; $this->next_type = 'modify'; $this->next_action = 'complete'; $this->form->freeze(); $btn = '更新する'; $btn2 = '戻る'; } else { if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == '戻る') { $this->title = '更新画面'; $this->next_type = 'modify'; $this->next_action = 'confirm'; $btn = '確認画面へ'; } else { if ($this->action == "complete" && isset($_POST['submit']) && $_POST['submit'] == '更新する') { $userdata = $this->form->getSubmitValues(); if (($MemberModel->check_username($userdata) || $PrememberModel->check_username($userdata)) && $_SESSION[_MEMBER_AUTHINFO]['username'] != $userdata['username']) { $this->next_type = 'modify'; $this->next_action = 'confirm'; $this->title = '更新画面'; $this->message = "メールアドレスは登録済みです。"; $btn = '確認画面へ'; } else { $this->title = '更新完了画面'; $userdata['id'] = $_SESSION[_MEMBER_AUTHINFO]['id']; // システム側から利用するときに利用 if ($this->is_system && is_object($auth)) { $userdata['password'] = $auth->get_hashed_password($userdata['password']); } else { $userdata['password'] = $this->auth->get_hashed_password($userdata['password']); } $userdata['birthday'] = sprintf("%04d%02d%02d", $userdata['birthday']['Y'], $userdata['birthday']['m'], $userdata['birthday']['d']); $MemberModel->modify_member($userdata); $this->message = "会員情報を修正しました。"; $this->file = "message.tpl"; if ($this->is_system) { unset($_SESSION[_MEMBER_AUTHINFO]); } else { $_SESSION[_MEMBER_AUTHINFO] = $MemberModel->get_member_data_id($_SESSION[_MEMBER_AUTHINFO]['id']); } } } } } } $this->form->addElement('submit', 'submit', $btn); $this->form->addElement('submit', 'submit2', $btn2); $this->form->addElement('reset', 'reset', '取り消し'); $this->view_display(); }
public function screen_member_modify($auth = "") { $btn1 = ""; $btn2 = ""; $area = ""; $project = ""; if ($this->action == "view" && $this->is_system) { $MemberModel = new MemberModel(); $_SESSION[_MEMBER_AUTHINFO] = $MemberModel->get_member_base_info_id($_GET['id']); } $birthday_defaults = array('Y' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 0, 4), 'm' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 4, 2), 'd' => substr($_SESSION[_MEMBER_AUTHINFO]['birthday'], 6, 2)); $hope_start_defaults = array('Y' => substr($_SESSION[_MEMBER_AUTHINFO]['hope_start'], 0, 4), 'm' => substr($_SESSION[_MEMBER_AUTHINFO]['hope_start'], 4, 2), 'd' => substr($_SESSION[_MEMBER_AUTHINFO]['hope_start'], 6, 2)); $regist_area = $_SESSION[_MEMBER_AUTHINFO]['area_type']; $regist_area = explode('/', $regist_area); $this->make_form_project_area($regist_area); $regist_project = $_SESSION[_MEMBER_AUTHINFO]['project_type']; $regist_project = explode('/', $regist_project); $this->make_form_project_type($regist_project); $this->form->setDefaults(array('mail' => $_SESSION[_MEMBER_AUTHINFO]['mail'], 'last_name' => $_SESSION[_MEMBER_AUTHINFO]['last_name'], 'first_name' => $_SESSION[_MEMBER_AUTHINFO]['first_name'], 'birthday' => $birthday_defaults, 'gender' => array('gender' => $_SESSION[_MEMBER_AUTHINFO]['gender']), 'hope_start' => $hope_start_defaults, 'expe_appeal' => $_SESSION[_MEMBER_AUTHINFO]['expe_appeal'])); $this->make_member_regist_form_no_pass(); $this->make_member_regist_add_form(); if (isset($_POST['re'])) { $data = $this->form->getSubmitValues(); } if (isset($data)) { if (!$this->check_area($data, 3)) { $this->area = '希望のエリアを一つ以上選択してください'; $this->action = "form"; } if (!$this->check_project_member($data)) { $this->project = '希望の職種は一つ以上選択してください'; $this->action = "form"; } if (!$this->form->validate()) { $this->action = "form"; } } else { if ($this->action != "view") { $this->action = "form"; } } if ($this->action == "view" && $this->is_system) { $this->file = "system_member_detail.tpl"; $this->title = "登録情報"; $this->message = "--サイトメンバーの詳細を表示しています--"; $regist_project = $this->make_view_project_type($_SESSION[_MEMBER_AUTHINFO]['project_type']); $this->view->assign('id', $_SESSION[_MEMBER_AUTHINFO]['id']); $this->view->assign('birthday', $_SESSION[_MEMBER_AUTHINFO]['birthday']); $this->view->assign('gender', $_SESSION[_MEMBER_AUTHINFO]['gender']); $this->view->assign('hope_start', $_SESSION[_MEMBER_AUTHINFO]['hope_start']); $this->view->assign('data', $regist_project); $btn1 = "更新"; $btn2 = "削除"; $this->form->freeze(); } if ($this->action == "form") { $this->file = "member_modify.tpl"; $this->title = "登録情報の修正"; $this->message = "登録された情報の修正できます!"; $this->next_type = "modify"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "confirm") { $this->form->freeze(); $this->file = "member_modify_freeze.tpl"; $this->title = "登録情報の修正"; $this->message = "下記で宜しいでしょうか?"; $this->next_type = "modify"; $this->next_action = "complete"; $btn1 = "登録"; $btn2 = "戻る"; } else { if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") { $this->file = "member_modify.tpl"; $this->title = "登録情報の修正"; $this->message = "登録された情報の修正できます!"; $this->next_type = "modify"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "登録") { $MemberModel = new MemberModel(); $PrememberModel = new PrememberModel(); if ($_SESSION[_MEMBER_AUTHINFO]['mail'] != $data['mail'] && ($MemberModel->check_member($data) || $PrememberModel->check_member($data))) { $this->file = "member_modify.tpl"; $this->title = "登録画面"; $this->message = "!!!すでにこのメールアドレスは登録されています!!!"; $this->next_type = "modify"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { $data['birthday'] = sprintf("%04d%02d%02d", $data['birthday']['Y'], $data['birthday']['m'], $data['birthday']['d']); $data['gender'] = sprintf("%1d", $data['gender']['gender']); $data['area_type'] = $this->data_area_input($data); $data['project_type'] = $this->data_project_input($data); $data['hope_start'] = sprintf('%04d%02d%02d', $data['hope_start']['Y'], $data['hope_start']['m'], $data['hope_start']['d']); $data['id'] = $_SESSION[_MEMBER_AUTHINFO]['id']; $MemberModel->modify_member($data); if ($this->is_system) { $this->title = "更新完了"; $this->message = "会員情報を更新しました"; $this->URL = "system.php?type=member_list"; $this->URL .= $this->add_pageID(); } else { $this->auth->auth_member_ok($data); $this->title = "登録情報の修正が完了しました。"; $this->message = "下記よりトップ画面へお戻りください"; } $this->file = "message.tpl"; } } } } } $this->view->assign('area_error', $area); $this->view->assign('project_error', $project); $this->form->addElement('submit', 'submit1', $btn1); $this->form->addElement('submit', 'submit2', $btn2); $this->form->addElement('reset', 'reset', '取り消し'); $this->view_display(); }
public function screen_regist($auth = "") { $btn1 = ""; $btn2 = ""; $this->file = 'member_regist.tpl'; $this->make_member_regist_form(); $this->form->setDefaults(array('gender' => array('gender' => '1'), 'birthday' => array('Y' => 1980, 'm' => 1, 'd' => 1))); if (!(isset($_POST['submit1']) && $_POST['submit1'] == "登録")) { if (!$this->form->validate()) { $this->action = "form"; } } if ($this->action == "form") { if ($this->is_system) { $this->title = "新規会員登録"; $this->message = "--会員の情報を入力してください--"; } else { $this->title = "簡単にサイトへの登録ができます!"; $this->message = "--ご記入ください--"; } $this->next_type = "regist"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "confirm" && isset($_POST['submit1']) && $_POST['submit1'] == "確認") { $this->form->freeze(); //入力値をセッションへ $_SESSION['memberdata'] = $this->form->getSubmitValues(); $this->title = "<確認>"; $this->message = "下記でよろしいですか?"; $this->next_type = "regist"; $this->next_action = "complete"; $btn1 = "登録"; $btn2 = "戻る"; } else { if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") { unset($_SESSION['memberdata']); $this->title = "< 登録画面 >"; $this->next_type = "regist"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "登録") { $PrememberModel = new PrememberModel(); $MemberModel = new MemberModel(); $memberdata = $_SESSION['memberdata']; if ($MemberModel->check_member($memberdata) || $PrememberModel->check_member($memberdata)) { $this->title = "登録画面"; $this->message = "!!!すでにこのメールアドレスは登録されています!!!"; $this->next_type = "regist"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { $memberdata['birthday'] = sprintf("%04d%02d%02d", $memberdata['birthday']['Y'], $memberdata['birthday']['m'], $memberdata['birthday']['d']); $memberdata['gender'] = sprintf("%1d", $memberdata['gender']['gender']); if ($this->is_system && is_object($auth)) { $memberdata['password'] = $auth->get_hash_password($memberdata['password']); } else { $memberdata['password'] = $this->auth->get_hash_password($memberdata['password']); } if ($this->is_system) { $this->title = "基本情報の入力完了"; $this->message = "次に追加の情報の登録に移行します"; $this->next_type = "regist_add"; $this->next_action = "form"; $btn1 = "OK"; $this->file = "message_submit.tpl"; } else { $memberdata['link_pass'] = hash('sha256', uniqid(rand(), 1)); $PrememberModel->regist_premember($memberdata); $this->mail_to_premember($memberdata); $this->title = "仮登録完了"; $this->message = $memberdata['last_name'] . "さん、ご入力ありがとうございます。<br><br>"; $this->message .= "登録されたメールアドレスに確認のためメールをお送りました。<br><br>"; $this->message .= "メール本文のURL(12時間有効)より<br><br>"; $this->message .= "登録を完了させてください。<br><br>"; $this->file = "message.tpl"; } } } } } } $this->form->addElement('submit', 'submit1', $btn1); $this->form->addElement('submit', 'submit2', $btn2); $this->form->addElement('reset', 'reset', 'リセット'); $this->view_display(); }