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
);
16 function FindUser($id) {
17 $list = file("/home/adb/artistlist.log");
20 foreach ($list as $key => $value) {
21 if (substr(trim($value), 0, 9) == $id) {
22 $r = explode("<><>", $value);
38 <meta charset
="UTF-8">
39 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
40 <meta name
="viewport" content
="width=device-width, initial-scale=1">
41 <title
>Artist Page
</title
>
42 <link rel
="stylesheet" href
="css/bootstrap.css">
43 <link rel
="stylesheet" href
="css/astyle.css">
46 <div
class="container body">
48 <div
class="col-md-12">
49 <div
class="panel panel-default">
50 <div
class="panel-heading">
52 <img src
="css/img/2ch_logo.gif" alt
="">
56 <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
>
57 <div
class="pull-left" style
="margin:10px 0px;">
58 <h4
><i
>Welcome
,</i
><b
>
60 $artistname = explode ("@", $_SESSION['aname']);
64 <div
class="clearfix"></div
>
66 <div
class="col-md-3">
67 <div
class="panel panel-default">
68 <div
class="panel-heading">
73 <ul id
="al" style
="list-style:none; display:inline;">
74 <?php
if ($_SESSION['utype'] == "admin") { ?
>
75 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
76 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
77 <li
><a href
="?alist">Artist
List</a
></li
>
78 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
79 <li
><a href
="?art">Art
List</a
></li
>
80 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
85 <div
class="col-md-9">
89 echo "<h3><b>Artist Area!</b></h3>";
91 if(isset($_SESSION['msg'])){
92 echo $_SESSION['msg'];
93 $_SESSION['msg'] = '';
97 <?php
if(isset($_GET['art'])){
98 echo "<div class=\"panel panel-default optionlistview\"><div class=\"panel-heading\"><center><b>Artworks</b></center></div><br>";
100 if(file_exists("/home/adb/imglist.log")){
101 $file = file("/home/adb/imglist.log");
102 if(isset($_GET['c'])){
103 if($_GET['c']=="delete"){
105 $filename = within_str($file[$id], "<name>", "</name>");
106 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
107 $data = implode("", $file);
108 $handler = fopen("/home/adb/imglist.log", "w");
109 fwrite($handler, $data);
111 /*$test = unlink("/home/auth/public_html/dev-test/premium/".$filename.".jpg");*/
113 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
114 header("Location: artist.php?art");
117 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to delete file. Either file doesn't exists</div>";
118 header("Location: artist.php?art");
121 $_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>";
122 header("Location: artist.php?art");
126 foreach ($file as $key => $value) {
127 $img = within_str($value, "<name>", "</name>").".gif";
128 $stat = within_str($value, "<stat>", "</stat>");
129 $id = within_str($value, "<id>", "</id>");
130 if(!$stat && $id==$_SESSION['artistid']){
131 echo "<div class=\"panel panel-default alist_art\">";
132 echo "<a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">";
133 echo "<img src=\"{$livesitePath}dev-test/premium/{$img}\" style=\"height:80px;\" alt=\"\">";
136 echo "<span>" .within_str($value, "<price>", "</price>"). " MP</span><br>";
137 echo "<a href=\"artist.php?art&c=delete&id={$i}\">delete </a>";
138 echo "<a href=\"artist.php?edit={$i}\">edit </a></center>";
139 echo "<div class=\"clearfix\"></div>";
143 // if($i%4==0) { echo "<div class=\"clearfix\"></div>"; }
146 echo "<div class=\"clearfix\"></div>";
148 echo "Please upload your work";
153 }else if(isset($_GET['upload'])){ ?
>
158 if(isset($_POST['submitupload'])){
159 if($_FILES['uploadedfile']['size']<100000){
160 if(is_numeric($_POST['price'])){
162 $price = (int) $_POST['price'];
163 $price = abs($price);
164 $name = $_POST['name'];
166 $tmpName = $_FILES['uploadedfile']['tmp_name'];
168 $fdir = substr($email, 0, 1);
169 $sdir = substr($email, 1, 1);
170 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
171 if (!file_exists($path)) {
172 @mkdir
(ADB_PATH
."{$fdir}");
173 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
174 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
176 // echo $_FILES["file"]["type"];
178 if($_FILES["uploadedfile"]["type"] == "image/gif"){
179 $dirPath = "/home/auth/public_html/dev-test/premium/";
180 $name = rand(1000000,9999999);
181 $fname = $name.".gif";
182 if(!file_exists($dirPath.$fname)){
183 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
184 $uploadedFile = true;
187 $uploadedFile = false;
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>File already exist.</div>";
191 header("Location: artist.php?upload");
195 $_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>";
196 header("Location: artist.php?upload");
201 // if($uploadedFile){
203 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
204 // $filename = $path."/imagelist.txt";
206 // if (!file_exists($filename)) {
207 // if(!file_put_contents($filename,$writeData)) {
208 // $writeSuccess = false;
210 // $writeSuccess = true;
212 // $handle = fopen($filename, "a");
213 // if(!fwrite($handle, $writeData)) {
214 // $writeSuccess = false;
217 // $writeSuccess = true;
222 $handle = fopen("/home/adb/imglist.log", "a+");
223 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
226 $_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>";
227 header("Location: artist.php?art");
230 $_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>";
231 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>Price must be numeric.</div>";
237 header("Location: artist.php?upload");
241 $_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>";
242 header("Location: artist.php?upload");
249 <div
class="panel panel-default optionlistview">
250 <div
class="panel-heading">
251 <center
><b
>Upload Artwork
</b
></center
>
253 <form role
="form" style
="width:50%;" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
254 <div
class="form-group">
255 <label
for="price">Price
:</label
> <br
>
256 <input name
="price" type
="text" class="form-control" placeholder
="Price"/><br
/>
258 <div
class="form-group">
259 <label
for="price">Uploaded File
: </label
> <br
>
260 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price"/>
261 <span style
="font-size:12px;margin-top:3px;" class="pull-right">(only
.gif image is accepted
)</span
>
262 <div
class="clearfix"></div
>
264 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
265 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
270 <?php
}else if(isset($_GET['edit'])){
271 echo "<div class=\"panel panel-default optionlistview\">";
273 $file = file(ADB_PATH
."imglist.log");
274 // print_r(expression)
275 $index = $_GET['edit'];
276 $value = $file[$index];
277 $name = within_str($value, "<name>", "</name>");
278 $price = within_str($value, "<price>", "</price>");
279 $time = within_str($value, "<time>", "</time>");
280 $idVal = within_str($value, "<id>", "</id>");
283 if(isset($_POST['submitedit'])){
284 $index = $_GET['edit'];
285 // $newName = rand(1000000,9999999);
286 $newPrice = abs($_POST['price']);
287 unset($file[$index]);
289 $file[$index] = "<id>".$idVal."</id><name>{$name}</name><price>{$newPrice}</price><stat></stat>\n";
290 $data = implode("", $file);
291 $handler = fopen(ADB_PATH
."imglist.log", "w");
292 fwrite($handler, $data);
294 // rename("/home/auth/public_html/dev-test/premium/".$name.".gif", "/home/auth/public_html/dev-test/premium/".$newName.".gif");
295 $_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>";
296 header("Location: artist.php?art");
301 <div
class="panel panel-default alist_art">
302 <a href
="#" class="thumbnail">
303 <img src
="<?php echo $livesitePath ?>dev-test/premium/<?php echo $name ?>" style
="height:80px;" alt
="">
306 <div
class="clearfix"></div
>
308 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" style
="width:50%;" method
="POST">
309 <div
class="form-group">
310 <label
for="price">Price
:</label
> <br
>
311 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price"/><br
/>
313 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
315 <?php
echo "</div>";} ?
>
317 <!-- nakadisplay none to option
for create artist account
-->
318 <?php
if (isset($_GET['crar'])) { ?
>
319 <div
class="panel panel-default optionlistview">
320 <div
class="panel-heading">
321 <center
><b
>Add
New Artist
</b
></center
>
324 <form role
="form" method
="post" style
="width:50%;">
325 <div
class="form-group">
326 <label
for="email" class="pull-left">Email address
</label
>
327 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
329 <div
class="form-group">
330 <label
for="password" class="pull-left">Password
</label
>
331 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
333 <div
class="form-group">
334 <label
for="confirmpassword" class="pull-left">Confirm Password
</label
>
335 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
337 <input type
="submit" class="btn btn-primary pull-left" name
="asub" value
="Create Artist">
338 <div
class="clearfix"></div
>
343 <!-- END nakadisplay none to option
for create artist account
-->
345 <!-- option
for view transaction
-->
346 <?php
if (isset($_GET['vtrans'])) { ?
>
347 <div
class="panel panel-default optionlistview">
348 <div
class="panel-heading">
349 <center
><b
>Transactions
</b
></center
>
352 if (!file_exists(ADB_PATH
."artistlist.log")) {
353 echo "No transactions";
355 if (!file_exists(ADB_PATH
."transaction.log")) {
356 echo "No transactions";
359 echo "<div class=\"panel-group\" id=\"accordion\">
360 <div class=\"panel panel-default\">
362 $arus = file(ADB_PATH
."artistlist.log");
364 foreach ($arus as $key => $value) {
365 $tmar = explode("<><>", $value);
366 $usemail[$i] = $tmar[1];
367 $arid[$i] = $tmar[0];
370 $vtrans = file(ADB_PATH
."transaction.log");
371 foreach ($vtrans as $key2 => $value2) {
372 $arr = within_str($value2,"<id>","</id>");
373 $val = within_str($value2,"<price>","</price>");
374 $kk = array_search($arr, $arid);
375 /*echo $arr."-".$val."-".$kk."<br>";*/
376 if (isset($arval[$kk])) {
377 $arval[$kk] = $arval[$kk]+
$val;
384 foreach ($arid as $key => $value) {
385 if ($value!=66666666) {
386 $kk = array_search($value, $arid);
387 if (isset($arval[$kk])) {
389 $ownnow[trim($usemail[$kk])] = $arval[$kk];
390 /*var_dump($usemail);*/
391 /*echo "<div class=\"panel-heading\">
392 <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$breakerArid."\">
393 <strong>".$usemail[$kk]."</strong> -
394 <strong>".@$arval[$kk]." Melon Points</strong>
397 <div id=\"".$breakerArid."\" class=\"panel-collapse collapse\">
398 <div class=\"panel-body\">
400 foreach ($test as $key2 => $value2) {
413 /*var_dump($ownnow);*/
416 foreach ($vtrans as $key => $value) {
417 $test[within_str($value,"<id>","</id>")][$breaker] = $value;
427 foreach ($test as $key => $value) {
428 foreach ($value as $key2 => $value2) {
429 $array[within_str($value2, "<name>", "</name>")] = 0;
433 foreach ($test as $key => $value) {
435 echo "<div class=\"panel-heading\">
436 <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$key."\">
437 ".FindUser($key)." ".$ownnow[trim(FindUser($key))]."</a></div>
438 <div id=\"".$key."\" class=\"panel-collapse collapse\">
440 foreach ($value as $key2 => $value2) {
441 echo "<img width='30px' height='30px' src=\"".$livesitePath."premium/".within_str($value2, "<name>", "</name>").".gif\">".within_str($value2, "<price>", "</price>")."ASD<br>";
446 // foreach ($arid as $key => $value) {
447 // if ($value!=66666666) {
448 // $kk = array_search($value, $arid);
449 // /*if ($arval[$kk] != "" || $arval[$kk] != NULL) {*/
450 // if (isset($arval[$kk])) {
454 // echo "<div class=\"panel-heading\">
455 // <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$breakerArid."\">
456 // <strong>".$usemail[$kk]."</strong> -
457 // <strong>".@$arval[$kk]." Melon Points</strong>
460 // <div id=\"".$breakerArid."\" class=\"panel-collapse collapse\">
461 // <div class=\"panel-body\">
463 // foreach ($test as $key2 => $value2) {
485 <!-- END option
for view transaction
-->
486 <?php
if (isset($_GET['alist'])) { ?
>
488 <div
class="col-md-3">
489 <div
class="panel panel-default">
493 <ul id
="al" class="wordwrap_" style
="list-style:none; display:inline;">
494 <?php
include("a_list.php"); ?
>
498 <div
class="col-md-9">
499 <div
class="panel panel-default optionlistview">
500 <div
class="panel-heading"><center
><b
>Artworks
</b
></center
></div
><br
>
502 if (isset($_GET['v'])) {
503 error_reporting(E_ALL
); ini_set("display_errors", 1);
504 if (!file_exists(ADB_PATH
."imglist.log")) {
507 $__utmp = file(ADB_PATH
."imglist.log");
508 foreach ($__utmp as $key => $value) {
509 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
510 echo "<div class=\"panel panel-default alist_art\">
511 <a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">
512 <img src=\"http://be.2ch.net/dev-test/premium/".within_str($value,"<name>","</name>")."\" style=\"height:80px;\" alt=\"\">
514 <span class=\"pull-right\">".within_str($value, "<price>", "</price>")."MP</span>
515 <div class=\"clearfix\"></div>
521 echo "Select Artist";
524 <div
class="clearfix"></div
>
530 <div
class="clearfix"></div
>
539 <script src
="js/jquery-1.9.1.js"></script
>
540 <script src
="js/bootstrap.js"></script
>