This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#101 2011-10-02 12:32:27

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

I would imagine powrhost have much the same TOS, concerning usage of CPU and stuff like that.


http://i.imgur.com/zeIZW.png

Offline

 

#102 2011-10-02 14:30:06

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

What's happened? ALL of the like buttons EVERYWHERE in the forums don't seem to work for me but they were working a while back??


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#103 2011-10-02 14:39:18

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

joefarebrother wrote:

What's happened? ALL of the like buttons EVERYWHERE in the forums don't seem to work for me but they were working a while back??

That's because 000webhost blocked the account - Better than paid webhosting my eye!


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#104 2011-10-02 14:39:42

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

I would imagine powrhost have much the same TOS, concerning usage of CPU and stuff like that.

I cant see any tos lol.


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#105 2011-10-02 18:08:52

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

WE'RE BACK! TO FIX YOUR LIKE BUTTONS, REPLACE scratchloveit.netne.net with rookwood101.tk in the urls of your image tags and url tags

Unfortunately, love it counters have been reset, so you will have to start tallying the up again  sad  but better than nothing eh?   smile

Also: STYLES ARE NOT WORKING YET - be patient  smile

Last edited by rookwood101 (2011-10-02 18:15:43)


http://i.imgur.com/zeIZW.png

Offline

 

#106 2011-10-02 19:54:47

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

Yay! For some reason the love it in your Sig won't work though... The picture does but not the link.

Last edited by Pecola1 (2011-10-02 19:57:41)


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#107 2011-10-02 20:03:09

scratcher7_13
Scratcher
Registered: 2011-02-09
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

WE'RE BACK! TO FIX YOUR LIKE BUTTONS, REPLACE scratchloveit.netne.net with rookwood101.tk in the urls of your image tags and url tags

Unfortunately, love it counters have been reset, so you will have to start tallying the up again  sad  but better than nothing eh?  smile

Hello everyone, Rook here. I've been developing a way for people to "like" forum topics and I'm looking for some testers, all you need to do is click the button below and 'like' this topic. I will also post the source code and how you can add a like button to your own topic.

Click here for Sparks' self updating images and links in posts!!

How the liking system works
The image
This checks a mysql database and shows how many people have clicked the like button
The link
This does something a bit more complicated, first of all it checks to see whether people have liked the topic at all before, if not then it adds a whole new entry into the database this entry has your ip address and the topic id. If people have liked the topic before, it checks whether your ip is on the list of ips for that topic, if not then it adds your ip to the list of ips for that topic. This means that you can only like things once.

Please like this topic to show your support: http://rookwood101.tk/topicrate.php?id= … ;ret=image

and the source code:

Code:

<?php
function writetextimage($string, $substring) {
    if ($_REQUEST['type'] == 'post') {
        $img = imagecreatefrompng ('bgpost.png');
        $text_colour = imagecolorallocate($img, 254, 254, 254);
    }
    else {
        $img = imagecreatefrompng ('bg.png');
        $text_colour = imagecolorallocate($img, 1, 1, 1);
    }
    $font = realpath('font.ttf');
    imagettftext($img, 7, 0, 10, imagefontheight(7), $text_colour, $font, $string);
    imagettftext($img, 7, 0, 10, 28, $text_colour, $font, $substring);
    $whit = imagecolorallocate($img, 0, 0, 0);
    imagecolortransparent($img, $whit);
    header('Content-type: image/png');
    imagepng($img);
    imagecolordeallocate($text_color);
    imagedestroy($img);
}

include 'mysql.php';
$topicid = $_REQUEST['id'];
$userip = $_SERVER['REMOTE_ADDR'];
if ($_REQUEST['forum'] == 'tbg') {
    $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=' . $topicid;
    $database = 'tbg_topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'tbg_postrate';
    }
}
else {
    $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=' . $topicid;
    $database = 'topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'postrate';
    }
}

