Edit/ delete shoutbox posts

Forum
Last Post
Threads / Messages

rickasawr

Member
Member
Joined
Apr 25, 2011
Messages
51
Points
0
Location
United States
Mysidian Dollar
4,988
yeah, i dont really like going to my MySQL database to edit/ delete shoutbox comments, so maybe make a script to edit/ delete shoutbox posts?

I would love you forever. :meow:
 
Alright. In the shoutbox php, just after the start script paste this:

PHP:
$act = $_GET['act'];
if($act == 'delete'){
	// Delete the one shout.
	$group = getgroup();
	if($group == 1 || $group == 2){
		$id = $_GET['id'];
		runquery("DELETE FROM ".$prefix."shoutbox WHERE id='$id'");
		$result = 'Shout was deleted.<br><br>';
	}
}

Then replace the ENTIRE while loop(it's the only one on the page) with this:

PHP:
while ($i < $num) {
    $id=@mysql_result($result,$i,"id");
    $user=@mysql_result($result,$i,"user");
    $date=@mysql_result($result,$i,"date");
    $nolinecomment=@mysql_result($result,$i,"comment");
    $nolinecomment = bbconvert($nolinecomment);
    $comment=nl2br($nolinecomment);
	$group = getgroup();
	if($group == 1 || $group == 2){
		$mod_shoutbox = '<br><a href="shoutbox.php?act=delete&id='.$id.'">Delete</a>';
	}
    $commentdiv = "<div class='comment' style='width:94%;padding:2%;background-color:aliceblue;margin-bottom:5px;'><div class='userdate' style='width:50%;height:25px;color:red;'>".$user." - ".$date."</div>".$comment.$mod_shoutbox"</div>";
	$article_content = $article_content.$commentdiv;
    $i++;
}

while to } (end bracket).

That should do it for ya. Let me know if there's any issues.
 
Well actually, the shoutbox will undergo a completely redesign in Mys v1.3.0... Anyway nice solution to this problem, Kaeliah.
 
lol i was gonna suggest the sql upon reading the topic :displeased: glad kaeliah could come up with an nice fix. And i can't wait for Mys v1.3.0:wiii: the security issues will be fixed right?
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top