source: branches/comu/html/forgot/index.php @ 2

Revision 2, 4.3 KB checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class LC_Page {
10   
11    var $errmsg;
12    var $arrReminder;
13    var $temp_password;
14       
15    function LC_Page() {
16        $this->tpl_mainpage = 'forgot/index.tpl';
17        $this->tpl_mainno = '';
18    }
19}
20
21$conn = new SC_DBConn();
22$objPage = new LC_Page();
23$objView = new SC_SiteView();
24$objSess = new SC_Session();
25$CONF = sf_getBasisData();                  // ŹÊÞ´ðËܾðÊó
26// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
27$objCookie = new SC_Cookie(COOKIE_EXPIRE);
28
29if ( $_POST['mode'] == 'mail_check' ){
30    //¥á¥¢¥ÉÆþÎÏ»þ
31    $_POST['email'] = strtolower($_POST['email']);
32    $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND status = 2 AND del_flg = 0";
33    $result = $conn->getAll($sql, array($_POST['email']) );
34   
35    if ( $result[0]['reminder'] ){      // Ëܲñ°÷ÅÐÏ¿ºÑ¤ß¤Î¾ì¹ç
36        // ÆþÎÏemail¤¬Â¸ºß¤¹¤ë     
37        $_SESSION['forgot']['email'] = $_POST['email'];
38        $_SESSION['forgot']['reminder'] = $result[0]['reminder'];
39        // ¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎϲèÌÌ
40        $objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
41        $objPage->tpl_mainpage = 'forgot/secret.tpl';
42    } else {
43        $sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? AND status = 1 AND del_flg = 0";   //²¾ÅÐÏ¿Ãæ¤Î³Îǧ
44        $result = $conn->getAll($sql, array($_POST['email']) );
45        if ($result) {
46            $objPage->errmsg = "¤´ÆþÎϤÎemail¥¢¥É¥ì¥¹¤Ï¸½ºß²¾ÅÐÏ¿Ãæ¤Ç¤¹¡£<br>ÅÐÏ¿¤ÎºÝ¤Ë¤ªÁ÷¤ê¤·¤¿¥á¡¼¥ë¤ÎURL¤Ë¥¢¥¯¥»¥¹¤·¡¢<br>Ëܲñ°÷ÅÐÏ¿¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£";
47        } else {        //¡¡ÅÐÏ¿¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
48            $objPage->errmsg = "¤´ÆþÎϤÎemail¥¢¥É¥ì¥¹¤ÏÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó";
49        }
50    }
51   
52} elseif( $_POST['mode'] == 'secret_check' ){
53    //¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎÏ»þ
54   
55    if ( $_SESSION['forgot']['email'] ) {
56        // ¥Ò¥ß¥Ä¤ÎÅú¤¨¤Î²óÅú¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯
57       
58        $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 0";
59        $result = $conn->getAll($sql, array($_SESSION['forgot']['email']) );
60        $data = $result[0];
61       
62        if ( $data['reminder_answer'] === $_POST['input_reminder'] ){
63            // ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¤
64                       
65            // ¿·¤·¤¤¥Ñ¥¹¥ï¡¼¥É¤òÀßÄꤹ¤ë
66            $objPage->temp_password = gfMakePassword(8);
67                       
68            if(FORGOT_MAIL == 1) {
69                // ¥á¡¼¥ë¤ÇÊѹ¹ÄÌÃΤò¤¹¤ë
70                lfSendMail($CONF, $_SESSION['forgot']['email'], $data['name01'], $objPage->temp_password);
71            }
72           
73            // DB¤ò½ñ¤­´¹¤¨¤ë
74            $sql = "UPDATE dtb_customer SET password = ?, update_date = now() WHERE customer_id = ?";
75            $conn->query( $sql, array( sha1($objPage->temp_password . ":" . AUTH_MAGIC) ,$data['customer_id']) );
76           
77            // ´°Î»²èÌ̤Îɽ¼¨
78            $objPage->tpl_mainpage = 'forgot/complete.tpl';
79           
80            // ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤Î²òÊü
81            $_SESSION['forgot'] = array();
82            unset($_SESSION['forgot']);
83           
84        } else {
85            // ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¯¤Ê¤¤
86           
87            $objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
88            $objPage->errmsg = "¥Ñ¥¹¥ï¡¼¥É¤ò˺¤ì¤¿¤È¤­¤Î¼ÁÌä¤ËÂФ¹¤ë²óÅú¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó";
89            $objPage->tpl_mainpage = 'forgot/secret.tpl';
90
91        }
92   
93       
94    } else {
95        // ¥¢¥¯¥»¥¹¸µ¤¬ÉÔÀµ¤Þ¤¿¤Ï¡¢¥»¥Ã¥·¥ç¥óÊÝ»ý´ü´Ö¤¬ÀÚ¤ì¤Æ¤¤¤ë
96        $objPage->errmsg = "email¥¢¥É¥ì¥¹¤òºÆÅÙÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£<br />Á°²ó¤ÎÆþÎϤ«¤é»þ´Ö¤¬·Ð¤Ã¤Æ¤¤¤Þ¤¹¤È¡¢ËÜ¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£";
97    }
98}
99
100// ¥Ç¥Õ¥©¥ë¥ÈÆþÎÏ
101if($_POST['email'] != "") {
102    // POSTÃͤòÆþÎÏ
103    $objPage->tpl_login_email = $_POST['email'];
104} else {
105    // ¥¯¥Ã¥­¡¼ÃͤòÆþÎÏ
106    $objPage->tpl_login_email = $objCookie->getCookie('login_email');
107}
108
109//----¡¡¥Ú¡¼¥¸É½¼¨
110$objView->assignobj($objPage);
111$objView->display($objPage->tpl_mainpage);
112
113// ---------------------------------------------------------------------------------------------------------------
114
115
116function lfSendMail($CONF, $email, $customer_name, $temp_password){
117    //¡¡¥Ñ¥¹¥ï¡¼¥ÉÊѹ¹¤ªÃΤ餻¥á¡¼¥ëÁ÷¿®
118   
119    $objPage = new LC_Page();
120    $objPage->customer_name = $customer_name;
121    $objPage->temp_password = $temp_password;
122    $objMailText = new SC_SiteView();
123    $objMailText->assignobj($objPage);
124   
125    $toCustomerMail = $objMailText->fetch("mail_templates/forgot_mail.tpl");
126    $objMail = new GC_SendMail();
127   
128    $objMail->setItem(
129                          ''                                //¡¡°¸Àè
130                        , "¥Ñ¥¹¥ï¡¼¥É¤¬Êѹ¹¤µ¤ì¤Þ¤·¤¿" ."¡Ú" .$CONF["shop_name"]. "¡Û"      //¡¡¥µ¥Ö¥¸¥§¥¯¥È
131                        , $toCustomerMail                   //¡¡ËÜʸ
132                        , $CONF["email03"]                  //¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
133                        , $CONF["shop_name"]                //¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
134                        , $CONF["email03"]                  //¡¡reply_to
135                        , $CONF["email04"]                  //¡¡return_path
136                        , $CONF["email04"]                  //  Errors_to
137
138                                                        );
139    $objMail->setTo($email, $customer_name ." ÍÍ");
140    $objMail->sendMail();   
141   
142}
143
144
145?>
146
Note: See TracBrowser for help on using the repository browser.