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
);
17 function FindUser($id) {
18 $list = file("/home/adb/artistlist.log");
21 foreach ($list as $key => $value) {
22 if (substr(trim($value), 0, 9) == $id) {
23 $r = explode("<><>", $value);
39 <meta charset
="UTF-8">
40 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
41 <meta name
="viewport" content
="width=device-width, initial-scale=1">
42 <title
>Artist Page
</title
>
43 <link rel
="stylesheet" href
="css/bootstrap.css">
44 <link rel
="stylesheet" href
="css/astyle.css">
47 <div
class="container body">
49 <div
class="col-md-12">
50 <div
class="panel panel-default">
51 <div
class="panel-heading">
53 <img src
="css/img/2ch_logo.gif" alt
="">
57 <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
>
58 <div
class="pull-left" style
="margin:10px 0px;">
59 <h4
><i
>Welcome
,</i
><b
>
61 $artistname = explode ("@", $_SESSION['aname']);
65 <div
class="clearfix"></div
>
67 <div
class="col-md-3">
68 <div
class="panel panel-default">
69 <div
class="panel-heading">
74 <ul id
="al" style
="list-style:none; display:inline;">
75 <?php
if ($_SESSION['utype'] == "admin") { ?
>
76 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
77 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
78 <li
><a href
="?alist">Artist
List</a
></li
>
79 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
80 <li
><a href
="?art">Art
List</a
></li
>
81 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
86 <div
class="col-md-9">
90 echo "<h3><b>Artist Area!</b></h3>";
92 if(isset($_SESSION['msg'])){
93 echo $_SESSION['msg'];
94 $_SESSION['msg'] = '';
98 <?php
if(isset($_GET['art'])){
99 echo "<div class=\"panel panel-default optionlistview\"><div class=\"panel-heading\"><center><b>Artworks</b></center></div><br>";
101 if(file_exists("/home/adb/imglist.log")){
102 $file = file("/home/adb/imglist.log");
103 if(isset($_GET['c'])){
104 if($_GET['c']=="delete"){
106 $filename = within_str($file[$id], "<name>", "</name>");
107 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
108 $data = implode("", $file);
109 $handler = fopen("/home/adb/imglist.log", "w");
110 fwrite($handler, $data);
112 $_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>";
113 header("Location: artist.php?art");
117 foreach ($file as $key => $value) {
118 $img = within_str($value, "<name>", "</name>").".gif";
119 $stat = within_str($value, "<stat>", "</stat>");
120 $id = within_str($value, "<id>", "</id>");
121 if(!$stat && $id==$_SESSION['artistid']){
123 $hmimg = explode(".gif", trim($img));
124 foreach ($howmany as $key9 => $value9) {
125 if (within_str(trim($value9), "<name>", "</name>") == trim($hmimg[0])) {
128 /*echo within_str(trim($value9), "<name>", "</name>");*/
130 echo "<div class=\"panel panel-default alist_art\">";
131 echo "<a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">";
132 echo "<img src=\"{$livesitePath}dev-test/premium/{$img}\" style=\"height:80px;\" alt=\"\">";
135 echo "<span>" .within_str($value, "<price>", "</price>"). " MP<br>{$hmctr} time/s bought</span><br>";
136 echo "<a href=\"artist.php?art&c=delete&id={$i}\">delete </a>";
137 echo "<a href=\"artist.php?edit={$i}\">edit </a></center>";
138 echo "<div class=\"clearfix\"></div>";
142 // if($i%4==0) { echo "<div class=\"clearfix\"></div>"; }
145 echo "<div class=\"clearfix\"></div>";
147 echo "Please upload your work";
152 }else if(isset($_GET['upload'])){ ?
>
157 if(isset($_POST['submitupload'])){
158 if($_FILES['uploadedfile']['size']<100000){
159 if(is_numeric($_POST['price'])){
161 $price = (int) $_POST['price'];
162 $price = abs($price);
163 $name = $_POST['name'];
165 $tmpName = $_FILES['uploadedfile']['tmp_name'];
167 $fdir = substr($email, 0, 1);
168 $sdir = substr($email, 1, 1);
169 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
170 if (!file_exists($path)) {
171 @mkdir
(ADB_PATH
."{$fdir}");
172 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
173 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
175 // echo $_FILES["file"]["type"];
177 if($_FILES["uploadedfile"]["type"] == "image/gif"){
178 $dirPath = "/home/auth/public_html/dev-test/premium/";
179 $name = rand(1000000,9999999);
180 $fname = $name.".gif";
181 if(!file_exists($dirPath.$fname)){
182 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
183 $uploadedFile = true;
186 $uploadedFile = false;
189 $_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>";
190 header("Location: artist.php?upload");
194 $_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>";
195 header("Location: artist.php?upload");
200 // if($uploadedFile){
202 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
203 // $filename = $path."/imagelist.txt";
205 // if (!file_exists($filename)) {
206 // if(!file_put_contents($filename,$writeData)) {
207 // $writeSuccess = false;
209 // $writeSuccess = true;
211 // $handle = fopen($filename, "a");
212 // if(!fwrite($handle, $writeData)) {
213 // $writeSuccess = false;
216 // $writeSuccess = true;
221 $handle = fopen("/home/adb/imglist.log", "a+");
222 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
225 $_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>";
226 header("Location: artist.php?art");
229 $_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>";
230 header("Location: artist.php?upload");
235 $_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>";
236 header("Location: artist.php?upload");
240 $_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>";
241 header("Location: artist.php?upload");
248 <div
class="panel panel-default optionlistview">
249 <div
class="panel-heading">
250 <center
><b
>Upload Artwork
</b
></center
>
252 <form role
="form" style
="width:50%;" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
253 <div
class="form-group">
254 <label
for="price">Price
:</label
> <br
>
255 <input name
="price" type
="text" class="form-control" placeholder
="Price"/><br
/>
257 <div
class="form-group">
258 <label
for="price">Uploaded File
: </label
> <br
>
259 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price"/>
260 <span style
="font-size:12px;margin-top:3px;" class="pull-right">(only
.gif image is accepted
)</span
>
261 <div
class="clearfix"></div
>
263 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
264 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
269 <?php
}else if(isset($_GET['edit'])){
270 echo "<div class=\"panel panel-default optionlistview\">";
272 $file = file(ADB_PATH
."imglist.log");
273 // print_r(expression)
274 $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 $index = $_GET['edit'];
284 // $newName = rand(1000000,9999999);
285 $newPrice = abs($_POST['price']);
286 unset($file[$index]);
288 $file[$index] = "<id>".$idVal."</id><name>{$name}</name><price>{$newPrice}</price><stat></stat>\n";
289 $data = implode("", $file);
290 $handler = fopen(ADB_PATH
."imglist.log", "w");
291 fwrite($handler, $data);
293 // rename("/home/auth/public_html/dev-test/premium/".$name.".gif", "/home/auth/public_html/dev-test/premium/".$newName.".gif");
294 $_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>";
295 header("Location: artist.php?art");
300 <div
class="panel panel-default alist_art">
301 <a href
="#" class="thumbnail">
302 <img src
="<?php echo $livesitePath ?>dev-test/premium/<?php echo $name ?>" style
="height:80px;" alt
="">
305 <div
class="clearfix"></div
>
307 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" style
="width:50%;" method
="POST">
308 <div
class="form-group">
309 <label
for="price">Price
:</label
> <br
>
310 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price"/><br
/>
312 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
314 <?php
echo "</div>";} ?
>
316 <!-- nakadisplay none to option
for create artist account
-->
317 <?php
if (isset($_GET['crar'])) { ?
>
318 <div
class="panel panel-default optionlistview">
319 <div
class="panel-heading">
320 <center
><b
>Add
New Artist
</b
></center
>
323 <form role
="form" method
="post" style
="width:50%;">
324 <div
class="form-group">
325 <label
for="email" class="pull-left">Email address
</label
>
326 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
328 <div
class="form-group">
329 <label
for="password" class="pull-left">Password
</label
>
330 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
332 <div
class="form-group">
333 <label
for="confirmpassword" class="pull-left">Confirm Password
</label
>
334 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
336 <input type
="submit" class="btn btn-primary pull-left" name
="asub" value
="Create Artist">
337 <div
class="clearfix"></div
>
342 <!-- END nakadisplay none to option
for create artist account
-->
344 <!-- option
for view transaction
-->
345 <?php
if (isset($_GET['vtrans'])) { ?
>
346 <div
class="panel panel-default optionlistview">
347 <div
class="panel-heading">
348 <center
><b
>Transactions
</b
></center
>
351 if (!file_exists(ADB_PATH
."artistlist.log")) {
352 echo "No transactions";
354 if (!file_exists(ADB_PATH
."transaction.log")) {
355 echo "No transactions";
358 echo "<div class=\"panel-group\" id=\"accordion\">
359 <div class=\"panel panel-default\">
361 $arus = file(ADB_PATH
."artistlist.log");
363 foreach ($arus as $key => $value) {
364 $tmar = explode("<><>", $value);
365 $usemail[$i] = $tmar[1];
366 $arid[$i] = $tmar[0];
369 $vtrans = file(ADB_PATH
."transaction.log");
370 foreach ($vtrans as $key2 => $value2) {
371 $arr = within_str($value2,"<id>","</id>");
372 $val = within_str($value2,"<price>","</price>");
373 $kk = array_search($arr, $arid);
374 /*echo $arr."-".$val."-".$kk."<br>";*/
375 if (isset($arval[$kk])) {
376 $arval[$kk] = $arval[$kk]+
$val;
383 foreach ($arid as $key => $value) {
384 if ($value!=66666666) {
385 $kk = array_search($value, $arid);
386 if (isset($arval[$kk])) {
388 $ownnow[trim($usemail[$kk])] = $arval[$kk];
389 /*var_dump($usemail);*/
390 /*echo "<div class=\"panel-heading\">
391 <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$breakerArid."\">
392 <strong>".$usemail[$kk]."</strong> -
393 <strong>".@$arval[$kk]." Melon Points</strong>
396 <div id=\"".$breakerArid."\" class=\"panel-collapse collapse\">
397 <div class=\"panel-body\">
399 foreach ($test as $key2 => $value2) {
412 /*var_dump($ownnow);*/
415 foreach ($vtrans as $key => $value) {
416 $test[within_str($value,"<id>","</id>")][$breaker] = $value;
426 foreach ($test as $key => $value) {
427 foreach ($value as $key2 => $value2) {
428 $array[within_str($value2, "<name>", "</name>")] = 0;
432 foreach ($test as $key => $value) {
434 echo "<div class=\"panel-heading\">
435 <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$key."\">
436 ".FindUser($key)." ".$ownnow[trim(FindUser($key))]."</a></div>
437 <div id=\"".$key."\" class=\"panel-collapse collapse\">
439 foreach ($value as $key2 => $value2) {
440 echo "<img width='30px' height='30px' src=\"".$livesitePath."premium/".within_str($value2, "<name>", "</name>").".gif\">".within_str($value2, "<price>", "</price>")."ASD<br>";
445 // foreach ($arid as $key => $value) {
446 // if ($value!=66666666) {
447 // $kk = array_search($value, $arid);
448 // /*if ($arval[$kk] != "" || $arval[$kk] != NULL) {*/
449 // if (isset($arval[$kk])) {
453 // echo "<div class=\"panel-heading\">
454 // <a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#".$breakerArid."\">
455 // <strong>".$usemail[$kk]."</strong> -
456 // <strong>".@$arval[$kk]." Melon Points</strong>
459 // <div id=\"".$breakerArid."\" class=\"panel-collapse collapse\">
460 // <div class=\"panel-body\">
462 // foreach ($test as $key2 => $value2) {
484 <!-- END option
for view transaction
-->
485 <?php
if (isset($_GET['alist'])) { ?
>
487 <div
class="col-md-3">
488 <div
class="panel panel-default">
492 <ul id
="al" class="wordwrap_" style
="list-style:none; display:inline;">
493 <?php
include("a_list.php"); ?
>
497 <div
class="col-md-9">
498 <div
class="panel panel-default optionlistview">
499 <div
class="panel-heading"><center
><b
>Artworks
</b
></center
></div
><br
>
501 if (isset($_GET['v'])) {
502 error_reporting(E_ALL
); ini_set("display_errors", 1);
503 if (!file_exists(ADB_PATH
."imglist.log")) {
506 $__utmp = file(ADB_PATH
."imglist.log");
507 foreach ($__utmp as $key => $value) {
508 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
509 echo "<div class=\"panel panel-default alist_art\">
510 <a href=\"#\" class=\"thumbnail\" style=\"margin-bottom: 1em!important;\">
511 <img src=\"http://be.2ch.net/dev-test/premium/".within_str($value,"<name>","</name>")."\" style=\"height:80px;\" alt=\"\">
513 <span class=\"pull-right\">".within_str($value, "<price>", "</price>")."MP</span>
514 <div class=\"clearfix\"></div>
520 echo "Select Artist";
523 <div
class="clearfix"></div
>
529 <div
class="clearfix"></div
>
538 <script src
="js/jquery-1.9.1.js"></script
>
539 <script src
="js/bootstrap.js"></script
>