if ($_REQUEST['ret'] == 'image') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error:', 'id not found');
        exit();
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $likes = 0;
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $likes = count($ratedips);
        if ($ratedips[0] == '') {
            $likes = 0;
        }
    }
    if ($likes == 1) {
        $likes = 1 . ' Like';
        if($_REQUEST['verb'] == 'love') {
            $likes = 1 . ' Love-it';
        }
    }
    else {
        if($_REQUEST['verb'] == 'love') {
            $likes = $likes . ' Love-its';
        }
        else {
            $likes = $likes . ' Likes';
        }
    }
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $already_liked = 'Like This';
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
        else {
            $already_liked = 'Like This';
        }
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                $already_liked = 'Unlike This';
                if ($_REQUEST['verb'] == 'love') {
                    $already_liked = 'I love it!';
                }
            }
        }
    }
    writetextimage($likes, $already_liked);
}
elseif ($_REQUEST['ret'] == 'add') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error: id not found', '');
        exit();
    }
    $headerurl = 'Location:' . $url;
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $addtopic_query = mysql_query("INSERT INTO $database (postid, ips) VALUES ('$topicid', '$userip')");
        header($headerurl);
        exit();
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                unset($ratedips[$i]);
                $ratedips = implode(',', $ratedips);
                $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips' WHERE postid='$topicid'") or die(mysql_error());
                header($headerurl);
                exit();
            }
        }
        $ratedips[$count] = $userip;
        $ratedips2 = implode(',', $ratedips);
        if ($ratedips[0] == '') {
            $ratedips2 = $userip;
        }
        $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips2' WHERE postid='$topicid'") or die(mysql_error());
        header($headerurl);
        exit();
    }
}
elseif ($_REQUEST['ret'] == 'top') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $type = 'Post';
        }
        else {
            $database = 'tbg_topicrate';
            $type = 'Topic';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $type = 'Post';
        }
        else {
            $database = 'topicrate';
            $type = 'Topic';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if($_REQUEST['verb'] == 'love') {
        $likes = $likes . ' Love-its';
    }
    else {
        $likes = $likes . ' Likes';
    }
    $explodedip = explode(',', $ipssort[$_REQUEST['rank']-1]);
    writetextimage($_REQUEST['rank'] . '.' . " $type " . $winnerpost, $explodedip[0] . $likes);
}
elseif ($_REQUEST['ret'] == 'toplink') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'tbg_topicrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'topicrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if (!isset($afterbit)) {
        $headerurl = $url . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
    else {
        $headerurl = $url . $winnerpost . $afterbit . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
}
else {
    writetextimage('Error: incorrect URL vars used', 'Better luck next time!');
}
?>

This took a long time to write so please support me!

I'd like to thank LS97 for the writetextimage() code and Sparks for his inspirational API thread.

Right, now for how you can add it to your posts.

First off you need to make a url tag with the url http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add to find the topic id, you must first make the post, go out to the forums section your topic is in, click on your topic and you'll see in the url bar something like scratch.mit.edu/forums/viewtopic.php?id=# where # is a number, you need to copy this number and put it in the TOPIC ID HERE.

So far we have

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][/url]

Now for the image part
Basically you use the same id but you use an image tag and the url is slightly different so

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][url]http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=image[/url][/url]

notice ret=image now rather than ret=add.
To have a like button that likes a tbg forum topic, just add &forum=tbg to the url for both image and link. To make it use love-its instead of likes (changes the text) then add &verb=love onto the end of the image url only. this is what it looks like: http://rookwood101.tk/topicrate.php?id= … ;verb=love

Make sure to check out Sidharth's Javascript code that automatically generates the code for you based on the url of your post! Here it ishttp://rookwood101.tk/topicrate.php?id= … ;type=post and you can like it using the new likeable posts feature (see below on how to implement yourself)!

Which brings us nicely onto the new:
Likeable Posts!
So, you've made a post in a topic that you think everyone will like, and want to show there thanks, but the like button only supports topics. Well not anymore!

