2 if (!isset($_COOKIE['ADMDM']) && !isset($_COOKIE['AMDMD'])) {
3 header('location:artist_login.php');
8 if (!isset($_SESSION['utype'])) {
9 header("location: a_out.php");
12 $email = Decrypt($_COOKIE['ADMDM'],AKEY
);
13 $dir = loggedEmail($email, "adb/");
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;">
42 $artistname = explode ("@", $_SESSION['aname']);
47 <div
class="clearfix"></div
>
49 <div
class="col-md-3">
50 <div
class="panel panel-default">
51 <div
class="panel-heading">
56 <ul id
="al" style
="list-style:none; display:inline;">
57 <?php
if ($_SESSION['utype'] == "admin") { ?
>
58 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
59 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
60 <li
><a href
="?alist">Artist
List</a
></li
>
61 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
62 <li
><a href
="?art">Art
List</a
></li
>
63 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
68 <div
class="col-md-9">
72 echo "<h3><b>Artist Area!</b></h3>";
74 if(isset($_SESSION['msg'])){
75 echo $_SESSION['msg'];
76 $_SESSION['msg'] = '';
80 <?php
if(isset($_GET['art'])){
81 echo "<div class=\"panel panel-default optionlistview\"><div class=\"panel-heading\"><center><b>Artworks</b></center></div><br>";
83 if(file_exists("/home/adb/imglist.log")){
84 $file = file("/home/adb/imglist.log");
85 if(isset($_GET['c'])){
86 if($_GET['c']=="delete"){
88 $filename = within_str($file[$id], "<name>", "</name>");
89 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
90 $data = implode("", $file);
91 $handler = fopen("/home/adb/imglist.log", "w");
92 fwrite($handler, $data);
94 /*$test = unlink("/home/auth/public_html/dev-test/premium/".$filename.".jpg");*/
96 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
97 header("Location: artist.php?art");
100 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to delete file. Either file doesn't exists</div>";
101 header("Location: artist.php?art");
104 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
105 header("Location: artist.php?art");
109 foreach ($file as $key => $value) {
110 $img = within_str($value, "<name>", "</name>").".gif";
111 $stat = within_str($value, "<stat>", "</stat>");
112 $id = within_str($value, "<id>", "</id>");
113 if(!$stat && $id==$_SESSION['artistid']){
114 echo "<div class=\"panel panel-default alist_art\">";
115 echo "<a href=\"#\" class=\"thumbnail\">";
116 echo "<img src=\"{$livesitePath}dev-test/premium/{$img}\" style=\"width:80px; height:80px;\" alt=\"\">";
119 echo "<span>" .within_str($value, "<price>", "</price>"). " MP</span><br>";
120 echo "<a href=\"artist.php?art&c=delete&id={$i}\">delete </a>";
121 echo "<a href=\"artist.php?edit={$i}\">edit </a></center>";
122 echo "<div class=\"clearfix\"></div>";
126 // if($i%4==0) { echo "<div class=\"clearfix\"></div>"; }
129 echo "<div class=\"clearfix\"></div>";
131 echo "Please upload your work";
136 }else if(isset($_GET['upload'])){ ?
>
141 if(isset($_POST['submitupload'])){
142 if(is_numeric($_POST['price'])){
144 $price = (int) $_POST['price'];
145 $price = abs($price);
146 $name = $_POST['name'];
149 $tmpName = $_FILES['uploadedfile']['tmp_name'];
151 $fdir = substr($email, 0, 1);
152 $sdir = substr($email, 1, 1);
153 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
154 if (!file_exists($path)) {
155 @mkdir
(ADB_PATH
."{$fdir}");
156 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
157 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
159 // echo $_FILES["file"]["type"];
161 if($_FILES["uploadedfile"]["type"] == "image/gif"){
162 $dirPath = "/home/auth/public_html/dev-test/premium/";
163 $name = rand(1000000,9999999);
164 $fname = $name.".gif";
165 if(!file_exists($dirPath.$fname)){
166 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
167 $uploadedFile = true;
170 $uploadedFile = false;
173 $_SESSION['msg'] = "<div class=\"alert alert-danger\">File already exist.</div>";
174 header("Location: artist.php?upload");
178 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Please upload GIF image only.</div>";
179 header("Location: artist.php?upload");
184 // if($uploadedFile){
186 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
187 // $filename = $path."/imagelist.txt";
189 // if (!file_exists($filename)) {
190 // if(!file_put_contents($filename,$writeData)) {
191 // $writeSuccess = false;
193 // $writeSuccess = true;
195 // $handle = fopen($filename, "a");
196 // if(!fwrite($handle, $writeData)) {
197 // $writeSuccess = false;
200 // $writeSuccess = true;
205 $handle = fopen("/home/adb/imglist.log", "a+");
206 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
209 $_SESSION['msg'] = "<div class=\"alert alert-success\">File successfully uploaded.</div>";
210 header("Location: artist.php?art");
213 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to upload file. Please contact admin.</div>";
214 header("Location: artist.php?upload");
219 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Price must be numeric.</div>";
220 header("Location: artist.php?upload");
227 <div
class="panel panel-default optionlistview">
228 <div
class="panel-heading">
229 <center
><b
>Upload Artwork
</b
></center
>
231 <form role
="form" style
="width:50%;" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
232 <input type
="hidden" name
="MAX_FILE_SIZE" value
="10000000" />
233 <div
class="form-group">
234 <label
for="price">Price
:</label
> <br
>
235 <input name
="price" type
="text" class="form-control" placeholder
="Price"/><br
/>
237 <div
class="form-group">
238 <label
for="price">Uploaded File
: </label
> <br
>
239 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price"/>
240 <span style
="font-size:12px;margin-top:3px;" class="pull-right">(only
.gif image is accepted
)</span
>
241 <div
class="clearfix"></div
>
243 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
244 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
249 <?php
}else if(isset($_GET['edit'])){
250 echo "<div class=\"panel panel-default optionlistview\">";
252 $file = file(ADB_PATH
."imglist.log");
253 // print_r(expression)
254 $index = $_GET['edit'];
255 $value = $file[$index];
256 $name = within_str($value, "<name>", "</name>");
257 $price = within_str($value, "<price>", "</price>");
258 $time = within_str($value, "<time>", "</time>");
259 $idVal = within_str($value, "<id>", "</id>");
262 if(isset($_POST['submitedit'])){
263 $index = $_GET['edit'];
264 // $newName = rand(1000000,9999999);
265 $newPrice = abs($_POST['price']);
266 unset($file[$index]);
268 $file[$index] = "<id>".$idVal."</id><name>{$name}</name><price>{$newPrice}</price><stat></stat>\n";
269 $data = implode("", $file);
270 $handler = fopen(ADB_PATH
."imglist.log", "w");
271 fwrite($handler, $data);
273 // rename("/home/auth/public_html/dev-test/premium/".$name.".gif", "/home/auth/public_html/dev-test/premium/".$newName.".gif");
274 $_SESSION['msg'] = "Successfully edit.";
275 header("Location: artist.php?art");
281 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" style
="width:50%;" method
="POST">
282 <input type
="hidden" name
="MAX_FILE_SIZE" value
="10000000" />
283 <div
class="form-group">
284 <label
for="price">Price
:</label
> <br
>
285 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price"/><br
/>
287 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
289 <?php
echo "</div>";} ?
>
291 <!-- nakadisplay none to option
for create artist account
-->
292 <?php
if (isset($_GET['crar'])) { ?
>
293 <div
class="panel panel-default optionlistview">
294 <div
class="panel-heading">
295 <center
><b
>Add
New Artist
</b
></center
>
298 <form role
="form" method
="post" style
="width:50%;">
299 <div
class="form-group">
300 <label
for="email" class="pull-left">Email address
</label
>
301 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
303 <div
class="form-group">
304 <label
for="password" class="pull-left">Password
</label
>
305 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
307 <div
class="form-group">
308 <label
for="confirmpassword" class="pull-left">Confirm Password
</label
>
309 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
311 <input type
="submit" class="btn btn-primary pull-left" name
="asub" value
="Create Artist">
312 <div
class="clearfix"></div
>
317 <!-- END nakadisplay none to option
for create artist account
-->
319 <!-- option
for view transaction
-->
320 <?php
if (isset($_GET['vtrans'])) { ?
>
321 <div
class="panel panel-default optionlistview">
322 <div
class="panel-heading">
323 <center
><b
>Transactions
</b
></center
>
326 if (!file_exists(ADB_PATH
."artistlist.log")) {
327 echo "No transactions";
329 if (!file_exists(ADB_PATH
."transaction.log")) {
330 echo "No transactions";
333 echo "<table class=\"table table-striped\" style=\"background:white;\">
336 <td><b>Total Sold (MP)</b></td>
338 $arus = file(ADB_PATH
."artistlist.log");
340 foreach ($arus as $key => $value) {
341 $tmar = explode("<><>", $value);
342 $usemail[$i] = $tmar[1];
343 $arid[$i] = $tmar[0];
346 $vtrans = file(ADB_PATH
."transaction.log");
347 foreach ($vtrans as $key2 => $value2) {
348 $arr = within_str($value2,"<id>","</id>");
349 $val = within_str($value2,"<price>","</price>");
350 $kk = array_search($arr, $arid);
351 /*echo $arr."-".$val."-".$kk."<br>";*/
352 if (isset($arval[$kk])) {
353 $arval[$kk] = $arval[$kk]+
$val;
358 foreach ($arid as $key => $value) {
359 if ($value!=66666666) {
360 $kk = array_search($value, $arid);
361 /*if ($arval[$kk] != "" || $arval[$kk] != NULL) {*/
362 if (isset($arval[$kk])) {
364 <td>".$usemail[$kk]."</td>
365 <td>".@$arval[$kk]." Melon Points</td>
376 <!-- END option
for view transaction
-->
377 <?php
if (isset($_GET['alist'])) { ?
>
379 <div
class="col-md-3">
380 <div
class="panel panel-default">
384 <ul id
="al" class="wordwrap_" style
="list-style:none; display:inline;">
385 <?php
include("a_list.php"); ?
>
389 <div
class="col-md-9">
390 <div
class="panel panel-default optionlistview">
391 <div
class="panel-heading"><center
><b
>Artworks
</b
></center
></div
><br
>
393 if (isset($_GET['v'])) {
394 error_reporting(E_ALL
); ini_set("display_errors", 1);
395 if (!file_exists(ADB_PATH
."imglist.log")) {
398 $__utmp = file(ADB_PATH
."imglist.log");
399 foreach ($__utmp as $key => $value) {
400 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
401 echo "<div class=\"panel panel-default alist_art\">
402 <a href=\"#\" class=\"thumbnail\">
403 <img src=\"http://be.2ch.net/dev-test/premium/".within_str($value,"<name>","</name>")."\" style=\"width:80px; height:80px;\" alt=\"\">
405 <span class=\"pull-right\">".within_str($value, "<price>", "</price>")."MP</span>
406 <div class=\"clearfix\"></div>
412 echo "Select Artist";
415 <div
class="clearfix"></div
>
421 <div
class="clearfix"></div
>
430 <!--script src
="js/jquery-1.9.1.js"></script
>
431 <script src
="js/bootstrap.js"></script
-->