2 if (!isset($_COOKIE['ADMDM']) && !isset($_COOKIE['AMDMD'])) {
3 header('location:artist_login.php');
7 if (!isset($_SESSION['utype'])) {
8 header("location: a_out.php");
11 $email = Decrypt($_COOKIE['ADMDM'],AKEY
);
12 $dir = loggedEmail($email, "adb/");
14 $howmany = file(ADB_PATH
."/transaction.log");
15 $dirFull = loggedEmail($email, ADB_PATH
);
20 <meta charset
="UTF-8">
21 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
22 <meta name
="viewport" content
="width=device-width, initial-scale=1">
23 <title
>Artist Page
</title
>
24 <link rel
="stylesheet" href
="css/bootstrap.css">
25 <link rel
="stylesheet" href
="css/astyle.css">
28 <div
class="container body">
30 <div
class="col-md-12">
31 <div
class="panel panel-default">
32 <div
class="panel-heading">
34 <img src
="css/img/2ch_logo.gif" alt
="">
38 <div
class="pull-right" style
="margin:10px 0px;"><a href
="a_out.php" class="btn btn-danger btn-sm" style
="color:white;">LOGOUT
</a
></div
>
39 <div
class="pull-left" style
="margin:10px 0px;">
40 <h4
><i
>Welcome
,</i
><b
>
42 $artistname = explode ("@", $_SESSION['aname']);
46 <div
class="clearfix"></div
>
48 <div
class="col-md-3">
49 <div
class="panel panel-default">
50 <div
class="panel-heading">
55 <ul id
="al" style
="list-style:none; display:inline;">
56 <?php
if ($_SESSION['utype'] == "admin") { ?
>
57 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
58 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
59 <li
><a href
="?alist">Artist
List</a
></li
>
60 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
61 <li
><a href
="?art">Art
List</a
></li
>
62 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
67 <div
class="col-md-9">
71 echo "<h3><b>Artist Area!</b></h3>";
73 if(isset($_SESSION['msg'])){
74 echo $_SESSION['msg'];
75 $_SESSION['msg'] = '';
79 <?php
if(isset($_GET['art'])){
80 echo "<div class=\"panel panel-default optionlistview\"><div class=\"panel-heading\"><center><b>Artworks</b></center></div><br>";
82 if(file_exists("/home/adb/imglist.log")){
83 $file = file("/home/adb/imglist.log");
84 if(isset($_GET['c'])){
85 if($_GET['c']=="delete"){
87 $filename = within_str($file[$id], "<name>", "</name>");
88 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
89 $data = implode("", $file);
90 $handler = fopen("/home/adb/imglist.log", "w");
91 fwrite($handler, $data);
93 /*$test = unlink("/home/auth/public_html/premium/".$filename.".jpg");*/
95 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
96 header("Location: artist.php?art");
99 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to delete file. Either file doesn't exists</div>";
100 header("Location: artist.php?art");
103 $_SESSION['msg'] = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>We've successfully deleted the file.</div>";
104 header("Location: artist.php?art");
108 foreach ($file as $key => $value) {
109 $img = within_str($value, "<name>", "</name>").".gif";
110 $stat = within_str($value, "<stat>", "</stat>");
111 $id = within_str($value, "<id>", "</id>");
112 if(!$stat && $id==$_SESSION['artistid']){
114 $hmimg = explode(".gif", trim($img));
115 foreach ($howmany as $key9 => $value9) {
116 if (within_str(trim($value9), "<name>", "</name>") == trim($hmimg[0])) {
119 /*echo within_str(trim($value9), "<name>", "</name>");*/
121 echo "<div class=\"panel panel-default alist_art\">";
122 echo "<a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">";
123 echo "<img src=\"{$livesitePath}premium/{$img}\" style=\"height:80px;\" alt=\"\">";
126 echo "<span>" .within_str($value, "<price>", "</price>"). " MP<br>{$hmctr} time/s bought</span><br>";
127 echo "<a href=\"artist.php?art&c=delete&id={$i}\">delete </a>";
128 echo "<a href=\"artist.php?edit={$i}\">edit </a></center>";
129 echo "<div class=\"clearfix\"></div>";
133 // if($i%4==0) { echo "<div class=\"clearfix\"></div>"; }
136 echo "<div class=\"clearfix\"></div>";
138 echo "Please upload your work";
143 }else if(isset($_GET['upload'])){ ?
>
148 if(isset($_POST['submitupload'])){
149 if($_POST['price'] == 0 ||
!isset($_POST['price'])){
150 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>MP amount is 0.</div>";
151 header("Location: artist.php?upload");
154 if($_FILES['uploadedfile']['size']<100000){
155 if(is_numeric($_POST['price'])){
157 $price = (int) $_POST['price'];
158 $price = round(abs($price));
159 $name = $_POST['name'];
161 $tmpName = $_FILES['uploadedfile']['tmp_name'];
163 $fdir = substr($email, 0, 1);
164 $sdir = substr($email, 1, 1);
165 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
166 if (!file_exists($path)) {
167 @mkdir
(ADB_PATH
."{$fdir}");
168 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
169 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
171 // echo $_FILES["file"]["type"];
173 if($_FILES["uploadedfile"]["type"] == "image/gif"){
174 $dirPath = "/home/auth/public_html/premium/";
175 $name = rand(1000000,9999999);
176 $fname = $name.".gif";
177 if(!file_exists($dirPath.$fname)){
178 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
179 $uploadedFile = true;
182 $uploadedFile = false;
185 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>File already exist.</div>";
186 header("Location: artist.php?upload");
190 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>Please upload GIF image only.</div>";
191 header("Location: artist.php?upload");
196 // if($uploadedFile){
198 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
199 // $filename = $path."/imagelist.txt";
201 // if (!file_exists($filename)) {
202 // if(!file_put_contents($filename,$writeData)) {
203 // $writeSuccess = false;
205 // $writeSuccess = true;
207 // $handle = fopen($filename, "a");
208 // if(!fwrite($handle, $writeData)) {
209 // $writeSuccess = false;
212 // $writeSuccess = true;
217 $handle = fopen("/home/adb/imglist.log", "a+");
218 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
221 $_SESSION['msg'] = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>File successfully uploaded.</div>";
222 header("Location: artist.php?art");
225 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>Unable to upload file. Please contact admin.</div>";
226 header("Location: artist.php?upload");
231 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>Price must be numeric.</div>";
232 header("Location: artist.php?upload");
236 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>File size is more than 100kb.</div>";
237 header("Location: artist.php?upload");
244 <div
class="panel panel-default optionlistview">
245 <div
class="panel-heading">
246 <center
><b
>Upload Artwork
</b
></center
>
248 <form role
="form" style
="width:50%;" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
249 <div
class="form-group">
250 <label
for="price">Price
:</label
> <br
>
251 <input name
="price" type
="text" class="form-control" placeholder
="Price" required
/><br
/>
253 <div
class="form-group">
254 <label
for="price">Uploaded File
: </label
> <br
>
255 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price" required
/>
256 <span style
="font-size:12px;margin-top:3px;" class="pull-right">(only
.gif image is accepted
)</span
>
257 <div
class="clearfix"></div
>
259 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
260 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
265 <?php
}else if(isset($_GET['edit'])){
267 echo "<div class=\"panel panel-default optionlistview\">";
268 if(empty($_GET['edit'])){
271 // $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button></div>";
272 header("Location: artist.php?art");
276 $file = file(ADB_PATH
."imglist.log");
277 // print_r(expression)
278 $index = $_GET['edit'];
284 $value = $file[$index];
285 $name = within_str($value, "<name>", "</name>");
286 $price = within_str($value, "<price>", "</price>");
287 $time = within_str($value, "<time>", "</time>");
288 $idVal = within_str($value, "<id>", "</id>");
291 if(isset($_POST['submitedit'])){
292 if($_POST['price'] == 0 ||
!isset($_POST['price'])){
293 $_SESSION['msg'] = "<div class=\"alert alert-danger\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>MP amount is 0.</div>";
294 header("Location: artist.php?art");
297 $index = $_GET['edit'];
298 // $newName = rand(1000000,9999999);
299 $newPrice = round(abs($_POST['price']));
300 unset($file[$index]);
302 $file[$index] = "<id>".$idVal."</id><name>{$name}</name><price>{$newPrice}</price><stat></stat>\n";
303 $data = implode("", $file);
304 $handler = fopen(ADB_PATH
."imglist.log", "w");
305 fwrite($handler, $data);
307 // rename("/home/auth/public_html/premium/".$name.".gif", "/home/auth/public_html/premium/".$newName.".gif");
308 $_SESSION['msg'] = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>Successfully edit.</div>";
309 header("Location: artist.php?art");
314 header("Location: artist.php?art");
318 <div
class="panel panel-default alist_art">
319 <a href
="#" class="thumbnail">
320 <img src
="<?php echo $livesitePath ?>premium/<?php echo $name ?>" style
="height:80px;" alt
="">
323 <div
class="clearfix"></div
>
325 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" style
="width:50%;" method
="POST">
326 <div
class="form-group">
327 <label
for="price">Price
:</label
> <br
>
328 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price" required
/><br
/>
330 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
332 <?php
echo "</div>";} ?
>
334 <!-- nakadisplay none to option
for create artist account
-->
335 <?php
if (isset($_GET['crar'])) {
336 if ($_SESSION['utype'] != "admin")
339 <div
class="panel panel-default optionlistview">
340 <div
class="panel-heading">
341 <center
><b
>Add
New Artist
</b
></center
>
344 <form role
="form" method
="post" style
="width:50%;">
345 <div
class="form-group">
346 <label
for="email" class="pull-left">Email address
</label
>
347 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
349 <div
class="form-group">
350 <label
for="password" class="pull-left">Password
</label
>
351 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
353 <div
class="form-group">
354 <label
for="confirmpassword" class="pull-left">Confirm Password
</label
>
355 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
357 <input type
="submit" class="btn btn-primary pull-left" name
="asub" value
="Create Artist">
358 <div
class="clearfix"></div
>
363 <!-- END nakadisplay none to option
for create artist account
-->
365 <!-- option
for view transaction
-->
366 <?php
if (isset($_GET['vtrans'])) {
367 if ($_SESSION['utype'] != "admin")
370 <div
class="panel panel-default optionlistview">
371 <div
class="panel-heading">
372 <center
><b
>Transactions
</b
></center
>
375 if (!file_exists(ADB_PATH
."artistlist.log")) {
376 echo "No transactions";
378 if (!file_exists(ADB_PATH
."transaction.log")) {
379 echo "No transactions";
382 echo "<table class=\"table table-striped\" style=\"background:white;\">
385 <td><b>Total Sold (MP)</b></td>
387 $arus = file(ADB_PATH
."artistlist.log");
389 foreach ($arus as $key => $value) {
390 $tmar = explode("<><>", $value);
391 $usemail[$i] = $tmar[1];
392 $arid[$i] = $tmar[0];
395 $vtrans = file(ADB_PATH
."transaction.log");
396 foreach ($vtrans as $key2 => $value2) {
397 $arr = within_str($value2,"<id>","</id>");
398 $val = within_str($value2,"<price>","</price>");
399 $kk = array_search($arr, $arid);
400 /*echo $arr."-".$val."-".$kk."<br>";*/
401 if (isset($arval[$kk])) {
402 $arval[$kk] = $arval[$kk]+
$val;
407 foreach ($arid as $key => $value) {
408 if ($value!=66666666) {
409 $kk = array_search($value, $arid);
410 /*if ($arval[$kk] != "" || $arval[$kk] != NULL) {*/
411 if (isset($arval[$kk])) {
413 <td>".$usemail[$kk]."</td>
414 <td>".@$arval[$kk]." Melon Points</td>
425 <!-- END option
for view transaction
-->
426 <?php
if (isset($_GET['alist'])) {
427 if ($_SESSION['utype'] != "admin")
431 <div
class="col-md-3">
432 <div
class="panel panel-default">
436 <ul id
="al" class="wordwrap_" style
="list-style:none; display:inline;">
437 <?php
include("a_list.php"); ?
>
441 <div
class="col-md-9">
442 <div
class="panel panel-default optionlistview">
443 <div
class="panel-heading"><center
><b
>Artworks
</b
></center
></div
><br
>
445 if (isset($_GET['v'])) {
446 error_reporting(E_ALL
); ini_set("display_errors", 1);
447 if (!file_exists(ADB_PATH
."imglist.log")) {
450 $__utmp = file(ADB_PATH
."imglist.log");
451 foreach ($__utmp as $key => $value) {
452 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
453 echo "<div class=\"panel panel-default alist_art\">
454 <a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">
455 <img src=\"http://be.2ch.net/premium/".within_str($value,"<name>","</name>")."\" style=\"height:80px;\" alt=\"\">
457 <span class=\"pull-right\">".within_str($value, "<price>", "</price>")."MP</span>
458 <div class=\"clearfix\"></div>
464 echo "Select Artist";
467 <div
class="clearfix"></div
>
473 <div
class="clearfix"></div
>
482 <script src
="js/jquery-1.9.1.js"></script
>
483 <script src
="js/bootstrap.js"></script
>