Shoutbox
here are example of my core one of my edits
core.php
/////////////////////////////////user link
function ulink($uid,$sid)
{
$col = mysql_fetch_array(mysql_query("SELECT id,name,perm FROM ibwf_users WHERE id='".$uid."'"));
if($col[2]=='2')
{
$admn .= "<a href=\"index.php?action=viewuser&who=$col[0]\" class=\"admn\">$col[1]</a>";
return $admn;
}else if($col[2]=='1')
{
$modr .= "<a href=\"index.php?action=viewuser&who=$col[0]\" class=\"modr\">$col[1]</a>";
return $modr;
}else{
$user .= "<a href=\"index.php?action=viewuser&who=$col[0]\">$col[1]</a>";
return $user;
}
}
////////////////////////////////////////////////////////////
function getshoutbox($sid)
{
$shbox = "<small>";
$lshout = mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 2");
while ($shots = mysql_fetch_array($lshout))
{
$shnick = getnick_uid($shots[1]);
if(isonline($shots[1]))
{
$bulb="<img src=\"images/onl.gif\" alt=\"On\"/>";
}
else{
$bulb="<img src=\"images/ofl.gif\" alt=\"Off\"/>";
}
$shbox .= "$bulb<i><a href=\"index.php?action=viewuser&who=$shots[1]\">".$shnick."</a></i>: ";
$fshout = htmlspecialchars($shots[0]);
$fshout = getsmilies($fshout);
$shout = parsemsg($lshout[0],$sid);
$user = ulink($lshout[1],$sid);
$fshout = getbbcode($fshout, $sid);
$shbox .= $fshout;
//if (ismod(getuid_sid($sid))){
//$shbox .= ", <a href=\"modproc.php?action=delsh&shid=$shots[2]\">delete</a>";
//}
$shbox .= "<br/>";
}
$shbox .= "<a href=\"lists.php?action=shouts\">»post shout</a>";
$shbox .= "</small>";
return $shbox;
}
/////////////////////////////////////////////////////////
function getshouts($sid){
$uid=getuid_sid($sid);
if(!isshoutblocked($uid)){
echo getshoutbox($sid);
}
}
lists.php
/////////////////////////////shouts
else if($action=="shouts")
{$pstyle = gettheme($sid);
echo xhtmlhead("Shout",$pstyle);
echo "<head><title>$site_name</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
<meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";
echo "<body>";
addonline(getuid_sid($sid),"Shouts","lists.php?action=$action");
echo "Add shout(255 chars max):<br/><form action=\"genproc.php?action=shout\" method=\"post\"><textarea id=\"inputText\" name=\"shtxt\"></textarea><br/>";
echo "<input id=\"inputButton\" type=\"submit\" value=\"Send\"/></form><br/>";
$who = $_GET["who"];
if($page=="" || $page<=0)$page=1;
if($who=="")
{
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts"));
}else{
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shouter='".$who."'"));
}
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
if($who =="")
{
$sql = "SELECT id, shout, shouter, shtime FROM ibwf_shouts ORDER BY shtime DESC LIMIT $limit_start, $items_per_page";
}else{
$sql = "SELECT id, shout, shouter, shtime FROM ibwf_shouts WHERE shouter='".$who."'ORDER BY shtime DESC LIMIT $limit_start, $items_per_page";
}
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$shnick = getnick_uid($item[2]);
if(isonline($item[2])){
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
}
$sht = htmlspecialchars($item[1]);
$shdt = date("d/m/Y h:i:s A", $item[3]+(addhours()));
if(isowner($item[2]))
{$lnk = "$iml<a href=\"index.php?action=viewuser&who=$item[2]\"><font color='red'>$shnick</font></a>: $shdt<br/><br/>".getbbcode(getsmilies($sht));}
else if(isadmin($item[2]))
{$lnk = "$iml<a href=\"index.php?action=viewuser&who=$item[2]\"><font color='purple'>$shnick</font></a>: $shdt<br/><br/>".getbbcode(getsmilies($sht));}
else if(ismod($item[2]))
{$lnk = "$iml<a href=\"index.php?action=viewuser&who=$item[2]\"><font color='blue'>$shnick</font></a>: $shdt<br/><br/>".getbbcode(getsmilies($sht));}
else
{$lnk = "$iml<a href=\"index.php?action=viewuser&who=$item[2]\"><font color='yellow'>$shnick</font></a>: $shdt<br/><br/>".getbbcode(getsmilies($sht));}
if(ismod(getuid_sid($sid)))
{
$dlsh = "[<a href=\"lists.php?action=chilmit&shid=$item[0]\">D</a>]<br/><br/>";
}else
if(isowner(getuid_sid($sid)))
{
$dlsh = "[<a href=\"lists.php?action=chiledit&shid=$item[0]\">E</a>]";
} else{
$dlsh = "<br/><br/>";
}
echo "$lnk $dlsh";
}
}
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=shouts&page=$ppage&who=$who\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=shouts&page=$npage&who=$who\">Next»</a>";
}
echo "<br/>Page $page of $num_pages<br/>";
if($num_pages>2)
{
$rets = "<center>Jump to page<form action=\"lists.php\" method=\"get\"><input id=\"inputText\" name=\"page\" format=\"*N\" size=\"3\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
$rets .= "<input id=\"inputButton\" type=\"submit\" value=\"Go\"/></form></center>";
echo $rets;
}
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&clid=$clid\">";
echo "Back</a><br/>";
echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</body>";
}
////////////////////////Edit Shout
else if($action=="chiledit"){
$pstyle = gettheme($sid);
echo xhtmlhead("Shout",$pstyle);
echo "<head><title>$site_name</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
<meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";
echo "<body>";
$shid = $_GET["shid"];
$getsht = mysql_fetch_array(mysql_query("SELECT shout FROM ibwf_shouts WHERE id = '".$shid."'"));
echo "<p>";
echo "<br/>Edit:<br/> ";
echo "<form action=\"lists.php?action=chileditfin&id=$shid\" method=\"post\"><textarea id=\"inputText\" name=\"shtxt\">$getsht[0]</textarea> ";
echo "<br/><input id=\"inputButton\" type=\"submit\" value=\"Edit\"/>";
echo "</form>";
echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</body>";
}
///////////////////////////////////////Delete shout
else if($action=="chilmit"){
$pstyle = gettheme($sid);
echo xhtmlhead("Shout",$pstyle);
echo "<head><title>$site_name</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
<meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";
echo "<body>";
$shid = $_GET["shid"];
echo "<p align=\"center\">";
$res = mysql_query("DELETE FROM ibwf_shouts WHERE id ='".$shid."'");
if($res){
$sql = mysql_fetch_array(mysql_query("SELECT shout, shouter FROM ibwf_shouts WHERE id='".$shid."'"));
$modname = getnick_uid(getuid_sid($sid));
$shouter = getnick_uid($sql[1]);
$shout = substr("$sql[0]", 0, 30);
mysql_query("INSERT INTO ibwf_mlog SET action='shouts', details='<b>".$modname."</b> Deleted Shout Number <b>".$shid."</b>', actdt='".time()."'");
echo "<img src=\"images/ok.gif\" alt=\"O\"/>Shout deleted";
}else{
echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
}
echo "<br/><br/>";
echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</body>";
}
//////////////////////////Edit Shout/////////////////////////////
else if($action=="chileditfin"){
$pstyle = gettheme($sid);
echo xhtmlhead("Shout",$pstyle);
echo "<head><title>$site_name</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Riderz wap dating portal and community containg chat, forums, blogs and much more\" />
<meta name=\"keywords\" content=\"chat, forums, wap, dating, games, blogs, polls, quiz, lavalair, news, rap, goth\" /></head>";
echo "<body>";
$shid = $_GET["id"];
$shtxt = $_POST["shtxt"];
echo "<p align=\"center\">";
$res = mysql_query("UPDATE ibwf_shouts SET shout='".$shtxt."' WHERE id='".$shid."'");
if($res){
$sql = mysql_fetch_array(mysql_query("SELECT shout, shouter FROM ibwf_shouts WHERE id='".$shid."'"));
$modname = getnick_uid(getuid_sid($sid));
$shouter = getnick_uid($sql[1]);
$shout = substr("$sql[0]", 0, 30);
mysql_query("INSERT INTO ibwf_mlog SET action='shouts', details='<b>".$modname."</b> Edited <b>".$shouter."</b>\'s Shout <b><i>".$shout."...</i></b>', actdt='".time()."'");
echo "<img src=\"images/ok.gif\" alt=\"O\"/>Shout Edited!<br/><br/><a href=\"lists.php?action=shouts\">Shouts</a>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error!<br/><br/><a href=\"lists.php?action=shouts\">Shouts</a>";
}
echo "<br/><br/>";
echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</body>";
}
this is for 2 shouts and dnt copie and paste its not gona work on normal lava u must edit this to make it work