You can now have likeable posts, all you have to do is use the same code as topics, except change the id to the id of your post. To find this out, when you make a post, check (once you've posted it) what your url bar says, it will have on the end something like #p123456 you need to copy the number bit of it (in this case 123456) and put that as the id in my code

Code:

[url=http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=add&type=post][url]http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=image&type=post[/url][/url]

then, as you can see here you put on the end of each of the urls (image and link) &type=post this is to tell my script that you're talking about a post and not a topic. If you leave this blank then it will think it is a topic, and either it won't work, or you will be liking some random topic.



Well, we're done! I hope you like this new feature!

Custom like button styles
So, you like the idea of 'like buttons' but don't like the style they're in?
Introducing:
Custom made like buttons
Basically, you tell me the style of button you want, font, background shape, colours etc. and I make it for you, adding it as an option in the URL of the image eg. stl=1 meaning style = style no.1. I might add the option to change the font colour & size from the URL, it all depends on how many custom requests I get.

Current Styles:
Style 1 - http://rookwood101.tk/topicrate.php?id= … ;ret=image Style 1 is default, no extra code needed
Style 2 - http://rookwood101.tk/topicrate.php?id= … mp;style=2 add &style=2 to the end of the image url to enable this style. Requested by IHeartGaming.
Style 3 - http://rookwood101.tk/topicrate.php?id= … mp;style=3 add &style=3 to the end of the image url to enable this style. Requested by Comp500.
Style 4 - http://rookwood101.tk/topicrate.php?id= … mp;style=4 add &style=4 to the end of the image url to enable this style. Requested by Nathanprocks.

Top liked rankings
See This Post for more info.

Thanks,
Rook

Changelog

Code:

V1.0
First Release, allows you to add like buttons to forum topics and like them.

V1.1
Changed text size & Added redirect to topic
V1.5
Added unlike feature so that if you liked
something in the past you can change
your mind and take away the like also
added small text saying either like or
unlike to show you what would happen if
you clicked the link.
V1.5.1
Bug Fixes, such as now displays image of
Error messages and I had a couple of variables
set the wrong way round.
V1.6
Prettier like button, thanks LS97!
V1.6.1
Fixed a bug where people could like topics
even if they didn't exist also put the mysql
details in a seperate file along with a
variable that holds the string 'Bad request'
something or other.
V1.7
TBG support! add &forum=tbg to url for it
to work.
V1.7.1
Have it use Love-its instead of Likes put
&verb=love on the end of the img url to
make it work.
V1.8
Added first custom style requested by
IHeartGaming.
V2.0
Finally added Likeable posts! as requested
by LS97.
V2.1
Added blue colouring for posts, and white
colouring for topics
V2.1.1
Added Comp500's style request.
V3.0
Added Top liked list!
V3.0.1
Added Nathanprocks' style request
V3.1
Fixed Bug where if two posts had
the same amount of likes, they would
only use one id between them on the
ranks list.
V4
Basically a downgrade, new hosts
so it will work, basically get rid of
the scratchloveit.netne.net and
replace it with rookwood101.tk

Todo list

Code:

 · Star Rating System (Seperate project)
 · Customisable Button-added requested one,
   need to make fully user customisable
 · Add Supporters list support using scratch
   login api.
 · Custom Button text (different to Like and Love)
 · Show rank of post/topic on like button
 · Stats

It still adds two likes...


♫ 90% of teens can't do math. If you are one of the 40% of teens who can, copy and paste this into your signature. ♫♪
http://dl.dropbox.com/u/6273449/BlockLibraryTitle.pnghttp://i.imgur.com/mr9Hf.gif

Offline

 

#108 2011-10-03 02:44:44

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

scratcher7_13 wrote:

rookwood101 wrote:

WE'RE BACK! TO FIX YOUR LIKE BUTTONS, REPLACE scratchloveit.netne.net with rookwood101.tk in the urls of your image tags and url tags

Unfortunately, love it counters have been reset, so you will have to start tallying the up again  sad  but better than nothing eh?  smile

Hello everyone, Rook here. I've been developing a way for people to "like" forum topics and I'm looking for some testers, all you need to do is click the button below and 'like' this topic. I will also post the source code and how you can add a like button to your own topic.

Click here for Sparks' self updating images and links in posts!!

How the liking system works
The image
This checks a mysql database and shows how many people have clicked the like button
The link
This does something a bit more complicated, first of all it checks to see whether people have liked the topic at all before, if not then it adds a whole new entry into the database this entry has your ip address and the topic id. If people have liked the topic before, it checks whether your ip is on the list of ips for that topic, if not then it adds your ip to the list of ips for that topic. This means that you can only like things once.

Please like this topic to show your support: http://rookwood101.tk/topicrate.php?id= … ;ret=image

and the source code:

Code:

<?php
function writetextimage($string, $substring) {
    if ($_REQUEST['type'] == 'post') {
        $img = imagecreatefrompng ('bgpost.png');
        $text_colour = imagecolorallocate($img, 254, 254, 254);
    }
    else {
        $img = imagecreatefrompng ('bg.png');
        $text_colour = imagecolorallocate($img, 1, 1, 1);
    }
    $font = realpath('font.ttf');
    imagettftext($img, 7, 0, 10, imagefontheight(7), $text_colour, $font, $string);
    imagettftext($img, 7, 0, 10, 28, $text_colour, $font, $substring);
    $whit = imagecolorallocate($img, 0, 0, 0);
    imagecolortransparent($img, $whit);
    header('Content-type: image/png');
    imagepng($img);
    imagecolordeallocate($text_color);
    imagedestroy($img);
}

include 'mysql.php';
$topicid = $_REQUEST['id'];
$userip = $_SERVER['REMOTE_ADDR'];
if ($_REQUEST['forum'] == 'tbg') {
    $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=' . $topicid;
    $database = 'tbg_topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'tbg_postrate';
    }
}
else {
    $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=' . $topicid;
    $database = 'topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'postrate';
    }
}

