- Timestamp:
- 2011/03/17 10:38:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eccube-donation/html/frontparts/bloc/send_point.php
r20622 r20674 59 59 $this->tpl_disable_logout = false; 60 60 $this->tpl_error = ""; 61 $this->complete = false; 61 62 } 62 63 … … 73 74 $objQuery->query("INSERT INTO dtb_bloc (bloc_name,tpl_path,filename,create_date,update_date,php_path,del_flg) 74 75 VALUES('東北地方太平洋沖地震ポイント寄付','','send_point',NOW(),NOW(),'frontparts/bloc/send_point.php',0)"); 76 if(!file_exists(DATA_PATH.'downloads/donation_summary.csv') AND $fp = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){ 77 fwrite($fp,'0,0,0'); 78 fclose($fp); 79 } 75 80 } 76 81 } 82 83 77 84 78 85 $objCustomer = new SC_Customer(); … … 80 87 // クッキー管理クラス 81 88 $objCookie = new SC_Cookie(COOKIE_EXPIRE); 82 89 90 $limit = 0; 91 if($fp2 = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){ 92 flock($fp2,LOCK_EX); 93 $summary = file_get_contents(DATA_PATH.'downloads/donation_summary.csv'); 94 $summary = explode(",",$summary); 95 $total = intval($summary[1]); 96 $limit = intval($summary[2]); 97 if($limit != 0 and $total == $limit){ 98 $this->complete = true; 99 } 100 } 101 83 102 // ログイン判定 84 if($objCustomer->isLoginSuccess() ) {103 if($objCustomer->isLoginSuccess() and $this->complete == false ) { 85 104 $this->tpl_user_point = $objCustomer->getValue('point'); 86 105 if (strlen($this->tpl_user_point) == 0) $this->tpl_user_point = 0; … … 91 110 $this->tpl_error = "1以上のポイントを保有ポイント内で半角数字で入力してください。"; 92 111 }else{ 93 $objQuery = new SC_Query; 94 $sqlval = array('point' => ($this->tpl_user_point - $point)); 95 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 96 $rs = $objQuery->update('dtb_customer', $sqlval, $where, array($objCustomer->getValue('customer_id'))); 97 if($rs){ 98 $fp = fopen(DATA_PATH.'downloads/donation.csv','a+'); 99 fwrite($fp,date("Y-m-d G:i:s").",".$objCustomer->getValue('customer_id').",".$point."\n"); 100 $objCustomer->setValue("point", ($this->tpl_user_point - $point)); 101 $this->tpl_error = "ご協力ありがとうございます。".$point."ptを承りました。<br />寄付頂いたポイント分を、東北地方太平洋沖地震の復旧活動へ寄付いたします。"; 112 if(isset($summary) and $this->complete == false){ 113 if(($limit - $total) < $point){ 114 $point = $limit - $total; 115 $this->complete = true; 116 } 117 } 118 if($fp = fopen(DATA_PATH.'downloads/donation.csv','a+') and $point > 0){ 119 $objQuery = new SC_Query; 120 $sqlval = array('point' => ($this->tpl_user_point - $point)); 121 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 122 $rs = $objQuery->update('dtb_customer', $sqlval, $where, array($objCustomer->getValue('customer_id'))); 123 if($rs){ 124 flock($fp,LOCK_EX); 125 fwrite($fp,date("Y-m-d G:i:s").",".$objCustomer->getValue('customer_id').",".$point."\n"); 126 $objCustomer->setValue("point", ($this->tpl_user_point - $point)); 127 $this->tpl_error = "ご協力ありがとうございます。".$point."ptを承りました。<br />寄付頂いたポイント分を、東北地方太平洋沖地震の復旧活動へ寄付いたします。"; 128 //サマリー更新 129 if(isset($summary)){ 130 $num = intval($summary[0]) + 1; 131 $total = $total+$point; 132 ftruncate($fp2,0); 133 fwrite($fp2,$num.','.$total.','.$limit); 134 }else{ 135 $this->tpl_error = "正常に寄付ポイントを集計出来ませんでした。サイト管理者へご連絡願います。"; 136 } 137 }else{ 138 $this->tpl_error = "正常に寄付ポイントを記録出来ませんでした。もう一度お願いします。"; 139 } 140 fclose($fp); 102 141 } else { 103 142 $this->tpl_error = "システムエラー"; … … 111 150 $this->tpl_name1 = $objCustomer->getValue('name01'); 112 151 $this->tpl_name2 = $objCustomer->getValue('name02'); 113 } else { 114 // クッキー判定 115 $this->tpl_login_email = $objCookie->getCookie('login_email'); 116 if($this->tpl_login_email != "") { 117 $this->tpl_login_memory = "1"; 118 } 119 120 // POSTされてきたIDがある場合は優先する。 121 if($_POST['login_email'] != "") { 122 $this->tpl_login_email = $_POST['login_email']; 123 } 124 } 152 } 153 154 if($fp2){ 155 fclose($fp2); 156 } 157 125 158 $this->transactionid = $this->getToken(); 126 159 } … … 145 178 <div id="sendPoint"> 146 179 <div id="innner"> 180 <?php if($objPage->complete === true){ ?> 181 <h2>ご協力ありがとうございました</h2> 182 <p>ポイントの東北地方太平洋沖地震の復旧活動への寄付ですが、皆様のご協力により目標ポイント数を達成する事が出来ました。</p> 183 <p>寄付して頂いたポイント分の金額を、当店がお客様に代わり東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。<br />多大なご協力ありがとうございました。<br /></p> 184 <p>現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</p> 185 <?php }else{ ?> 147 186 <h2>東北地方太平洋沖地震へのポイント寄付のお願い</h2> 148 <?php if($objPage->tpl_login){?>187 <?php if($objPage->tpl_login){?> 149 188 <p>現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付出来ます。</p> 150 189 <p>下記フォームに寄付するポイント数を入力の上、「寄付」ボタンをクリックしてください。</p> … … 161 200 </form> 162 201 </div> 163 <?php }else{ ?> 202 <p>直接現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</p> 203 <?php }else{ ?> 164 204 <p>会員のお客様は、現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付できます。ログインしてご協力をお願いします。</p> 165 205 <p>- <a href="<?php echo URL_MYPAGE_TOP ?>">ログイン</a> -</p> 166 206 <p>運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。</p> 207 <p>直接現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</p> 208 <?php } ?> 167 209 <?php } ?> 168 210 </div> 169 211 </div> 170
Note: See TracChangeset
for help on using the changeset viewer.