PHP Code:
///////in core
function onlchef($uid)
{
$getdata = mysql_fetch_array(mysql_query("SELECT onlchef FROM lib3rtymrc_users WHERE id='".$uid."'"));
return $getdata[0];
}
////////////////////////////////////////////chef offline
function offchef($uid)
{
$getdata = mysql_fetch_array(mysql_query("SELECT offchef FROM lib3rtymrc_users WHERE id='".$uid."'"));
return $getdata[0];
}
//create onlchef end offchef in ibwf_users
PHP Code:
/////in lists.php
//////////////////////////////////prieteni
else if($action=="buds")
{
addonline(getuid_sid($sid),"Lista prieteni","");
echo "<card id=\"main\" title=\"Prieteni\">";
$uid = getuid_sid($sid);
echo "<p align=\"center\">";
echo "<b><small>Lista Prieteni</small></b><br/>";
echo "<small>Chef Online:</small><br/>";
echo "<small>";
echo parsemsg(onlchef($uid), $sid);
echo "</small>";
echo "<br/><small>Chef Offline:</small><br/>";
echo "<small>";
echo parsemsg(offchef($uid), $sid);
echo "</small>";
echo "</p>";
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$num_items = getnbuds($uid); //changable
$items_per_page= 5;
$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
$sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM lib3rtymrc_users a INNER JOIN lib3rtymrc_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' GROUP BY 1,2 ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
echo "<p>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if($uid!=$item[2])
{
if(isonline($item[2]))
{
$iml = "<img src=\"http://coding-talk.com/images/onl.gif\" alt=\"+\"/>";
$uact = " ";
$plc = mysql_fetch_array(mysql_query("SELECT place FROM lib3rtymrc_online WHERE userid='".$item[2]."'"));
$uact .= $plc[0];
}else{////////////////////// nici o actiune de....
$regd = mysql_fetch_array(mysql_query("SELECT regdate, lastvst, lastact FROM lib3rtymrc_users WHERE id='".$item[2]."'"));
$sage = time()-$regd[2];
$rwage = gettimemsg($sage);
$lastact = time()-$regd[2];
$days=0;
$mins=0;
$hours=0;
if ($lastact>60)
{
$secs=$lastact%60;
$mins=$lastact/60;
$mins=(integer)$mins;
}
if ($mins>60)
{
$hours=$mins/60;
$hours=(integer)$hours;
$mins=$mins%60;
}
if ($hours>24)
{
$days=$hours/24;
$days=(integer)$days;
$hours=$hours%24;
}
$uact = "<b>inactiv de ";
if($days>0)
{
$timp = "$days zile, $hours ore, $mins minute, $secs secunde</b>";
}
if($days<1)
{
if($hours>0)
{
$timp = "$hours ore, $mins minute, $secs secunde</b>";
}
if($hours<1)
{
$timp = "$mins minute, $secs secunde</b>";
}}
echo "<br/>";
$iml = "<img src=\"http://coding-talk.com/images/ofl.gif\" alt=\"-\"/>";
//$uact = "Ultima data activ: ";
$ladt = date("d m y-H:i:s", $item[0]);
//$uact .= $ladt;
$uact .= $timp;
}
$lnk = "<a href=\"profil.php?who=$item[2]&sid=$sid\">$iml".getsimbol($item[2])."$item[1]</a> - <small>$uact</small>";
echo "$lnk<br/>";
echo "<small>";
$bs = date("d m y-H:i:s",$item[5]);
//echo "Prieten din:$bs<br/>";
//echo "$uact<br/>";
if(isonline($item[2]))
{
$conectat = parsemsg(onlchef($item[2]), $sid);
echo "$conectat<br/>";
}else{
$deconectat = parsemsg(offchef($item[2]), $sid);
echo "$deconectat<br/>";
}
echo "</small>";
}
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=buds&page=$ppage&sid=$sid&view=$view\">«Inapoi</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=buds&page=$npage&sid=$sid&view=$view\">Inainte»</a>";
}
echo "<br/><small>$page din $num_pages</small><br/>";
if($num_pages>2)
{
$rets = "Du-te la pagina<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[Du-te]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////////pana aici
echo "<p align=\"center\">";
echo "<small><a href=\"setari.php?action=chefamici&sid=$sid\">Seteaza cheful tau</a></small><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Acasa</a>";
echo "</p>";
echo "</card>";
}
/end tih in seting.php
//////////////////////////////////////////// Statut
else if($action=="chefamici")
{
addonline(getuid_sid($sid),"Seteaza chef amici","index.php?action=$action");
echo "<card id=\"main\" title=\"Status\">";
$uid = getuid_sid($sid);
$unreadpopup=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_popups WHERE unread='1' AND touid='".$uid."'"));
if ($unreadpopup[0]>0)
{
echo "<p align=\"center\">";
echo popup($sid);
echo "</p>";
echo "</card>";
echo "</wml>";
exit();
}
echo "<p align=\"center\">";
echo "<small><b>Chefuri lista amici</b></small><br/>";
$uid = getuid_sid($sid);
echo "<onevent type=\"onenterforward\">";
$online = htmlspecialchars(onlchef(getuid_sid($sid)));
$offline = htmlspecialchars(offchef(getuid_sid($sid)));
echo "<refresh>
<setvar name=\"on\" value=\"$online\"/>
<setvar name=\"off\" value=\"$offline\"/>";
echo "</refresh></onevent>";
echo "<small>Chef Online:</small>";
echo "<br/><input name=\"on\" maxlength=\"100\"/><br/>";
echo "<small>Chef Offline:</small>";
echo "<br/><input name=\"off\" maxlength=\"100\"/><br/>";
echo "<anchor>Seteaza";
echo "
<go href=\"setari.php?action=set_stts&sid=$sid\" method=\"post\">
<postfield name=\"on\" value=\"$(on)\"/>
<postfield name=\"off\" value=\"$(off)\"/>
</go>
";
echo "</anchor><br/>";
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Acasa</a>";
echo "</p>";
echo "</card>";
}
//////////////////////////////////////////proc
else if($action=="set_stts")
{
addonline(getuid_sid($sid),"Status Setat","");
$on = $_POST["on"];
$off = $_POST["off"];
$laura = "$on";
$ionut = "$off";
echo "<card id=\"main\" title=\"$numesite\">";
echo "<p align=\"center\">";
//$uid = getuid_sid($sid);
$res = mysql_query("UPDATE lib3rtymrc_users SET onlchef='".$laura."' , offchef='".$ionut."' WHERE id='".$uid."'");
if($res)
{
echo "Chefuri setate cu succes<br/>";
}else{
echo "Nu poti actualiza Chefurile<br/>";
}
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Acasa</a>";
echo "</p>";
echo "</card>";
}