How to code this?
I am using a lavalair script, Show the user who like and dislike the topic.
I am using a lavalair script, Show the user who like and dislike the topic.
else if($action=="like") { $who = $_GET["who"]; $wnick = getnick_uid($who); addonline(getuid_sid($sid),"Ocenjuje profil",""); echo "<card id=\"main\" title=\"ocena profila\">"; echo "<p align=\"center\">"; echo "Njima se dopada <a href=\"index.php?action=viewuser&who=$who&sid=$sid\">$wnick</a> Profil..."; echo "</p>"; //////ALL LISTS SCRIPT << if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_rate WHERE target='".$who."' AND action='likeprof'")); //changable $num_items = $noi[0]; $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 $sql = " SELECT a.uid, b.name FROM ibwf_rate a INNER JOIN ibwf_users b ON a.uid = b.id WHERE a.target='".$who."' AND a.action='likeprof' ORDER BY a.actime DESC LIMIT $limit_start, $items_per_page ;"; echo "<p><small>"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $lnk = "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a>"; echo "$lnk<br/>"; } } echo "</small></p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"index.php?action=$action&page=$ppage&sid=$sid&who=$who\">«</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"index.php?action=$action&page=$npage&sid=$sid&who=$who\">»</a>"; } if($num_pages>1) { echo "<br/>$page/$num_pages<br/>"; } if($num_pages>2) { $rets = "Idi na stranu<input name=\"pg\" format=\"*N\" size=\"3\"/>"; $rets .= "<anchor>[IDI]"; $rets .= "<go href=\"index.php\" method=\"get\">"; $rets .= "<postfield name=\"action\" value=\"$action\"/>"; $rets .= "<postfield name=\"sid\" value=\"$sid\"/>"; $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>"; $rets .= "<postfield name=\"who\" value=\"$who\"/>"; $rets .= "</go></anchor>"; echo $rets; } echo "</p>"; ////// UNTILL HERE >> echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">$glavna"; echo "HAPPY</a>"; echo "</p>"; echo "</card>"; } else if($action=="dislike") { $who = $_GET["who"]; $wnick = getnick_uid($who); addonline(getuid_sid($sid),"Ocenjuje profil",""); echo "<card id=\"main\" title=\"ocena profila\">"; echo "<p align=\"center\">"; echo "Njima se ne dopada <a href=\"index.php?action=viewuser&who=$who&sid=$sid\">$wnick</a> Profil..."; echo "</p>"; //////ALL LISTS SCRIPT << if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_rate WHERE target='".$who."' AND action='dislikeprof'")); //changable $num_items = $noi[0]; $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 $sql = " SELECT a.uid, b.name FROM ibwf_rate a INNER JOIN ibwf_users b ON a.uid = b.id WHERE a.target='".$who."' AND a.action='dislikeprof' ORDER BY a.actime DESC LIMIT $limit_start, $items_per_page ;"; echo "<p><small>"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $lnk = "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a>"; echo "$lnk<br/>"; } } echo "</small></p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"index.php?action=$action&page=$ppage&sid=$sid&who=$who\">«</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"index.php?action=$action&page=$npage&sid=$sid&who=$who\">»</a>"; } if($num_pages>1) { echo "<br/>$page/$num_pages<br/>"; } if($num_pages>2) { $rets = "Idi na stranu<input name=\"pg\" format=\"*N\" size=\"3\"/>"; $rets .= "<anchor>[IDI]"; $rets .= "<go href=\"index.php\" method=\"get\">"; $rets .= "<postfield name=\"action\" value=\"$action\"/>"; $rets .= "<postfield name=\"sid\" value=\"$sid\"/>"; $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>"; $rets .= "<postfield name=\"who\" value=\"$who\"/>"; $rets .= "</go></anchor>"; echo $rets; } echo "</p>"; ////// UNTILL HERE >> echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">$glavna"; echo "HAPPY</a>"; echo "</p>"; echo "</card>"; } else if($action=="dislikeprof") { addonline(getuid_sid($sid),"Ocenjuje profil",""); echo "<card id=\"main\" title=\"ocena profila\">"; echo "<p align=\"center\">"; echo "<b>Ne dopada ti se profil</b><br/>"; $dislikeswho = getuid_sid($sid); $dislikeswho = $_REQUEST["who"]; $dislikenick = getnick_sid($sid); $whonick=$_POST["whonick"]; $who = $_GET["who"]; $whonick = getnick_uid($who); $byuid = getuid_sid($sid); $tm = time(); $actime = mysql_fetch_array(mysql_query("SELECT actime FROM ibwf_rate WHERE uid='".$uid."' AND target='".$who."' ORDER BY actime DESC LIMIT 1")); $timeout = $actime[0] + (7*24*60*60); if(time()<$timeout) { echo "<img src=\"images/notok.gif\" alt=\"X\"/>Mozes samo jednom na svakih 7 dana oceniti ovaj profil.<br/><br/>"; }else{ if($uid==$who) { echo "<img src=\"images/notok.gif\" alt=\"X\"/>Glupo je ocenjivati sa sebe, zar ne ?<br/><br/>"; }else{ $res = mysql_query("INSERT INTO ibwf_rate SET uid='".$uid."', action='".$action."', target='".$who."', actime='".time()."'"); $res = mysql_query("INSERT INTO ibwf_obavestenja SET text='$dislikenick se ne dopada tvoj profil!!! Samo ti napreduj... doci ce maca na vratanca... [B] [br/][br/] ps. Ovo je automatska poruka i ne treba odgovarati na ovu poruku [/B]', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'"); if($res) { echo "<img src=\"../images/ok.gif\" alt=\"O\"/>"; echo "$whonick profil je ocenjen <br/>"; } } } echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "HAPPY</a><br/>"; echo "</p>"; echo "</card>"; } /////////////////////////////////////////// else if($action=="likeprof") { addonline(getuid_sid($sid),"Ocenjuje profil",""); echo "<card id=\"main\" title=\"ocena profila\">"; echo "<p align=\"center\">"; echo "<b>Dopada ti se profil</b><br/>"; $likeswho = getuid_sid($sid); $likeswho = $_REQUEST["who"]; $likenick = getnick_sid($sid); $whonick=$_POST["whonick"]; $who = $_GET["who"]; $whonick = getnick_uid($who); $byuid = getuid_sid($sid); $tm = time(); $actime = mysql_fetch_array(mysql_query("SELECT actime FROM ibwf_rate WHERE uid='".$uid."' AND target='".$who."' ORDER BY actime DESC LIMIT 1")); $timeout = $actime[0] + (7*24*60*60); if(time()<$timeout) { echo "<img src=\"images/notok.gif\" alt=\"X\"/>Mozes samo jednom na svakih 7 dana oceniti ovaj profil.<br/><br/>"; }else{ if($uid==$who) { echo "<img src=\"images/notok.gif\" alt=\"X\"/>Glupo je ocenjivati sa sebe, zar ne ?<br/><br/>"; }else{ $res = mysql_query("INSERT INTO ibwf_obavestenja SET text='$likenick se dopada tvoj profil!!! To je jos jedan razlog vise da i dalje napredujes ... [B] [br/][br/] ps. Ovo je automatska poruka i ne treba odgovarati na ovu poruku [/B]', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'"); $res = mysql_query("INSERT INTO ibwf_rate SET uid='".$uid."', action='".$action."', target='".$who."', actime='".time()."'"); if($res) { echo "<img src=\"../images/ok.gif\" alt=\"O\"/>"; echo "$whonick profil je ocenjen <br/>"; } } } echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "HAPPY</a><br/>"; echo "</p>"; echo "</card>"; }
Comment