Like or Dislike Topics Code

Started on the old forum in August 2010 · view the original in the archive · old links redirect here

14 replies · 3,794 views · started 16 years ago · 1 min read

7 participants
robzky Developer · 205 posts #1

How to code this?

I am using a lavalair script, Show the user who like and dislike the topic.

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

robzky Developer · 205 posts #3

sweetangel wrote: this code like facebook function for gallery pics / blogs.

Yeah, sweetangel.. is there Anyone can share this script?

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

rukiya Lead · 569 posts #4

in ibwf_topics add 2 new rows like, dislike add a select option having like dislike options below the topic when user select like option use query select like from ibwf_topics where tid ( topicid)=$..... explode the like field of the sql using comma (,) search the uid in the exploded array using in_array() if uid exists you show message already liked by uid else implode the uid using comma (,) then update like with new imploded string where tid=$..... Same rule will be applied for dislike

to show the like and dislike fetch the like or dislike where tid=$..... then explode like or dislike using comma (,)

robzky Developer · 205 posts #5

rukiya wrote: in ibwf_topics add 2 new rows like, dislike add a select option having like dislike options below the topic when user select like option use query select like from ibwf_topics where tid ( topicid)=$..... explode the like field of the sql using comma (,) search the uid in the exploded array using in_array() if uid exists you show message already liked by uid else implode the uid using comma (,) then update like with new imploded string where tid=$..... Same rule will be applied for dislike

to show the like and dislike fetch the like or dislike where tid=$..... then explode like or dislike using comma (,)

Thanks rukiya, can you code this for me?

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

subzero Super moderator Fellow · 3,954 posts #7

External image (may be gone)

Like this ?? thumb's up for coding it your self lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

robzky Developer · 205 posts #9

Give me some idea about this function.

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

metulj Super moderator Principal · 1,726 posts #10

robzky wrote: Give me some idea about this function.

rukiya wrote: in ibwf_topics add 2 new rows like, dislike add a select option having like dislike options below the topic when user select like option use query select like from ibwf_topics where tid ( topicid)=$..... explode the like field of the sql using comma (,) search the uid in the exploded array using in_array() if uid exists you show message already liked by uid else implode the uid using comma (,) then update like with new imploded string where tid=$..... Same rule will be applied for dislike to show the like and dislike fetch the like or dislike where tid=$..... then explode like or dislike using comma (,)

all idea you need...

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

tsinelas Developer · 77 posts #11

pls code tnx..tnx..tnx..

homie get your ass over here!!!

srecnica Developer · 174 posts #12
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>";

}

in wievuser profile add this

echo "Oceni ovaj profil "; $likes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_rate WHERE target='".$who."' AND action='likeprof'")); //changable $dislikes = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_rate WHERE target='".$who."' AND action='dislikeprof'")); //changable

echo "<a href="index.php?action=like&who=$who&sid=$sid">$likes[0]</a>--- <a href="index.php?action=likeprof&who=$who&sid=$sid"><img src="images/like.PNG" alt="OK profil"/></a>---"; echo "<a href="index.php?action=dislikeprof&who=$who&sid=$sid"><img src="images/dont.PNG" alt="Los profil"/></a>---<a href="index.php?action=dislike&who=$who&sid=$sid">$dislikes[0]</a> "; SQL

CREATE TABLE IF NOT EXISTS ibwf_rate ( id int(100) NOT NULL AUTO_INCREMENT, uid int(100) NOT NULL DEFAULT '0', action varchar(100) NOT NULL DEFAULT '', target int(100) NOT NULL DEFAULT '0', actime int(100) NOT NULL DEFAULT '0', PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

this Serbian language.. translate to english

Attachments: dont.PNG like.PNG
robzky Developer · 205 posts #13

I dont need a code for profile, i need a code for topic.

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

subzero Super moderator Fellow · 3,954 posts #14

robzky

Do you really want to know what is on my mind ??


!EDIT THIS SCRIPT TO WORK WITH YOUR FORUMS!

Geez learn to code you lazy sack of S**t

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

metulj Super moderator Principal · 1,726 posts #15

subzero wrote: robzky Do you really want to know what is on my mind ??

!EDIT THIS SCRIPT TO WORK WITH YOUR FORUMS! Geez learn to code you lazy sack of S**t

+1 ! no other comment...

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close