<?php include 'apps/reader/lib/tag_utils.php'; $path_of_ebook = $_POST['path']; $new_tag = $_POST['tag']; $path_of_ebook = urldecode($path_of_ebook); $tags = find_tags_for_ebook($path_of_ebook); if ($tags != NULL) { $new_tag = $tags . "," . $new_tag; update_tag_for_ebook($new_tag, $path_of_ebook); } else { insert_new_tag($new_tag, $path_of_ebook); }
<?php include 'reader/lib/tag_utils.php'; $filepath = $_POST['filepath']; $tag_toBeRemv = $_POST['tag']; $tags = find_tags_for_ebook($filepath); $arr = explode(',', $tags); $arr2 = array(); foreach ($arr as $a) { if (strcmp($a, $tag_toBeRemv) != 0) { $arr2[] = $a; } } $new_tags = implode(",", $arr2); update_tag_for_ebook($new_tags, $filepath);