tpl_login = false;
$this->tpl_disable_logout = false;
$this->tpl_error = "";
$this->complete = false;
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
if(!file_exists(DATA_PATH.'downloads/donation.csv')){
$objQuery = new SC_Query;
$ret = $objQuery->getOne("SELECT php_path FROM dtb_bloc WHERE php_path = 'frontparts/bloc/send_point.php'");
if(!$ret){
$objQuery->query("INSERT INTO dtb_bloc (bloc_name,tpl_path,filename,create_date,update_date,php_path,del_flg)
VALUES('東北地方太平洋沖地震ポイント寄付','','send_point',NOW(),NOW(),'frontparts/bloc/send_point.php',0)");
if(!file_exists(DATA_PATH.'downloads/donation_summary.csv') AND $fp = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){
fwrite($fp,'0,0,0');
fclose($fp);
}
}
}
$objCustomer = new SC_Customer();
$objCustomer->updateSession();
// クッキー管理クラス
$objCookie = new SC_Cookie(COOKIE_EXPIRE);
$limit = 0;
if($fp2 = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){
flock($fp2,LOCK_EX);
$summary = file_get_contents(DATA_PATH.'downloads/donation_summary.csv');
$summary = explode(",",$summary);
$total = intval($summary[1]);
if(intval($summary[2]) > 0){
$limit = intval($summary[2]);
}
if($limit != 0 and $total == $limit){
$this->complete = true;
}
}
// ログイン判定
if($objCustomer->isLoginSuccess() and $this->complete == false ) {
$this->tpl_user_point = $objCustomer->getValue('point');
if (strlen($this->tpl_user_point) == 0) $this->tpl_user_point = 0;
if(isset($_POST["sendpoint"]) and $this->isValidToken()){
//ポイント寄付処理
$point = intval(mb_convert_kana($_POST["sendpoint"],"n"));
if(!$point or $this->tpl_user_point < $point){
$this->tpl_error = "1以上のポイントを保有ポイント内で半角数字で入力してください。";
}else{
if($limit > 0 and $this->complete == false){
if(($limit - $total) < $point){
$point = $limit - $total;
$this->complete = true;
}
}
if($fp = fopen(DATA_PATH.'downloads/donation.csv','a+') and $point > 0){
$objQuery = new SC_Query;
$sqlval = array('point' => ($this->tpl_user_point - $point));
$where = 'customer_id = ? AND del_flg = 0 AND status = 2';
$rs = $objQuery->update('dtb_customer', $sqlval, $where, array($objCustomer->getValue('customer_id')));
if($rs){
flock($fp,LOCK_EX);
fwrite($fp,date("Y-m-d G:i:s").",".$objCustomer->getValue('customer_id').",".$point."\n");
$objCustomer->setValue("point", ($this->tpl_user_point - $point));
$this->tpl_error = "ご協力ありがとうございます。".$point."ptを承りました。
寄付頂いたポイント分を、東北地方太平洋沖地震の復旧活動へ寄付いたします。";
//サマリー更新
if(isset($summary)){
$num = intval($summary[0]) + 1;
$total = $total+$point;
ftruncate($fp2,0);
fseek($fp2,0);
fwrite($fp2,$num.','.$total.','.$limit);
}else{
$this->tpl_error = "正常に寄付ポイントを集計出来ませんでした。サイト管理者へご連絡願います。";
}
}else{
$this->tpl_error = "正常に寄付ポイントを記録出来ませんでした。もう一度お願いします。";
}
fclose($fp);
} else {
$this->tpl_error = "システムエラー";
}
}
}
$this->tpl_login = true;
$objCustomer->updateSession();
$this->tpl_user_point = $objCustomer->getValue('point');
if (strlen($this->tpl_user_point) == 0) $this->tpl_user_point = 0;
$this->tpl_name1 = $objCustomer->getValue('name01');
$this->tpl_name2 = $objCustomer->getValue('name02');
}
if($fp2){
fclose($fp2);
}
$this->transactionid = $this->getToken();
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
$objPage = new LC_Page_FrontParts_Bloc_SendPoint();
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();
?>
ポイントの東北地方太平洋沖地震の復旧活動への寄付ですが、皆様のご協力により目標ポイント数を達成する事が出来ました。
寄付して頂いたポイント分の金額を、当店がお客様に代わり東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。
多大なご協力ありがとうございました。
現金で赤十字に募金される場合はコチラをご参照ください。
現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付出来ます。
下記フォームに寄付するポイント数を入力の上、「寄付」ボタンをクリックしてください。
運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動に寄付させて頂きます。
tpl_error; ?>
直接現金で赤十字に募金される場合はコチラをご参照ください。
会員のお客様は、現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付できます。ログインしてご協力をお願いします。
- ログイン -
運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。
直接現金で赤十字に募金される場合はコチラをご参照ください。