xcoderx Posted December 3, 2008 Share Posted December 3, 2008 guys i have a script which stores my datas in a store.php file and also displays it from there. but the script aint got delete option so if i want to delete comething how would i do it from admincp?? ??? Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/ Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 you can use unlink() Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704680 Share on other sites More sharing options...
xcoderx Posted December 3, 2008 Author Share Posted December 3, 2008 how would i do that? i mean fetch the data written there and select which one to delete? ??? Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704686 Share on other sites More sharing options...
ballhogjoni Posted December 3, 2008 Share Posted December 3, 2008 are you asking to delete part of the file contents or are you asking to delete the entire file? Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704689 Share on other sites More sharing options...
xcoderx Posted December 3, 2008 Author Share Posted December 3, 2008 i particular row from comments posted by an user, its all stored in a store.php file im wondering how would i delete a particular comment from a user? Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704697 Share on other sites More sharing options...
ballhogjoni Posted December 3, 2008 Share Posted December 3, 2008 this is messy, use database next time. Read all about editing files at http://us2.php.net/fopen Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704700 Share on other sites More sharing options...
xcoderx Posted December 3, 2008 Author Share Posted December 3, 2008 see here is a code but i get a error Fatal error: Call to undefined function emoticondecode() in /home/www/http/public_html/blog/view_post.php on line 87 <?php include("settings.php"); include("users.php"); if($want_comments == "true"){ $blogfile = file($datafile); unset($blogfile[0]); foreach($blogfile as $thisline){ list($title, $post, $date, $id, $image, $username_blog, $label, $tag)=explode("|",$thisline); $page_name_set = $title; if($id == $_GET['id']){ $page_title = $title; include("./themes/$skin/header.php"); if($blog_offline == "true" and $type != "admin"){ echo "<center><b>$offline_msg</b></center>"; include("./themes/$skin/footer.php"); die(); } $image = trim($image, "\n"); xyz(); bbcodedecode($post); // show post start $image = trim($image); if(file_exists("./accounts/".trim($username_blog).".php")){ include("./accounts/".trim($username_blog).".php"); } if(file_exists("./accounts/".trim($username_blog).".php")){ $name_s = "<a href=\"view_member.php?username=$username_blog\">$name</a>"; } else { $name_s = $username_blog; } if($want_comments == "true"){ $comment_links = "<img src=\"themes/static_skin/icons/comment.gif\" alt=\"comment\" /> <a href=\"add_comment.php?id=$id\">Add comment</a>"; } if($image != ""){ $image_show = "<img src=\"$image\" alt=\"blog image\" style=\"float: right; margin: 4px; clear:left\" border=\"0\" />"; } else { $image_show = ""; } if(isset($icon) and $icon != "None"){ $label = "<a href=\"?label=$label_name\"><img src=\"label_icons/$icon\" alt=\"$label_name\" title=\"$label_name\" style=\"border:0; float:right\" /></a>"; } else { $label = ""; } include("./themes/$skin/post_style.php"); } } // show post end $commentfilearray = file($commentfile); unset($commentfilearray[0]); $any = "no"; foreach($commentfilearray as $lnum => $comment){ $break = "|"; list($name_comm, $comment, $date, $id, $status)=explode($break,$comment); if($type = "admin" and isset($_COOKIE['script_password']) and $password == $_COOKIE['script_password']){ $delete_link = "[<a href=\"main.php?delete_com=$lnum\" style=\"text-decoration:none\">Delete</a>]"; } else { $delete_link = ""; } emoticondecode($comment); if(file_exists("./accounts/{$name_comm}.php")){ include("./accounts/{$name_comm}.php"); $name_comm = "<a href=\"view_member.php?username=$name_comm\">$name_comm</a>"; } if(trim($status) != "0"){ if(trim($id) == $_GET['id']){ echo "<center><div style=\"width:300px\" align=\"left\"><span class=\"comment_name\">$name_comm said:</span><br /><br /> <span class=\"comment_post\">$comment</span><br /> <span class=\"date\">$date $delete_link</span><br /><hr></div></center><br />"; $any = "yes"; } } } if(isset($any) and $any == "no"){ if(!isset($id)) $id = ""; echo "No one has made a comment yet. Be the first, <a href=\"add_comment.php?id=$id\">post a comment</a>.<br /><br />"; } } else { include("./themes/$skin/header.php"); echo "I'm sorry, but this feature has been disabled."; include("./themes/$skin/footer.php"); } include("./themes/$skin/footer.php"); ?> Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704701 Share on other sites More sharing options...
ballhogjoni Posted December 3, 2008 Share Posted December 3, 2008 undefined function emoticondecode() is your problem. a good start would be to define this function. Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704705 Share on other sites More sharing options...
xcoderx Posted December 3, 2008 Author Share Posted December 3, 2008 sorted Link to comment https://forums.phpfreaks.com/topic/135287-flatfile-delete/#findComment-704747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.