if ($_REQUEST['ret'] == 'image') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error:', 'id not found');
        exit();
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $likes = 0;
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $likes = count($ratedips);
        if ($ratedips[0] == '') {
            $likes = 0;
        }
    }
    if ($likes == 1) {
        $likes = 1 . ' Like';
        if($_REQUEST['verb'] == 'love') {
            $likes = 1 . ' Love-it';
        }
    }
    else {
        if($_REQUEST['verb'] == 'love') {
            $likes = $likes . ' Love-its';
        }
        else {
            $likes = $likes . ' Likes';
        }
    }
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $already_liked = 'Like This';
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
        else {
            $already_liked = 'Like This';
        }
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                $already_liked = 'Unlike This';
                if ($_REQUEST['verb'] == 'love') {
                    $already_liked = 'I love it!';
                }
            }
        }
    }
    writetextimage($likes, $already_liked);
}
elseif ($_REQUEST['ret'] == 'add') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error: id not found', '');
        exit();
    }
    $headerurl = 'Location:' . $url;
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $addtopic_query = mysql_query("INSERT INTO $database (postid, ips) VALUES ('$topicid', '$userip')");
        header($headerurl);
        exit();
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                unset($ratedips[$i]);
                $ratedips = implode(',', $ratedips);
                $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips' WHERE postid='$topicid'") or die(mysql_error());
                header($headerurl);
                exit();
            }
        }
        $ratedips[$count] = $userip;
        $ratedips2 = implode(',', $ratedips);
        if ($ratedips[0] == '') {
            $ratedips2 = $userip;
        }
        $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips2' WHERE postid='$topicid'") or die(mysql_error());
        header($headerurl);
        exit();
    }
}
elseif ($_REQUEST['ret'] == 'top') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $type = 'Post';
        }
        else {
            $database = 'tbg_topicrate';
            $type = 'Topic';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $type = 'Post';
        }
        else {
            $database = 'topicrate';
            $type = 'Topic';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if($_REQUEST['verb'] == 'love') {
        $likes = $likes . ' Love-its';
    }
    else {
        $likes = $likes . ' Likes';
    }
    $explodedip = explode(',', $ipssort[$_REQUEST['rank']-1]);
    writetextimage($_REQUEST['rank'] . '.' . " $type " . $winnerpost, $explodedip[0] . $likes);
}
elseif ($_REQUEST['ret'] == 'toplink') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'tbg_topicrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'topicrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if (!isset($afterbit)) {
        $headerurl = $url . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
    else {
        $headerurl = $url . $winnerpost . $afterbit . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
}
else {
    writetextimage('Error: incorrect URL vars used', 'Better luck next time!');
}
?>

This took a long time to write so please support me!

I'd like to thank LS97 for the writetextimage() code and Sparks for his inspirational API thread.

Right, now for how you can add it to your posts.

First off you need to make a url tag with the url http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add to find the topic id, you must first make the post, go out to the forums section your topic is in, click on your topic and you'll see in the url bar something like scratch.mit.edu/forums/viewtopic.php?id=# where # is a number, you need to copy this number and put it in the TOPIC ID HERE.

So far we have

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][/url]

Now for the image part
Basically you use the same id but you use an image tag and the url is slightly different so

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][url]http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=image[/url][/url]

notice ret=image now rather than ret=add.
To have a like button that likes a tbg forum topic, just add &forum=tbg to the url for both image and link. To make it use love-its instead of likes (changes the text) then add &verb=love onto the end of the image url only. this is what it looks like: http://rookwood101.tk/topicrate.php?id= … ;verb=love

Make sure to check out Sidharth's Javascript code that automatically generates the code for you based on the url of your post! Here it ishttp://rookwood101.tk/topicrate.php?id= … ;type=post and you can like it using the new likeable posts feature (see below on how to implement yourself)!

Which brings us nicely onto the new:
Likeable Posts!
So, you've made a post in a topic that you think everyone will like, and want to show there thanks, but the like button only supports topics. Well not anymore!

