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 echo $_SESSION['artistid'];
14 $email = Decrypt($_COOKIE['ADMDM'],AKEY
);
15 $dir = loggedEmail($email, "adb/");
17 $dirFull = loggedEmail($email, ADB_PATH
);
22 <meta charset
="UTF-8">
23 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
24 <meta name
="viewport" content
="width=device-width, initial-scale=1">
25 <title
>Artist Page
</title
>
26 <link rel
="stylesheet" href
="css/bootstrap.css">
27 <link rel
="stylesheet" href
="css/astyle.css">
30 <div
class="container body">
32 <div
class="col-md-12">
33 <div
class="panel panel-default">
34 <div
class="panel-heading">
36 <img src
="css/img/2ch_logo.gif" alt
="">
40 <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
>
41 <div
class="clearfix"></div
>
43 <div
class="col-md-3">
44 <div
class="panel panel-default">
45 <div
class="panel-heading">
50 <ul id
="al" style
="list-style:none; display:inline;">
51 <?php
if ($_SESSION['utype'] == "admin") { ?
>
52 <li
><a href
="?crar">Create Artist Account
</a
> 
; 
; 
;</li
>
53 <li
><a href
="?vtrans">View Transactions
</a
> 
; 
; 
;</li
>
54 <li
><a href
="?alist">Artist
List</a
></li
>
55 <?php
} elseif ($_SESSION['utype'] == "user") { ?
>
56 <li
><a href
="?art">Art
List</a
></li
>
57 <li
><a href
="?upload">Upload Image
</a
> 
; 
; 
;</li
>
62 <div
class="col-md-9">
64 if(isset($_SESSION['msg'])){
65 echo $_SESSION['msg'];
66 $_SESSION['msg'] = '';
69 <div
class="panel panel-default optionlistview" style
="background:#f5f5f5;">
71 <?php
if(isset($_GET['art'])){
73 if(file_exists("/home/adb/imglist.log")){
74 $file = file("/home/adb/imglist.log");
75 if(isset($_GET['c'])){
76 if($_GET['c']=="delete"){
78 $filename = within_str($file[$id], "<name>", "</name>");
79 $file[$id]= str_replace("<stat></stat>","<stat>deleted</stat>",$file[$id]);
80 $data = implode("", $file);
81 $handler = fopen("/home/adb/imglist.log", "w");
82 fwrite($handler, $data);
84 /*$test = unlink("/home/auth/public_html/dev-test/premium/".$filename.".jpg");*/
86 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
87 header("Location: artist.php?art");
90 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to delete file. Either file doesn't exists</div>";
91 header("Location: artist.php?art");
94 $_SESSION['msg'] = "<div class=\"alert alert-success\">We've successfully deleted the file.</div>";
95 header("Location: artist.php?art");
99 foreach ($file as $key => $value) {
100 $img = within_str($value, "<name>", "</name>").".jpg";
101 $stat = within_str($value, "<stat>", "</stat>");
103 echo "<div class=\"thumbnail pull-left\" >";
104 echo "<img width=\"100px\" src=\"{$livesitePath}dev-test/premium/{$img}\" alt=\"{$key}\"><br><br>";
105 echo "<center>".within_str($value, "<name>", "</name>")." <br> "
106 .within_str($value, "<price>", "</price>"). " MELON <br> <a href=\"artist.php?art&c=delete&id={$i}\">delete </a></center>" ;
110 if($i%4
==0) { echo "<div class=\"clearfix\"></div>"; }
113 echo "Please upload your work";
117 }else if(isset($_GET['upload'])){ ?
>
120 if(isset($_POST['submitupload'])){
121 if(is_numeric($_POST['price'])){
123 $price = (int) $_POST['price'];
124 $name = $_POST['name'];
126 $tmpName = $_FILES['uploadedfile']['tmp_name'];
128 $fdir = substr($email, 0, 1);
129 $sdir = substr($email, 1, 1);
130 $path = ADB_PATH
."{$fdir}/{$sdir}/{$email}";
131 if (!file_exists($path)) {
132 @mkdir
(ADB_PATH
."{$fdir}");
133 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}");
134 @mkdir
(ADB_PATH
."{$fdir}/{$sdir}/{$udir}");
136 if($_FILES["file"]["type"] == "image/gif"){
137 $dirPath = "/home/auth/public_html/dev-test/premium/";
138 $name = lcfirst($_POST['name'])."_".rand(10000,99999);
139 $fname = $name."gif";
140 if(!file_exists($dirPath.$fname)){
141 if(move_uploaded_file($tmpName, $dirPath.$fname)) {
142 $uploadedFile = true;
145 $uploadedFile = false;
148 $_SESSION['msg'] = "<div class=\"alert alert-danger\">File already exist.</div>";
149 header("Location: artist.php?upload");
153 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Please upload GIF image only.</div>";
154 header("Location: artist.php?upload");
159 // if($uploadedFile){
161 // $writeData = "<time>{$time}</time><name>{$name}_".rand(00000,99999)."</name><price>{$price}</price>\n";
162 // $filename = $path."/imagelist.txt";
164 // if (!file_exists($filename)) {
165 // if(!file_put_contents($filename,$writeData)) {
166 // $writeSuccess = false;
168 // $writeSuccess = true;
170 // $handle = fopen($filename, "a");
171 // if(!fwrite($handle, $writeData)) {
172 // $writeSuccess = false;
175 // $writeSuccess = true;
180 $handle = fopen("/home/adb/imglist.log", "a+");
181 fwrite($handle, "<id>".$_SESSION['artistid']."</id><name>{$name}</name><price>{$price}</price><stat></stat>\n");
184 $_SESSION['msg'] = "<div class=\"alert alert-success\">File successfully uploaded.</div>";
185 header("Location: artist.php?art");
188 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Unable to upload file. Please contact admin.</div>";
189 header("Location: artist.php?upload");
194 $_SESSION['msg'] = "<div class=\"alert alert-danger\">Price must be numeric.</div>";
195 header("Location: artist.php?upload");
201 <form role
="form" enctype
="multipart/form-data" action
="<?php echo $_SERVER['PHP_SELF'] ?>?upload" method
="POST">
202 <input type
="hidden" name
="MAX_FILE_SIZE" value
="10000000" />
203 <div
class="form-group">
204 <label
for="name">Name
:</label
> <br
>
205 <input name
="name" type
="text" class="form-control" placeholder
="Name"/><br
/>
207 <div
class="form-group">
208 <label
for="price">Price
:</label
> <br
>
209 <input name
="price" type
="text" class="form-control" placeholder
="Price"/><br
/>
211 <div
class="form-group">
212 <label
for="price">Uploaded File
:</label
> <br
>
213 <input name
="uploadedfile" class="form-control" type
="file" placeholder
="Price"/><br
/>
215 <input type
="submit" class="btn btn-primary" name
="submitupload" value
="Upload File" />
216 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
220 <?php
}else if(isset($_GET['edit'])){
221 $file = file(ADB_PATH
."imglist.log");
222 // print_r(expression)
223 $index = $_GET['edit'];
224 $value = $file[$index];
225 $name = within_str($value, "<name>", "</name>");
226 $price = within_str($value, "<price>", "</price>");
227 $time = within_str($value, "<time>", "</time>");
228 $idVal = within_str($value, "<id>", "</id>");
231 if(isset($_POST['submitedit'])){
232 $index = $_GET['edit'];
233 $newName = lcfirst($_POST['name'])."_".rand(10000,99999);
234 $newPrice = $_POST['price'];
235 unset($file[$index]);
237 $file[$index] = "<id>".$idVal."</id><name>{$newName}</name><price>{$newPrice}</price><stat></stat>\n";
238 $data = implode("", $file);
239 $handler = fopen(ADB_PATH
."imglist.log", "w");
240 fwrite($handler, $data);
242 rename("/home/auth/public_html/dev-test/premium/".$name.".gif", "/home/auth/public_html/dev-test/premium/".$newName.".gif");
243 $_SESSION['msg'] = "{$name} is changed into {$newName}.";
244 header("Location: artist.php?art");
250 <form role
="form" action
="<?php echo $_SERVER['PHP_SELF'] ?>?edit=<?=$index?>" method
="POST">
251 <input type
="hidden" name
="MAX_FILE_SIZE" value
="10000000" />
252 <div
class="form-group">
253 <label
for="name">Name
:</label
> <br
>
254 <input name
="name" type
="text" class="form-control" value
="<?php echo $name ?>" placeholder
="Name"/><br
/>
256 <div
class="form-group">
257 <label
for="price">Price
:</label
> <br
>
258 <input name
="price" type
="text" class="form-control" value
="<?php echo within_str($value, "<price
>", "</price
>") ?>" placeholder
="Price"/><br
/>
260 <input type
="submit" class="btn btn-primary" name
="submitedit" value
="Submit" />
261 <input type
="reset" class="btn btn-danger" name
="submit" value
="Reset" />
265 <!-- nakadisplay none to option
for create artist account
-->
266 <?php
if (isset($_GET['crar'])) { ?
>
267 <form role
="form" method
="post">
268 <div
class="form-group">
269 <label
for="email">Email address
</label
>
270 <input type
="email" class="form-control" id
="email" name
="user" placeholder
="Enter email">
272 <div
class="form-group">
273 <label
for="password">Password
</label
>
274 <input type
="password" class="form-control" id
="password" name
="pass" placeholder
="Password">
276 <div
class="form-group">
277 <label
for="confirmpassword">Confirm Password
</label
>
278 <input type
="password" class="form-control" id
="confirmpassword" name
="cpass" placeholder
="Confirm Password">
280 <input type
="submit" class="btn btn-primary" name
="asub" value
="Create Artist">
283 <!-- END nakadisplay none to option
for create artist account
-->
285 <!-- option
for view transaction
-->
286 <?php
if (isset($_GET['vtrans'])) { ?
>
287 <table
class="table table-striped" style
="background:white;">
296 <td
>Example Name
</td
>
297 <td
>Melon Points
</td
>
298 <td
>September
24, 2014</td
>
302 <td
>Example Name
</td
>
303 <td
>Melon Points
</td
>
304 <td
>September
24, 2014</td
>
308 <td
>Example Name
</td
>
309 <td
>Melon Points
</td
>
310 <td
>September
24, 2014</td
>
314 <td
>Example Name
</td
>
315 <td
>Melon Points
</td
>
316 <td
>September
24, 2014</td
>
320 <!-- END option
for view transaction
-->
321 <?php
if (isset($_GET['alist'])) { ?
>
323 <div
class="col-md-3">
324 <div
class="panel panel-default">
328 <ul id
="al" style
="list-style:none; display:inline;">
329 <?php
include("a_list.php"); ?
>
333 <div
class="col-md-9">
334 <div
class="panel panel-default optionlistview">
336 if (isset($_GET['v'])) {
337 error_reporting(E_ALL
); ini_set("display_errors", 1);
338 $__utmp = file(ADB_PATH
."imglist.log");
339 foreach ($__utmp as $key => $value) {
340 if (trim($_GET['v']) == trim(within_str($value,"<id>","</id>")) && trim(within_str($value,"<stat>","</stat>")) != "deleted") {
341 echo "<div class=\"panel panel-default alist_art\">
342 <a href=\"#\" class=\"thumbnail\">
343 <img src=\"http://be.2ch.net/dev-test/premium/".within_str($value,"<name>","</name>")."\" style=\"width:80px; height:80px;\" alt=\"\">
345 <span class=\"pull-right\">MP</span>
346 <span class=\"pull-left\">Artist ID</span>
347 <div class=\"clearfix\"></div>
353 <div
class="clearfix"></div
>
367 <!--script src
="js/jquery-1.9.1.js"></script
>
368 <script src
="js/bootstrap.js"></script
-->