Digg Style Follow Unfollow PHP, jQuery and CSS

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))
{?>
<div class=”digg-panel”>

<div class=”img-username”>

<img alt=”<?php echo $row[‘username’]?>” src=”<?php echo $row[‘image’]?>.png” width=”40″ height=”40″ class=”userImage” alt=”” />
<div class=”user-title”>
<a href=”http://digg.com/&lt;?php echo $row[‘username’]?>” class=”fullname”><?php echo $row[‘fullname’]?></a>

<a href=”http://digg.com/&lt;?php echo $row[‘username’]?>” class=”username”><?php echo $row[‘username’]?></a>
</div>
</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 class=”bio”>
<?php echo $row[‘bio’]?>
</div>

</div>
<?php
}?>

Download Files

Advertisements

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

  1. Saved as a favߋrite, I like your site!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s