You can now have likeable posts, all you have to do is use the same code as topics, except change the id to the id of your post. To find this out, when you make a post, check (once you've posted it) what your url bar says, it will have on the end something like #p123456 you need to copy the number bit of it (in this case 123456) and put that as the id in my code

Code:

[url=http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=add&type=post][url]http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=image&type=post[/url][/url]

then, as you can see here you put on the end of each of the urls (image and link) &type=post this is to tell my script that you're talking about a post and not a topic. If you leave this blank then it will think it is a topic, and either it won't work, or you will be liking some random topic.



Well, we're done! I hope you like this new feature!

Custom like button styles
So, you like the idea of 'like buttons' but don't like the style they're in?
Introducing:
Custom made like buttons
Basically, you tell me the style of button you want, font, background shape, colours etc. and I make it for you, adding it as an option in the URL of the image eg. stl=1 meaning style = style no.1. I might add the option to change the font colour & size from the URL, it all depends on how many custom requests I get.

Current Styles:
Style 1 - http://rookwood101.tk/topicrate.php?id= … ;ret=image Style 1 is default, no extra code needed
Style 2 - http://rookwood101.tk/topicrate.php?id= … mp;style=2 add &style=2 to the end of the image url to enable this style. Requested by IHeartGaming.
Style 3 - http://rookwood101.tk/topicrate.php?id= … mp;style=3 add &style=3 to the end of the image url to enable this style. Requested by Comp500.
Style 4 - http://rookwood101.tk/topicrate.php?id= … mp;style=4 add &style=4 to the end of the image url to enable this style. Requested by Nathanprocks.

Top liked rankings
See This Post for more info.

Thanks,
Rook

Changelog

Code:

V1.0
First Release, allows you to add like buttons to forum topics and like them.

V1.1
Changed text size & Added redirect to topic
V1.5
Added unlike feature so that if you liked
something in the past you can change
your mind and take away the like also
added small text saying either like or
unlike to show you what would happen if
you clicked the link.
V1.5.1
Bug Fixes, such as now displays image of
Error messages and I had a couple of variables
set the wrong way round.
V1.6
Prettier like button, thanks LS97!
V1.6.1
Fixed a bug where people could like topics
even if they didn't exist also put the mysql
details in a seperate file along with a
variable that holds the string 'Bad request'
something or other.
V1.7
TBG support! add &forum=tbg to url for it
to work.
V1.7.1
Have it use Love-its instead of Likes put
&verb=love on the end of the img url to
make it work.
V1.8
Added first custom style requested by
IHeartGaming.
V2.0
Finally added Likeable posts! as requested
by LS97.
V2.1
Added blue colouring for posts, and white
colouring for topics
V2.1.1
Added Comp500's style request.
V3.0
Added Top liked list!
V3.0.1
Added Nathanprocks' style request
V3.1
Fixed Bug where if two posts had
the same amount of likes, they would
only use one id between them on the
ranks list.
V4
Basically a downgrade, new hosts
so it will work, basically get rid of
the scratchloveit.netne.net and
replace it with rookwood101.tk

Todo list

Code:

 · Star Rating System (Seperate project)
 · Customisable Button-added requested one,
   need to make fully user customisable
 · Add Supporters list support using scratch
   login api.
 · Custom Button text (different to Like and Love)
 · Show rank of post/topic on like button
 · Stats

It still adds two likes...

err.. no, I added one, and I'm assuming you did aswell, at the same time.


http://i.imgur.com/zeIZW.png

Offline

 

#109 2011-10-03 02:45:53

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

Pecola1 wrote:

Yay! For some reason the love it in your Sig won't work though... The picture does but not the link.

fixed!


http://i.imgur.com/zeIZW.png

Offline

 

#110 2011-10-03 12:04:25

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

it says
error:id not found
for me


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#111 2011-10-03 12:15:19

scratcher7_13
Scratcher
Registered: 2011-02-09
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

scratcher7_13 wrote:

rookwood101 wrote:

WE'RE BACK! TO FIX YOUR LIKE BUTTONS, REPLACE scratchloveit.netne.net with rookwood101.tk in the urls of your image tags and url tags

Unfortunately, love it counters have been reset, so you will have to start tallying the up again  sad  but better than nothing eh?  smile

Hello everyone, Rook here. I've been developing a way for people to "like" forum topics and I'm looking for some testers, all you need to do is click the button below and 'like' this topic. I will also post the source code and how you can add a like button to your own topic.

Click here for Sparks' self updating images and links in posts!!

How the liking system works
The image
This checks a mysql database and shows how many people have clicked the like button
The link
This does something a bit more complicated, first of all it checks to see whether people have liked the topic at all before, if not then it adds a whole new entry into the database this entry has your ip address and the topic id. If people have liked the topic before, it checks whether your ip is on the list of ips for that topic, if not then it adds your ip to the list of ips for that topic. This means that you can only like things once.

Please like this topic to show your support: http://rookwood101.tk/topicrate.php?id= … ;ret=image

and the source code:

Code:

<?php
function writetextimage($string, $substring) {
    if ($_REQUEST['type'] == 'post') {
        $img = imagecreatefrompng ('bgpost.png');
        $text_colour = imagecolorallocate($img, 254, 254, 254);
    }
    else {
        $img = imagecreatefrompng ('bg.png');
        $text_colour = imagecolorallocate($img, 1, 1, 1);
    }
    $font = realpath('font.ttf');
    imagettftext($img, 7, 0, 10, imagefontheight(7), $text_colour, $font, $string);
    imagettftext($img, 7, 0, 10, 28, $text_colour, $font, $substring);
    $whit = imagecolorallocate($img, 0, 0, 0);
    imagecolortransparent($img, $whit);
    header('Content-type: image/png');
    imagepng($img);
    imagecolordeallocate($text_color);
    imagedestroy($img);
}

include 'mysql.php';
$topicid = $_REQUEST['id'];
$userip = $_SERVER['REMOTE_ADDR'];
if ($_REQUEST['forum'] == 'tbg') {
    $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=' . $topicid;
    $database = 'tbg_topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'tbg_postrate';
    }
}
else {
    $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=' . $topicid;
    $database = 'topicrate';
    if ($_REQUEST['type'] == 'post') {
        $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=' . $topicid . '#p' . $topicid;
        $database = 'postrate';
    }
}

