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 $dirFull = loggedEmail($email, ADB_PATH
);
19 <meta charset
="UTF-8">
20 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
21 <meta name
="viewport" content
="width=device-width, initial-scale=1">
22 <title
>Artist Page
</title
>
23 <link rel
="stylesheet" href
="css/bootstrap.css">
24 <link rel
="stylesheet" href
="css/astyle.css">
27 <div
class="container body">
29 <div
class="col-md-12">
30 <div
class="panel panel-default">
31 <div
class="panel-heading">
33 <img src
="css/img/2ch_logo.gif" alt
="">
37 <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
>
38 <div
class="pull-left" style
="margin:10px 0px;">
39 <h4
><i
>Welcome
,</i
><b
>
41 $artistname = explode ("@", $_SESSION['aname']);
45 <div
class="clearfix"></div
>
47 <div
class="col-md-3">
48 <div
class="panel panel-default">
49 <div
class="panel-heading">
54 <ul id
="al" style
="list-style:none; display:inline;">
55 <?php
if ($_SESSION['utype'] == "admin") { ?
>
56 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
57 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
58 <li
><a href
="?alist">Artist
List</a
></li
>
59 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
60 <li
><a href
="?art">Art
List</a
></li
>
61 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
66 <div
class="col-md-9">
70 echo "<h3><b>Artist Area!</b></h3>";
72 if(isset($_SESSION['msg'])){
73 echo $_SESSION['msg'];
74 $_SESSION['msg'] = '';
78 <?php
if(isset($_GET['art'])){
79 echo "<div class=\"panel panel-default optionlistview\"><div class=\"panel-heading\"><center><b>Artworks</b></center></div><br>";
81 if(file_exists("/home/adb/imglist.log")){
82 $file = file("/home/adb/imglist.log");
83 if(isset($_GET['c'])){
84 if($_GET['c']=="delete"){
86 $filename = within_str($file[$id], "<name>", "</name>");
87 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
88 $data = implode("", $file);
89 $handler = fopen("/home/adb/imglist.log", "w");
90 fwrite($handler, $data);
92 /*$test = unlink("/home/auth/public_html/premium/".$filename.".jpg");*/
94 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
95 header("Location: artist.php?art");
98 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to delete file. Either file doesn't exists</div>";
99 header("Location: artist.php?art");
102 $_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>";
103 header("Location: artist.php?art");
107 foreach ($file as $key => $value) {
108 $img = within_str($value, "<name>", "</name>").".gif";
109 $stat = within_str($value, "<stat>", "</stat>");
110 $id = within_str($value, "<id>", "</id>");
111 if(!$stat && $id==$_SESSION['artistid']){
112 echo "<div class=\"panel panel-default alist_art\">";
113 echo "<a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">";
114 echo "<img src=\"{$livesitePath}premium/{$img}\" style=\"height:80px;\" alt=\"\">";
117 echo "<span>" .within_str($value, "<price>", "</price>"). " MP</span><br>";
118 echo "<a href=\"artist.php?art&c=delete&id={$i}\">delete </a>";
119 echo "<a href=\"artist.php?edit={$i}\">edit </a></center>";
120 echo "<div class=\"clearfix\"></div>";
124 // if($i%4==0) { echo "<div class=\"clearfix\"></div>"; }
127 echo "<div class=\"clearfix\"></div>";
129 echo "Please upload your work";
134 }else if(isset($_GET['upload'])){ ?
>
139 if(isset($_POST['submitupload'])){
140 if($_POST['price'] == 0 ||
!isset($_POST['price'])){
141 $_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>";
142 header("Location: artist.php?upload");
145 if($_FILES['uploadedfile']['size']<100000){
146 if(is_numeric($_POST['price'])){
148 $price = (int) $_POST['price'];
149 $price = round(abs($price));
150 $name = $_POST['name'];
152 $tmpName = $_FILES['uploadedfile']['tmp_name'];
154 $fdir = substr($email, 0, 1);
155 $sdir = substr($email, 1, 1);
156 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
157 if (!file_exists($path)) {
158 @mkdir
(ADB_PATH
."{$fdir}");
159 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
160 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
162 // echo $_FILES["file"]["type"];
164 if($_FILES["uploadedfile"]["type"] == "image/gif"){
165 $dirPath = "/home/auth/public_html/premium/";
166 $name = rand(1000000,9999999);
167 $fname = $name.".gif";
168 if(!file_exists($dirPath.$fname)){
169 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
170 $uploadedFile = true;
173 $uploadedFile = false;
176 $_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>";
177 header("Location: artist.php?upload");
181 $_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>";
182 header("Location: artist.php?upload");
187 // if($uploadedFile){
189 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
190 // $filename = $path."/imagelist.txt";
192 // if (!file_exists($filename)) {
193 // if(!file_put_contents($filename,$writeData)) {
194 // $writeSuccess = false;
196 // $writeSuccess = true;
198 // $handle = fopen($filename, "a");
199 // if(!fwrite($handle, $writeData)) {
200 // $writeSuccess = false;
203 // $writeSuccess = true;
208 $handle = fopen("/home/adb/imglist.log", "a+");
209 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
212 $_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>";
213 header("Location: artist.php?art");
216 $_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>";
217 header("Location: artist.php?upload");
222 $_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>";
223 header("Location: artist.php?upload");
227 $_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>";
228 header("Location: artist.php?upload");
235 <div
class="panel panel-default optionlistview">
236 <div
class="panel-heading">
237 <center
><b
>Upload Artwork
</b
></center
>
239 <form role
="form" style
="width:50%;" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
240 <div
class="form-group">
241 <label
for="price">Price
:</label
> <br
>
242 <input name
="price" type
="text" class="form-control" placeholder
="Price" required
/><br
/>
244 <div
class="form-group">
245 <label
for="price">Uploaded File
: </label
> <br
>
246 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price" required
/>
247 <span style
="font-size:12px;margin-top:3px;" class="pull-right">(only
.gif image is accepted
)</span
>
248 <div
class="clearfix"></div
>
250 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
251 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
256 <?php
}else if(isset($_GET['edit'])){
258 echo "<div class=\"panel panel-default optionlistview\">";
259 if(empty($_GET['edit'])){
262 // $_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>";
263 header("Location: artist.php?art");
267 $file = file(ADB_PATH
."imglist.log");
268 // print_r(expression)
269 $index = $_GET['edit'];
275 $value = $file[$index];
276 $name = within_str($value, "<name>", "</name>");
277 $price = within_str($value, "<price>", "</price>");
278 $time = within_str($value, "<time>", "</time>");
279 $idVal = within_str($value, "<id>", "</id>");
282 if(isset($_POST['submitedit'])){
283 if($_POST['price'] == 0 ||
!isset($_POST['price'])){
284 $_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>";
285 header("Location: artist.php?art");
288 $index = $_GET['edit'];
289 // $newName = rand(1000000,9999999);
290 $newPrice = round(abs($_POST['price']));
291 unset($file[$index]);
293 $file[$index] = "<id>".$idVal."</id><name>{$name}</name><price>{$newPrice}</price><stat></stat>\n";
294 $data = implode("", $file);
295 $handler = fopen(ADB_PATH
."imglist.log", "w");
296 fwrite($handler, $data);
298 // rename("/home/auth/public_html/premium/".$name.".gif", "/home/auth/public_html/premium/".$newName.".gif");
299 $_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>";
300 header("Location: artist.php?art");
305 header("Location: artist.php?art");
309 <div
class="panel panel-default alist_art">
310 <a href
="#" class="thumbnail">
311 <img src
="<?php echo $livesitePath ?>premium/<?php echo $name ?>" style
="height:80px;" alt
="">
314 <div
class="clearfix"></div
>
316 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" style
="width:50%;" method
="POST">
317 <div
class="form-group">
318 <label
for="price">Price
:</label
> <br
>
319 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price" required
/><br
/>
321 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
323 <?php
echo "</div>";} ?
>
325 <!-- nakadisplay none to option
for create artist account
-->
326 <?php
if (isset($_GET['crar'])) {
327 if ($_SESSION['utype'] != "admin")
330 <div
class="panel panel-default optionlistview">
331 <div
class="panel-heading">
332 <center
><b
>Add
New Artist
</b
></center
>
335 <form role
="form" method
="post" style
="width:50%;">
336 <div
class="form-group">
337 <label
for="email" class="pull-left">Email address
</label
>
338 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
340 <div
class="form-group">
341 <label
for="password" class="pull-left">Password
</label
>
342 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
344 <div
class="form-group">
345 <label
for="confirmpassword" class="pull-left">Confirm Password
</label
>
346 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
348 <input type
="submit" class="btn btn-primary pull-left" name
="asub" value
="Create Artist">
349 <div
class="clearfix"></div
>
354 <!-- END nakadisplay none to option
for create artist account
-->
356 <!-- option
for view transaction
-->
357 <?php
if (isset($_GET['vtrans'])) {
358 if ($_SESSION['utype'] != "admin")
361 <div
class="panel panel-default optionlistview">
362 <div
class="panel-heading">
363 <center
><b
>Transactions
</b
></center
>
366 if (!file_exists(ADB_PATH
."artistlist.log")) {
367 echo "No transactions";
369 if (!file_exists(ADB_PATH
."transaction.log")) {
370 echo "No transactions";
373 echo "<table class=\"table table-striped\" style=\"background:white;\">
376 <td><b>Total Sold (MP)</b></td>
378 $arus = file(ADB_PATH
."artistlist.log");
380 foreach ($arus as $key => $value) {
381 $tmar = explode("<><>", $value);
382 $usemail[$i] = $tmar[1];
383 $arid[$i] = $tmar[0];
386 $vtrans = file(ADB_PATH
."transaction.log");
387 foreach ($vtrans as $key2 => $value2) {
388 $arr = within_str($value2,"<id>","</id>");
389 $val = within_str($value2,"<price>","</price>");
390 $kk = array_search($arr, $arid);
391 /*echo $arr."-".$val."-".$kk."<br>";*/
392 if (isset($arval[$kk])) {
393 $arval[$kk] = $arval[$kk]+
$val;
398 foreach ($arid as $key => $value) {
399 if ($value!=66666666) {
400 $kk = array_search($value, $arid);
401 /*if ($arval[$kk] != "" || $arval[$kk] != NULL) {*/
402 if (isset($arval[$kk])) {
404 <td>".$usemail[$kk]."</td>
405 <td>".@$arval[$kk]." Melon Points</td>
416 <!-- END option
for view transaction
-->
417 <?php
if (isset($_GET['alist'])) {
418 if ($_SESSION['utype'] != "admin")
422 <div
class="col-md-3">
423 <div
class="panel panel-default">
427 <ul id
="al" class="wordwrap_" style
="list-style:none; display:inline;">
428 <?php
include("a_list.php"); ?
>
432 <div
class="col-md-9">
433 <div
class="panel panel-default optionlistview">
434 <div
class="panel-heading"><center
><b
>Artworks
</b
></center
></div
><br
>
436 if (isset($_GET['v'])) {
437 error_reporting(E_ALL
); ini_set("display_errors", 1);
438 if (!file_exists(ADB_PATH
."imglist.log")) {
441 $__utmp = file(ADB_PATH
."imglist.log");
442 foreach ($__utmp as $key => $value) {
443 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
444 echo "<div class=\"panel panel-default alist_art\">
445 <a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">
446 <img src=\"http://be.2ch.net/premium/".within_str($value,"<name>","</name>")."\" style=\"height:80px;\" alt=\"\">
448 <span class=\"pull-right\">".within_str($value, "<price>", "</price>")."MP</span>
449 <div class=\"clearfix\"></div>
455 echo "Select Artist";
458 <div
class="clearfix"></div
>
464 <div
class="clearfix"></div
>
473 <script src
="js/jquery-1.9.1.js"></script
>
474 <script src
="js/bootstrap.js"></script
>