pointup.php
4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?PHP
include("../include/mime.php");
include("../include/jcode.phps");
// ポイントを加算減算する
//
$hostname="172.31.18.14";
$database="post_kanri";
if( !$pg_con2=pg_connect("host=$hostname port=5434 dbname=$database user=pgsqladmin password=pgsqladmin") ) {
print "Error : connect to ${hostname}<br>";
exit;
}
//表示名称を取得
$strSQL = "SELECT use_point,max_point,use_date,mail_add,name,buy_point " .
"FROM point_tbl,point_buy_history_tbl " .
"WHERE point_tbl.user_id = point_buy_history_tbl.user_id and point_tbl.user_id = '".$user_id."'";
$objRecSet = pg_exec($pg_con2,$strSQL);
if($objRecSet==false){
$res = "False";
}
if(pg_numrows($objRecSet)!=0){
$objRecData = pg_fetch_object($objRecSet, 0);
$Point = $objRecData->use_point;
$Buy_point = $objRecData->buy_point;
$mail_add = $objRecData->mail_add;
$buy_name = $objRecData->name;
}else{
$Point = 0;
}
// if($flg==0){
// $Point = (integer)$Point - (integer)$value;
// }else{
$Point = ((integer)$Point) + ((integer)$Buy_point);
// }
$strSQL = "Update point_tbl Set use_point=".$Point." where user_id='".$user_id."'";
$objRecSet = pg_exec($pg_con2,$strSQL);
if($objRecSet==false){
$res = "False";
}
$strSQL = "DELETE FROM point_buy_history_tbl Where user_id='".$user_id."'";
$objRecSet = pg_exec($pg_con2,$strSQL);
if($objRecSet==false){
$res = "False";
}
$buy_mail_add = $mail_add;
//登録完了メール送信
$strToMob = $buy_mail_add;
$strSubmitAdd = "webmaster@media-tek.co.jp";
$Subject_name = "め〜るNiポン ご入金確認のお知らせ";
$strSubject = "=?iso-2022-jp?B?" . base64_encode(jcodeconvert($Subject_name, 0, 3)) . "?=";
$strComment .= $buy_name." 様\n";
$strComment .= "\n";
$strComment .= "現在ご利用いただいておりますめ〜るNiポンの\n";
$strComment .= "ご請求のお振込み確認と、お申し込み完了のご連絡申し上げます。\n";
$strComment .= "なお、".date("Y年m月d日 H時i分")." 時点でのポイントは下記の通りになります。\n";
$strComment .= "\n";
$strComment .= "\n";
$strComment .= "------------------------------------------------\n";
$strComment .= "めーるポイント:".$Point."\n";
$strComment .= "------------------------------------------------\n";
$strComment .= "\n";
$strComment .= "\n";
$strComment .= "その他、「め〜るNiポン」に関してご不明点・弊社へのご要望などございましたら、\n";
$strComment .= "何なりとお申し付け下さい。\n";
$strComment .= "今後ともメディアテック株式会社をよろしくお願い申し上げます。\n";
$strComment .= "\n";
$strComment .= "==================================================================\n";
$strComment .= "\n";
$strComment .= "め〜るNiポン お問合せ: webmaster@media-tek.co.jp\n";
$strComment .= "メディアテック株式会社 http://www.media-tek.co.jp\n";
$strComment .= "\n";
$strComment .= "==================================================================\n";
$strComment .= "\n";
$strComment = jcodeconvert($strComment, 1, 3);
$Header1 = "";
$Headers['From']=$strSubmitAdd;
$Headers['X-Mailer']="PHP/".phpversion(); //メール送信プログラムの表示
//PEARのmimeクラス設定
$mime = new Mail_mime("\r\n");
$mime->_build_params['text_charset'] = 'iso-2022-jp'; //本文テキストの文字コードをJISに設定する
//本文のテキストの指定
$mime->setTXTBody($strComment);
$strComment = $mime->get();
$Headers = $mime->headers($Headers);
while (list($key,$val)=each($Headers)) {
$Header1 .= $key.": ".$val."\r\n";
}
$intBool2 = mail($strToMob,$strSubject,$strComment,$Header1,"-f ".$strSubmitAdd);//登録者に送信
if(!$intBool2){
echo("メール送信に失敗しました。<tr>");
echo "宛先:".$strToMob."<BR>";
echo "件名:".$strSubject."<BR>";
echo "内容:".$strComment."<BR>";
echo "header:".$Header1."<BR>";
exit;
}
$strToMob = "webmaster@media-tek.co.jp";
$intBool2 = mail($strToMob,$strSubject,$strComment,$Header1,"-f ".$strSubmitAdd);//管理者に送信
if(!$intBool2){
echo("メール送信に失敗しました。<tr>");
echo "宛先:".$strToMob."<BR>";
echo "件名:".$strSubject."<BR>";
echo "内容:".$strComment."<BR>";
echo "header:".$Header1."<BR>";
exit;
}
header("Location: point_menu.php");
?>