Digg Style Follow Unfollow PHP, jQuery and CSS

Sharing is caring!

You know Digg has altered its style and layout and now I suppose it looks wonderful. This time on vivacity, I make Digg Style follow/unfollow provision. Which I tried to make same as unique Digg look. Numerous clients like my facebook style excercises So this is a proceeds arrangement ofdigg style excercises. I trust You will like it. I have utilized client Ip to check emulated or unfollowed. Anyhow you can do this in your needed way. If its not too much trouble offer this assuming that you such as and dont neglect to subscribe via message.

DATABASE STRUCTURE
CREATE TABLE IF NOT EXISTS `digg_follow` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullname` varchar(120) NOT NULL,
`username` varchar(80) NOT NULL,
`image` varchar(100) NOT NULL,
`bio` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

CREATE TABLE IF NOT EXISTS `digg_follower_ip` (
`userip` varchar(200) NOT NULL,
`digg_id` int(11) NOT NULL,
PRIMARY KEY (`userip`)
)

JQUERY CODE
$(document).ready(function() {

$(‘.buttons > a’).livequery(“click”,function(e){

var parent = $(this).parent();
var getID = parent.attr(‘id’).replace(‘button_’,”);

$.post(“follow.php?id=”+getID, {

}, function(response){

$(‘#button_’+getID).html($(response).fadeIn(‘slow’));
});
});
});

HTML
<?php
include(“dbcon.php”);

$userip = $_SERVER[‘REMOTE_ADDR’];

$result = mysql_query(“select * from digg_follow order by id asc”);

while ($row = mysql_fetch_array($result))
{?>

” src=”.png” width=”40″ height=”40″ class=”userImage” alt=”” />

</div>

<?php
$res = mysql_query(“select * from digg_follower_ip where userip = ‘$userip’ AND digg_id = “.$row[‘id’]);

$check_result = @mysql_num_rows(@$res);

if($check_result > 0)
{?>
<span class=”buttons” id=”button_<?php echo $row[‘id’]?>”><a class=”btn-following” href=”javascript: void(0)”></a></span>
<?php
}
else
{?>
<span class=”buttons” id=”button_<?php echo $row[‘id’]?>”><a class=”btn-follow” href=”javascript:void(0)”></a></span>
<?php
}?>
<br clear=”all” />

</div>
<?php
}?>

Download Files

One thought on “Digg Style Follow Unfollow PHP, jQuery and CSS

Leave a Reply

Your email address will not be published. Required fields are marked *

Got Project on mind? Let's ConnectContact Us

Secured By miniOrange