Home arrow PHP arrow Page 4 - Chatter

Manage the Chatter - PHP

This tutorial shows you how to make a ChatterBlock. ChatterBlocks are small windows where users can type in messages. They're also called Shout Boxes or TagBoards and are kind of like miniature chat rooms.

TABLE OF CONTENTS:
  1. Chatter
  2. Configuration
  3. View Chatter
  4. Manage the Chatter
  5. Secure it
By: Roger Stringer
Rating: starstarstarstarstar / 29
November 08, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Now for a simple script to manage your chatterblock entries. This script will display all entries and give you the option of deleting any that you don't think are appropriate.

<? include("accesscontrol.php"); ?>
<table width=100% border=1>
<tr>
<td><b>Name</b></td>
<td><b>Message</b></td>
<td><B>Date Entered</b></td>
<td><b>IP Address</b></td>
<td>&nbsp;</td>
</tr>
<?php
include('chatter.php');
if($del){
mysql_query("DELETE FROM chatterblock WHERE id='$del'");
}
if($banip){
mysql_query("INSERT INTO blocked_ips SET ip='$banip'");
}
if($abanip){
mysql_query("DELETE FROM blocked_ips WHERE ip='$abanip'");
}
if($bann){
mysql_query("INSERT INTO blocked_nicks SET name='$bann'");
}
if($abann){
mysql_query("DELETE FROM blocked_nicks WHERE name='$abann'");
}
$q = "select * from chatterblock order by id desc ";
$result = mysql_query($q);
while ($row = mysql_fetch_array($result)){
$id = $row["id"];
$name=$row["name"];
$url = $row["url"];
$msg = $row["msg"];
$entered = $row["entered"];
$ip = $row["ip"];
echo "<tr>";
echo "<td><b><a href=\"$url\" target=\"new\">$name</a></b></td>";
echo "<td> $msg</td>";
echo "<td>$entered</td>";
echo "<td>$ip</td>";
echo "<td><a href='cbadmin.php?del=$id'>delete</a> |";
$blockedip = "select * from blocked_ips WHERE ip='".$ip."'";
$ipcheck = mysql_query($blockedip);
if( mysql_num_rows($ipcheck) > 0){
echo "<a href='cbadmin.php?abanip=$ip'>unban ip</a> |";
}else{
echo "<a href='cbadmin.php?banip=$ip'>ban ip</a> |";
}
$bname = "select * from blocked_nicks WHERE name='".$name."'";
$ncheck = mysql_query($bname);
if( mysql_num_rows($ncheck) > 0){
echo "<a href='cbadmin.php?abann=$name'>unban name</a></td>";
}else{
echo "<a href='cbadmin.php?bann=$name'>ban name</a></td>";
}
echo "</tr>";
}
?>

Save this file as cbadmin.php



 
 
>>> More PHP Articles          >>> More By Roger Stringer
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: