2 include("../encrypt_artist.php");
3 header('Content-Type: application/json');
4 if(!isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) )
6 header("Location: ../artist.php");
8 if(!empty($_SESSION['artistid'])){
9 if(!empty($_POST['category'])){
10 $category = trim($_POST['category']);
11 $id = rand(1000000,9999999);
12 $writeData = "<id>{$id}</id><aid>".$_SESSION['artistid']."</aid><classname>{$category}</classname>\n";
14 $filename = ADBD_PATH
."class.log";
15 $check = file(ADBD_PATH
."class.log");
17 foreach ($check as $key => $value) {
18 if($category==within_str($value, "<classname>", "</classname>")) {
24 if (!file_exists($filename)) {
25 if(!file_put_contents($filename,$writeData)) {
26 $writeSuccess = false;
30 $handle = fopen($filename, "a");
31 if(!fwrite($handle, $writeData)) {
32 $writeSuccess = false;
39 echo json_encode(array("a" => "success", "b" => $id));
41 echo json_encode(array("a" => "FALSE"));
44 echo json_encode(array("a" => "FALSE"));
48 echo json_encode(array("a" => "FALSE"));
51 echo json_encode(array("a" => "FALSE"));