if ($_REQUEST['ret'] == 'image') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error:', 'id not found');
        exit();
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $likes = 0;
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $likes = count($ratedips);
        if ($ratedips[0] == '') {
            $likes = 0;
        }
    }
    if ($likes == 1) {
        $likes = 1 . ' Like';
        if($_REQUEST['verb'] == 'love') {
            $likes = 1 . ' Love-it';
        }
    }
    else {
        if($_REQUEST['verb'] == 'love') {
            $likes = $likes . ' Love-its';
        }
        else {
            $likes = $likes . ' Likes';
        }
    }
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $already_liked = 'Like This';
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        if ($_REQUEST['verb'] == 'love') {
            $already_liked = 'Love it?';
        }
        else {
            $already_liked = 'Like This';
        }
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                $already_liked = 'Unlike This';
                if ($_REQUEST['verb'] == 'love') {
                    $already_liked = 'I love it!';
                }
            }
        }
    }
    writetextimage($likes, $already_liked);
}
elseif ($_REQUEST['ret'] == 'add') {
    if (is_numeric($topicid) === false) {
        writetextimage('Error: id is not valid', '');
        exit();
    }
    $urlcontents = trim(file_get_contents($url));
    if (strpos($urlcontents, $bdrq) != false) {
        writetextimage('Error: id not found', '');
        exit();
    }
    $headerurl = 'Location:' . $url;
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $checkquery = mysql_query("SELECT * FROM $database WHERE postid='$topicid'");
    if (mysql_num_rows($checkquery) == 0) {
        $addtopic_query = mysql_query("INSERT INTO $database (postid, ips) VALUES ('$topicid', '$userip')");
        header($headerurl);
        exit();
    }
    else {
        $topicratings = mysql_fetch_row($checkquery) or die(mysql_error());
        $ratedips = explode(',', $topicratings[1]);
        $count = count($ratedips);
        for($i=0; $i<$count; $i++) {
            if($ratedips[$i] == $userip) {
                unset($ratedips[$i]);
                $ratedips = implode(',', $ratedips);
                $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips' WHERE postid='$topicid'") or die(mysql_error());
                header($headerurl);
                exit();
            }
        }
        $ratedips[$count] = $userip;
        $ratedips2 = implode(',', $ratedips);
        if ($ratedips[0] == '') {
            $ratedips2 = $userip;
        }
        $updateips_query = mysql_query("UPDATE $database SET ips='$ratedips2' WHERE postid='$topicid'") or die(mysql_error());
        header($headerurl);
        exit();
    }
}
elseif ($_REQUEST['ret'] == 'top') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $type = 'Post';
        }
        else {
            $database = 'tbg_topicrate';
            $type = 'Topic';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $type = 'Post';
        }
        else {
            $database = 'topicrate';
            $type = 'Topic';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if($_REQUEST['verb'] == 'love') {
        $likes = $likes . ' Love-its';
    }
    else {
        $likes = $likes . ' Likes';
    }
    $explodedip = explode(',', $ipssort[$_REQUEST['rank']-1]);
    writetextimage($_REQUEST['rank'] . '.' . " $type " . $winnerpost, $explodedip[0] . $likes);
}
elseif ($_REQUEST['ret'] == 'toplink') {
    if($_REQUEST['forum'] == 'tbg') {
        if ($_REQUEST['type'] == 'post') {
            $database = 'tbg_postrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'tbg_topicrate';
            $url = 'http://scratch.mit.edu/tbgforums/viewtopic.php?id=';
        }
    }
    else {
        if ($_REQUEST['type'] == 'post') {
            $database = 'postrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?pid=';
            $afterbit = '#p';
        }
        else {
            $database = 'topicrate';
            $url = 'http://scratch.mit.edu/forums/viewtopic.php?id=';
        }
    }
    mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
    mysql_select_db($mysql_database) or die(mysql_error());
    $query = mysql_query("SELECT * FROM $database");
    for($i=0;$i<mysql_num_rows($query);$i++) {
        $temp = mysql_fetch_row($query);
        $postids[$i] = $temp[0];
        $ips[$i] = count(explode(',', $temp[1])) . ',' . $i;
        $ipssort[$i] = $ips[$i];
    }
    rsort($ipssort, SORT_NUMERIC);
    for($i=0;$i<count($postids);$i++) {
        if($ips[$i] == $ipssort[$_REQUEST['rank']-1]) {
            $winnerpost = $postids[$i];
        }
    }
    if(!isset($ipssort[$_REQUEST['rank']-1])) {
        writetextimage('Error: Post with that', 'rank doesn\'t exist');
        exit();
    }
    if (!isset($afterbit)) {
        $headerurl = $url . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
    else {
        $headerurl = $url . $winnerpost . $afterbit . $winnerpost;
        header("Location:$headerurl");
        exit();
    }
}
else {
    writetextimage('Error: incorrect URL vars used', 'Better luck next time!');
}
?>

This took a long time to write so please support me!

I'd like to thank LS97 for the writetextimage() code and Sparks for his inspirational API thread.

Right, now for how you can add it to your posts.

First off you need to make a url tag with the url http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add to find the topic id, you must first make the post, go out to the forums section your topic is in, click on your topic and you'll see in the url bar something like scratch.mit.edu/forums/viewtopic.php?id=# where # is a number, you need to copy this number and put it in the TOPIC ID HERE.

So far we have

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][/url]

