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

#1 2012-04-06 17:35:54

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

ScratchBB Like Button

When I checked the ScratchBB and Loves/Hates about the forums threads, I noticed people want a like button.  I also realized that I have one ready, with only a few tweaks for a post.  I have already made the tweaks and it is ready for use.  Here's how it works:

Like counter:

Code:

<img src="http://like.cfagency.org/scratchbb/counter.php?pid=postIdHere" />

Like button:

Code:

<a href="http://like.cfagency.org/scratchbb/like.php?pid=postIdHere"><img src="http://like.cfagency.org/scratchbb/like.png" /></a>

The code is shown in HTML  because that's how it would be implemented into ScratchBB.  Thanks for your attention and time.


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

Offline

 

#2 2012-04-06 18:10:59

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: ScratchBB Like Button

Is there any way you could convert that into BBCode for our user signatures (like in yours)?


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#3 2012-04-06 18:24:37

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: ScratchBB Like Button

jvvg wrote:

Is there any way you could convert that into BBCode for our user signatures (like in yours)?

Yes.  I can.  That code doesn't currently work because it has been modified for ScratchBB, but the original works in signatures.  Here it is:

Code:

[url=http://like.cfagency.org/like.php?site=referer][i mg]http://like.cfagency.org/like.png[/im g][/url]
[i mg]http://like.cfagency.org/counter.php?site=referer[/im g] people like this.

You need to remove the spaces in the IMG tags.


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

Offline

 

#4 2012-04-08 05:01:13

Zeusking19
Scratcher
Registered: 2011-07-10
Posts: 1000+

Re: ScratchBB Like Button

Hi. I am Zeus. ScratchBB human resources team.

I like the idea of like counters. I would love to implement this in the software. Wait while I implement this. Be back in 10 mins.

Zeusking19
ScratchBB Team


http://i49.tinypic.com/2w7e1jm.pnghttp://dragcave.net/image/eFGFz.gifhttp://dragcave.net/image/9hE5q.gif

Offline

 

#5 2012-04-08 06:43:23

Zeusking19
Scratcher
Registered: 2011-07-10
Posts: 1000+

Re: ScratchBB Like Button

Hi again, Zeus from ScratchBB human resources.

I need the server-side code as well as the html. We need to have our own server side code implemented so ScratchBB dosnt have to contact the outside world.

If the server side requires SQL code, we will implement that to our install.sql script.


http://i49.tinypic.com/2w7e1jm.pnghttp://dragcave.net/image/eFGFz.gifhttp://dragcave.net/image/9hE5q.gif

Offline

 

#6 2012-04-08 13:45:27

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: ScratchBB Like Button

Server side... well, here goes nothing:
counter.php (Counter image script):

<?php
mysql_connect("mysql host", "mysql username", "*********");
mysql_select_db("sqldb");
$post = $_GET["pid"];
$count = mysql_numrows(mysql_query("SELECT * FROM table WHERE post_id = '$post'"));
$count = strval($count);
$digits = strlen($count);
$width = 9.5 * $digits;
$img = imagecreate($width, 15);
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0);
imagecolortransparent($img, $white);
imagestring($img, 5, 0, 0, $count, $black);
header("Content-type: image/png");
imagepng($img);
?>

like.php

<?php
mysql_connect(sql info);
mysql_select_db("sqldb");
$post = $_GET["pid"];
$ip = $_SERVER["REMOTE_ADDR"];
if(mysql_numrows(mysql_query("SELECT * FROM table WHERE ip = '$ip' AND post_id = '$post'")) > 0) {
  header("Location: ".$_SERVER["HTTP_REFERER"]);
}
else {
  mysql_query("INSERT INTO table VALUES (null, '$ip', '$post')") or die(mysql_error());
  header("Location: ".$_SERVER["HTTP_REFERER"]);
}
?>

like.png
On ImageShack:
http://img84.imageshack.us/img84/8777/likezb.png
Or link: http://img84.imageshack.us/img84/8777/likezb.png

EDIT: for the code, you might want to qoute this to extract the code.  Also, green stuff means you need to change it to your MySQL info.

Last edited by GeonoTRON2000 (2012-04-08 16:56:30)


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

Offline

 

#7 2012-04-08 14:41:23

Zeusking19
Scratcher
Registered: 2011-07-10
Posts: 1000+

Re: ScratchBB Like Button

SQL dump file is needed as well. Sorry about that.


http://i49.tinypic.com/2w7e1jm.pnghttp://dragcave.net/image/eFGFz.gifhttp://dragcave.net/image/9hE5q.gif

Offline

 

#8 2012-04-08 15:26:19

Squawkers13
Scratcher
Registered: 2010-11-20
Posts: 500+

Re: ScratchBB Like Button

you need to move your imgs before it will work


http://pekkit.net/banners/pekkit.png

Offline

 

#9 2012-04-08 16:54:16

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: ScratchBB Like Button

SQL Code:

Code:

CREATE TABLE `scratchbb_likes` (
  `id` bigint(255) NOT NULL AUTO_INCREMENT,
  `ip` varchar(15) COLLATE latin1_general_ci NOT NULL,
  `post_id` varchar(255) COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

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

Offline

 

#10 2012-04-08 16:57:26

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: ScratchBB Like Button

Squawkers13 wrote:

you need to move your imgs before it will work

To where?

EDIT: OH!  IN THE CODE!

Last edited by GeonoTRON2000 (2012-04-08 16:58:01)


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

Offline

 

#11 2012-04-09 16:54:39

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: ScratchBB Like Button

Ah, you're the one who created this?
I really enjoy this button, it's the better version of this, IMHO.  smile

Offline

 

#12 2012-04-09 17:08:34

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: ScratchBB Like Button

Maybe I'll program one of my own. I've already started.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#13 2012-04-12 06:21:25

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Offline

 

#14 2012-04-12 21:07:50

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: ScratchBB Like Button


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

Offline

 

Board footer