Initial commit
[2ch-be.git] / convert_send.php
blob1a1755d45adb36cbb15cbe8c7dfc7e8c3418cd80
1 <?php
2 include('encrypt.php');
4 $email = Decrypt($_COOKIE['DMDM'],KEY);
5 $fuser = new Message;
6 $email = filter_var($email, FILTER_SANITIZE_EMAIL);
7 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
8 header("Location: index.php");
9 exit;
11 // print_r($_POST);
12 if(isset($_POST['transfer']) && !empty($_POST['transfer']) || isset($_POST['pTransfer']) ) {
14 if($_POST['pTransfer']){
15 $pageHeader = $livesitePath.'test/p.php?i='.$_POST['recipient'];
16 $sessionVar = 'alert';
17 }else{
18 $pageHeader = 'convert_send.php';
19 $sessionVar = 'error';
22 if(is_numeric($_POST['points'])){
23 $error = "ƒGƒ‰�[�A‚à‚¤ˆê“xŽŽ‚µ‚Ä‚­‚¾‚³‚¢";
24 foreach($_POST as $index=>$value){
25 if(empty($value)){
26 switch ($index) {
27 case 'points':
28 $emptyVar .= "<br>ƒ�ƒ�ƒ“ƒ|ƒCƒ“ƒg";
29 break;
31 case 'recipient':
32 $emptyVar .= "<br>Žó—eŽÒ";
33 break;
39 if(!isset($emptyVar)){
40 $pts = addslashes(strip_tags(trim($_POST['points'])));
41 $pts = abs(round($pts));
42 $id = addslashes(strip_tags(trim($_POST['recipient'])));
43 $recipient = $fuser->FindUser($id,$id_mail_path);
44 $sender = trim($fuser->GetID($_COOKIE['DMDM'],$id_mail_path));
45 $trimmedPts = $fuser->BEPoints($email);
47 if($recipient){
48 if($trimmedPts < $pts) {
49 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "‚ ‚È‚½‚Í‚Ì�\•ª‚ȃ|ƒCƒ“ƒg‚ðŽ�‚Á‚Ä‚¢‚È‚¢" : "<div class=\"alert alert-danger\">‚ ‚È‚½‚Í‚Ì�\•ª‚ȃ|ƒCƒ“ƒg‚ðŽ�‚Á‚Ä‚¢‚È‚¢</div>";
50 header("Location: ".$pageHeader);
51 exit;
52 } else {
54 // $points = file_get_contents("http://tpol27.nttec.com/dev/melon.php?conv=".$pts."&usr=".$email."&ip=".$_SERVER['REMOTE_ADDR']."&trans=sent&puid=".$id);
55 //echo $points;
56 // if($points){
57 $animal = '';
58 // $points = file_get_contents("http://tpol27.nttec.com/dev/melon.php?uname=".$recipient."&pts=".$pts."&ip=".$_SERVER['REMOTE_ADDR']."&animal=".$animal."&trans=receive&puid=".$sender);
59 // echo $points;
60 //magdalena anung problema?
61 $writeLogs = file_get_contents("http://tpol27.nttec.com/dev/melon.php?write=bepoints&usr=".$email."&pts=".$pts."&ip=".$_SERVER['REMOTE_ADDR']."&trans=sentbepts&ft=".$id);
62 // echo $pointsBE
63 if($writeLogs != "0" && $writeLogs == "1") {
64 // if ($fuser->AddBEpoints($recipient, $pts)){
65 $writeLogs = file_get_contents("http://tpol27.nttec.com/dev/melon.php?write=bepoints&usr=".$recipient."&pts=".$pts."&ip=".$_SERVER['REMOTE_ADDR']."&trans=recievedbepts&ft=".$sender);
66 if ($fuser->DeductBEpoints($email, $pts)){
67 $fuser->AddBEpoints($recipient, $pts);
68 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "�¬Œ÷" : "<div class=\"alert alert-success\">�¬Œ÷</div>";
69 header("Location: ".$pageHeader);
71 // echo 'xxx';
72 // die;
73 exit;
74 }else{
75 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "Ž¸”s‚·‚é" : "<div class=\"alert alert-danger\">Ž¸”s‚·‚é</div>";
76 header("Location: ".$pageHeader);
77 exit;
79 }else{
80 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "NG•ÏŠ·" : "<div class=\"alert alert-danger\">NG•ÏŠ·</div>";
81 header("Location: ".$pageHeader);
82 exit;
85 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "“]‘—‚Ì�¬Œ÷ƒ|ƒCƒ“ƒg" : "<div class=\"alert alert-success\">“]‘—‚Ì�¬Œ÷ƒ|ƒCƒ“ƒg</div>";
86 if(abs($pts) >= 100)
87 file_get_contents("http://207.29.229.25/tmail.php?usname=".trim($recipient)."&tkn=gokp5WATBYOovz2S4LKo");
90 header("Location: ".$pageHeader);
91 exit;
93 // }else{
95 // $_SESSION[$sessionVar] = ($sessionVar=='error') ? "ƒGƒ‰�[�A‚à‚¤ˆê“xŽŽ‚µ‚Ä‚­‚¾‚³‚¢" : "<div class=\"alert alert-danger\">ƒGƒ‰�[�A‚à‚¤ˆê“xŽŽ‚µ‚Ä‚­‚¾‚³‚¢</div>";
96 // header("Location: ".$pageHeader);
97 // exit;
98 // }
100 }else{
101 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "ƒ†�[ƒU�[‚Í‘¶�Ý‚µ‚Ü‚¹‚ñ" : "<div class=\"alert alert-danger\">ƒ†�[ƒU�[‚Í‘¶�Ý‚µ‚Ü‚¹‚ñ</div>";
102 header("Location: ".$pageHeader);
103 exit;
105 }else{
106 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "–³Œø‚ȃ|ƒCƒ“ƒg" : "<div class=\"alert alert-danger\">–³Œø‚ȃ|ƒCƒ“ƒg</div>";
107 header("Location: ".$pageHeader);
108 exit;
110 }else{
111 $_SESSION[$sessionVar] = ($sessionVar=='error') ? "–³Œø‚ȃ|ƒCƒ“ƒg" : "<div class=\"alert alert-danger\">–³Œø‚ȃ|ƒCƒ“ƒg</div>";
112 header("Location: ".$pageHeader);
113 exit;
117 <!DOCTYPE html>
118 <html lang="en">
119 <head>
120 <meta charset="Shift_JIS">
121 <title>]‘—ƒ|ƒCƒ“ƒg</title>
122 <meta name="viewport" content="width=device-width, initial-scale=1.0">
123 <meta name="description" content="">
124 <meta name="author" content="">
125 <link rel="stylesheet" type="text/css" href="<?php echo $livesitePath ?>css/style.css"/>
126 <style>
127 span.green{
128 color: green;
129 font-weight: bold;
131 </style>
132 </head>
133 <body>
134 <?php
135 $varMessage = $_SESSION['error'];
136 // echo $varMessage.'xx';
137 //if(!empty($varMessage)){
138 // echo $varMessage;
139 // $_SESSION['error'] = "";
142 <div class="containerz">
143 <div class="navbar-collapse">
144 <ul class="nav navbar-nav">
145 </ul>
146 </div>
147 </div>
149 <div class="container">
150 <center>
151 <div class="form-signin" style = "font-size: 1.2em;text-align:right;">
152 <?php
153 if($_SERVER['SERVER_NAME'] == "be.2ch.net") {
155 <a href="http://www.2ch.net/" target="_BLANK">
156 <img src="<?php echo $livesitePath ?>css/img/2ch_logo.gif">
157 </a>
158 <?php
159 } elseif ($_SERVER['SERVER_NAME'] == "be.bbspink.com") {
161 <a href="http://www.bbspink.com/" target="_BLANK">
162 <img src="<?php echo $livesitePath ?>css/img/pink.png">
163 </a>
164 <?php
167 <br>
168 BE 2.0
169 </div>
170 </center>
171 </div>
172 <div class="container">
173 <center>
174 <form class="form-signin" method="post">
175 <?php
176 $cpts = $fuser->BEPoints($email);
177 echo "BE Points: <span class='green'>".$cpts."</span></b><br><br>";
180 <input type="text" name="points" placeholder="‘¡‚éƒ|ƒCƒ“ƒg‚Ì�”"><br>
181 <input type="text" name="recipient" placeholder="ŽóŽæ�l‚ÌID"><br>
182 <input type="submit" name="transfer" value="‘—�M"><br>
183 <?php
184 if(!empty($varMessage)){
185 echo "<div style=\"padding:5px; margin-top:8px; background-color:#D6D6D6; \">". $varMessage . "</div>";
186 $_SESSION['error'] = "";
187 }?>
188 </form>
189 </center>
190 </div>
191 </body>
192 </html>