Initial commit
[2ch-be.git] / dev-test / chooseart.php
blobbc60316cc0535b26083fd2b7543f265987bf7ac8
1 <?php
2 if (!isset($_COOKIE['DMDM']) && !isset($_COOKIE['MDMD'])) {
3 header('location:index.php');
4 exit;
6 include('config.php');
7 include('encrypt_artist.php');
10 $message = new Message;
11 $email = Decrypt($_COOKIE['DMDM'],KEY);
12 // $email = filter_var($email, FILTER_SANITIZE_EMAIL);
14 if(isset($_GET['pay'])){
15 $premiumList = file("/home/adb/imglist.log");
16 $stat = $message->within_str($premiumList[$_GET['pay']], "<stat>", "</stat>");
18 if(isset($premiumList[$_GET['pay']])){
19 if(!$stat){
20 $buyerID = trim($message->GetID($_COOKIE['DMDM'],$id_mail_path));
21 $time = time();
22 $id = $message->within_str($premiumList[$_GET['pay']], "<id>", "</id>");
23 $name = $message->within_str($premiumList[$_GET['pay']], "<name>", "</name>");;
24 $price = $message->within_str($premiumList[$_GET['pay']], "<price>", "</price>");;
25 $writeData = "<time>{$time}</time><id>{$id}</id><name>{$name}</name><price>{$price}</price>\n";
26 $filename = ADB_PATH."/transaction.log";
28 $points = file_get_contents("http://tpol27.nttec.com/dev/melon.php?conv=".$price."&usr=".$email."&ip=".$_SERVER['REMOTE_ADDR']."&trans=premium&puid=".$buyerID);
29 if($points){
31 if (!file_exists($filename)) {
32 if(!file_put_contents($filename,$writeData)) {
33 echo "Error!";
34 return false;
36 } else {
37 $handle = fopen($filename, "a");
38 if(!fwrite($handle, $writeData)) {
39 echo "Error!";
40 return false;
42 fclose($handle);
44 $_SESSION['msg'] = '<div class="alert alert-success">You\'re new avatar is updated.</div>';
47 $ico = $name.".gif";
48 $ico = trim($ico);
49 if(preg_match('/[^a-z_\-0-9._]/i', $ico)){
50 $ico ="";
53 $type = Array(1 => 'gif'); //store all the image extension types in array
54 $ext = explode(".",$ico); //explode and find value after dot
56 if (strlen($ext[0]) <= 0 ) $ico = "nida.gif";
57 if(!(in_array($ext[1],$type))) //check image extension not in the array $type
59 echo "412";
60 exit;
63 $fdir = substr($email, 0, 1);
64 $sdir = substr($email, 1, 1);
65 $userData = file(DB_PATH."$fdir/$sdir/$email");
67 for ($i=0; $i < count($userData); $i++) {
68 $userData[$i] = trim($userData[$i]);
71 $userData[5] = $ico."-PREM";
72 $writeData = implode("\n",$userData);
73 file_put_contents(DB_PATH."$fdir/$sdir/$email", $writeData);
74 $_SESSION['msg'] = '<div class="alert alert-success">You\'re new avatar is updated.</div>';
75 header('location:status.php');
76 exit;
78 }else{
79 $_SESSION['msg'] = '<div class="alert alert-danger">Not enough points</div>';
80 header("Location: status.php");
81 exit;
85 }else{
86 $_SESSION['msg'] = '<div class="alert alert-danger">Doesn\'t Exist</div>';
87 header("Location: status.php");
88 exit;
92 <!DOCTYPE html>
93 <html lang="en">
94 <head>
95 <meta charset="UTF-8">
96 <meta http-equiv="X-UA-Compatible" content="IE=edge">
97 <meta name="viewport" content="width=device-width, initial-scale=1">
98 <title>Artist Page</title>
99 <link rel="stylesheet" href="css/bootstrap.css">
100 <link rel="stylesheet" href="css/astyle.css">
101 </head>
102 <body>
104 <div class="container body">
105 <div class="row">
106 <div class="col-md-12">
107 <center>
108 <!-- <button class="btn btn-lg btn-default">FREE</button>
109 <button class="btn btn-lg btn-primary">PAID</button> -->
110 <a href="chooseart.php" class="btn btn-lg btn-default">フリー</a>
111 <a href="chooseart.php?p" class="btn btn-lg btn-primary">有給の</a>
112 <?php
113 if(empty($_GET)){
114 echo "<h3>無料アバター</h3>";
115 }else{
116 echo "<h3>有料のアバター</h3>";
119 </center>
120 <?php
121 print "<center>";
122 #echo $livesitePath2;
123 #exit;
124 if (!isset($_GET['p'])) {
125 $ico = file('ico.txt');
126 $c = count($ico)/20;
127 if(strpos($c,".")>0)
128 $c = $c+1;
129 $p = (isset($_GET['p'])&&is_numeric($_GET['p']))?($_GET['p']*20):20;
130 $s = (isset($_GET['p'])&&is_numeric($_GET['p']))?$p-20:0;
131 print "<div style=\"margin-top:100px\">";
132 for ($i=$s; $i < $p; $i++)
133 if(isset($ico[$i]))
134 echo "<a href=\"status.php?ico=".$ico[$i]."\"><img src=\"".$livesitePath2."/ico/".$ico[$i]."\" height=\"30\" style=\"margin:5px;\"></a>";
135 print "</div>";
136 print "<div style=\"max-width:500px;margin-top:30px;text-align:center\">";
137 for($t=1;$t<=$c;$t++)
138 print "<a href=\"choose.php?p=$t\" style=\"margin:5px;padding:5px;display:inline-block\">$t</a>";
139 print "</div>";
140 print "</center>";
141 } else { ?>
143 <div class="body showcase sizecontrol">
144 <div style="margin-left:5%;">
145 <?php
146 $points = file_get_contents("http://tpol27.nttec.com/melon.php?email=".$email);
147 echo "<h1>メロンポイント: {$points}</h1>";
149 $file = file("/home/adb/imglist.log");
150 $premiumBreaker = 0;
151 foreach ($file as $key => $value) {
152 if(!$message->within_str($value, "<stat>", "</stat>")){
153 echo '<div class="panel panel-default art">
154 <a class="thumbnail">
155 <img src="'.$livesitePath.'dev-test/premium/'.$message->within_str($value, "<name>", "</name>") .'.gif" style="width:80px; height:80px;" alt="">
156 </a>
157 <center>
158 <span>'.$message->within_str($value, "<price>", "</price>").' MP</span><br><br>
159 <button class="btn btn-success" data-toggle="modal" data-target="#'.$message->within_str($value, "<name>", "</name>") .'">BUY</button><center><br>
160 <div class="clearfix"></div>
161 </div>';
164 echo "<div id='".$message->within_str($value, "<name>", "</name>") ."' class='modal fade' tabindex='-1' role='dialog' aria-labelledby='buy' aria-hidden='true'>
165 <div class='modal-dialog'>
166 <div class='modal-content'>
167 <div class='modal-header'>
168 <button type='button' class='close' data-dismiss='modal'>
169 <span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span>
170 </button>
171 <h3>これと同様にあなたがあなたの新しいBEアバターなるにはするか? </h3>
172 </div>
173 <div class='modal-body'>
174 これは価値がある ".$message->within_str($value, "<price>", "</price>")." メロンポイント
175 </div>
176 <div class='modal-footer'>
177 <a href='chooseart.php?pay=".$premiumBreaker."' class='btn btn-success'>購入</a>
178 </div>
179 </div>
180 </div>
181 </div>";
183 $premiumBreaker++;
187 </div>
188 </div>
189 <?php } ?>
190 </div>
191 </div>
192 </div>
195 <script src="js/jquery-1.9.1.js"></script>
196 <script src="js/bootstrap.js"></script>
197 </body>
198 </html>