source: temp/trunk/html/forgot/index.php @ 1328

Revision 1328, 4.2 KB checked in by naka, 20 years ago (diff)

* empty log message *

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