Now for the image part
Basically you use the same id but you use an image tag and the url is slightly different so

Code:

[url=http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=add][url]http://rookwood101.tk/topicrate.php?id=TOPIC ID HERE&ret=image[/url][/url]

notice ret=image now rather than ret=add.
To have a like button that likes a tbg forum topic, just add &forum=tbg to the url for both image and link. To make it use love-its instead of likes (changes the text) then add &verb=love onto the end of the image url only. this is what it looks like: http://rookwood101.tk/topicrate.php?id= … ;verb=love

Make sure to check out Sidharth's Javascript code that automatically generates the code for you based on the url of your post! Here it ishttp://rookwood101.tk/topicrate.php?id= … ;type=post and you can like it using the new likeable posts feature (see below on how to implement yourself)!

Which brings us nicely onto the new:
Likeable Posts!
So, you've made a post in a topic that you think everyone will like, and want to show there thanks, but the like button only supports topics. Well not anymore!

You can now have likeable posts, all you have to do is use the same code as topics, except change the id to the id of your post. To find this out, when you make a post, check (once you've posted it) what your url bar says, it will have on the end something like #p123456 you need to copy the number bit of it (in this case 123456) and put that as the id in my code

Code:

[url=http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=add&type=post][url]http://rookwood101.tk/topicrate.php?id=POST ID HERE&ret=image&type=post[/url][/url]

then, as you can see here you put on the end of each of the urls (image and link) &type=post this is to tell my script that you're talking about a post and not a topic. If you leave this blank then it will think it is a topic, and either it won't work, or you will be liking some random topic.



Well, we're done! I hope you like this new feature!

Custom like button styles
So, you like the idea of 'like buttons' but don't like the style they're in?
Introducing:
Custom made like buttons
Basically, you tell me the style of button you want, font, background shape, colours etc. and I make it for you, adding it as an option in the URL of the image eg. stl=1 meaning style = style no.1. I might add the option to change the font colour & size from the URL, it all depends on how many custom requests I get.

Current Styles:
Style 1 - http://rookwood101.tk/topicrate.php?id= … ;ret=image Style 1 is default, no extra code needed
Style 2 - http://rookwood101.tk/topicrate.php?id= … mp;style=2 add &style=2 to the end of the image url to enable this style. Requested by IHeartGaming.
Style 3 - http://rookwood101.tk/topicrate.php?id= … mp;style=3 add &style=3 to the end of the image url to enable this style. Requested by Comp500.
Style 4 - http://rookwood101.tk/topicrate.php?id= … mp;style=4 add &style=4 to the end of the image url to enable this style. Requested by Nathanprocks.

Top liked rankings
See This Post for more info.

Thanks,
Rook

Changelog

Code:

V1.0
First Release, allows you to add like buttons to forum topics and like them.

V1.1
Changed text size & Added redirect to topic
V1.5
Added unlike feature so that if you liked
something in the past you can change
your mind and take away the like also
added small text saying either like or
unlike to show you what would happen if
you clicked the link.
V1.5.1
Bug Fixes, such as now displays image of
Error messages and I had a couple of variables
set the wrong way round.
V1.6
Prettier like button, thanks LS97!
V1.6.1
Fixed a bug where people could like topics
even if they didn't exist also put the mysql
details in a seperate file along with a
variable that holds the string 'Bad request'
something or other.
V1.7
TBG support! add &forum=tbg to url for it
to work.
V1.7.1
Have it use Love-its instead of Likes put
&verb=love on the end of the img url to
make it work.
V1.8
Added first custom style requested by
IHeartGaming.
V2.0
Finally added Likeable posts! as requested
by LS97.
V2.1
Added blue colouring for posts, and white
colouring for topics
V2.1.1
Added Comp500's style request.
V3.0
Added Top liked list!
V3.0.1
Added Nathanprocks' style request
V3.1
Fixed Bug where if two posts had
the same amount of likes, they would
only use one id between them on the
ranks list.
V4
Basically a downgrade, new hosts
so it will work, basically get rid of
the scratchloveit.netne.net and
replace it with rookwood101.tk

Todo list

Code:

 · Star Rating System (Seperate project)
 · Customisable Button-added requested one,
   need to make fully user customisable
 · Add Supporters list support using scratch
   login api.
 · Custom Button text (different to Like and Love)
 · Show rank of post/topic on like button
 · Stats

It still adds two likes...

err.. no, I added one, and I'm assuming you did aswell, at the same time.

It adds two every time.


♫ 90% of teens can't do math. If you are one of the 40% of teens who can, copy and paste this into your signature. ♫♪
http://dl.dropbox.com/u/6273449/BlockLibraryTitle.pnghttp://i.imgur.com/mr9Hf.gif

Offline

 

#112 2011-10-03 12:15:30

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

joefarebrother wrote:

it says
error:id not found
for me

Can you give me an example of the code you are using? I'm assuming you've put a post id instead of a topic id, to use post ids, you have to put &type=post onto the end of your urls


http://i.imgur.com/zeIZW.png

Offline

 

#113 2011-10-03 12:33:01

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

it is this topic and my code is

Code:

[url=http://rookwood101.tk/topicrate.php?id=855724&ret=add][img]http://rookwood101.tk/topicrate.php?id=855724&ret=image[/img][/url]

My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#114 2011-10-03 13:51:59

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

the link you gave me was for a post, so you need to either put:

Code:

&type=post

on the end of your urls (after &ret=image OR &ret=add) OR set the id to 70231.


http://i.imgur.com/zeIZW.png

Offline

 

#115 2011-10-04 13:38:56

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

lol rockwood101.tk doesnt work because of too many viesw loooooooooooooooooool


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#116 2011-10-04 13:46:52

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

comp500 wrote:

lol rockwood101.tk doesnt work because of too many viesw loooooooooooooooooool

er... yes it does...


http://i.imgur.com/zeIZW.png

Offline

 

#117 2011-10-05 02:40:19

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

comp500 wrote:

lol rockwood101.tk doesnt work because of too many viesw loooooooooooooooooool

er... yes it does...

redirects to http://www.search.tk/index.html&_=1317796799


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#118 2011-10-05 02:46:33

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

Thats because it's rookwood101.tk not rockwood101.tk  tongue


http://i.imgur.com/zeIZW.png

Offline

 

#119 2011-10-05 10:06:38

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: Make your Forum Posts/Topics Likeable! - fixed

Ok, I updated the bookmarklets and the top topic/post generator.

Hope it works  smile

Last edited by Sidharth (2011-10-05 10:06:59)


http://www.danasoft.com/citysign.jpg

Offline

 

#120 2011-10-05 11:35:39

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

Thats because it's rookwood101.tk not rockwood101.tk  tongue

o.


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#121 2011-10-05 11:38:55

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

the styles dont work now. D:


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#122 2011-10-05 12:22:37

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

comp500 wrote:

the styles dont work now. D:

Nope.

@sidharth thanks!


http://i.imgur.com/zeIZW.png

Offline

 

#123 2011-10-07 14:21:54

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

rookwood101 wrote:

comp500 wrote:

the styles dont work now. D:

Nope.

@sidharth thanks!

and you need to transfer database.


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#124 2011-10-07 17:23:45

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Make your Forum Posts/Topics Likeable! - fixed

comp500 wrote:

rookwood101 wrote:

comp500 wrote:

the styles dont work now. D:

Nope.

@sidharth thanks!

and you need to transfer database.

the database is lost, when they suspended my account I was given no access to any of it.


http://i.imgur.com/zeIZW.png

Offline

 

#125 2011-10-08 04:05:52

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Make your Forum Posts/Topics Likeable! - fixed

ok.


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

Board footer