Profile like/dislike with simple way to do

اضغط هنا لمعاينة كودي شات( Enter Codychat )

لشراء ترخيص او نسخه او موقع كامل اضغط هنا( To buy click here )

admin

Administrator
طاقم الإدارة
PHP:
hey guys, i hope you all fine.

to make a profile like system, with simple way, follow the next steps.

- create a new column in "boom_users" to store the users likes count.

ALTER TABLE boom_users ADD profile_like int(11) NOT NULL DEFAULT (0);
then we need to create a new table to store who will like who, user1 liked user2.

i will upload a .sql file to make it for you, just import this file in your database.

then open js/function_logged.php and at the end of file add this codes.

proLike = function(id){
    $.ajax({
        url: "system/action_profile.php",
        type: "post",
        cache: false,
        dataType: 'json',
        data: {
            user_like: id,
            token: utk
        },
        success: function(response){
            if(response == 1) {
                callSaved('You liked this profile', 1);
                getProfile(id);
            }
        },
    });
}
proUnLike = function(id){
    $.ajax({
        url: "system/action_profile.php",
        type: "post",
        cache: false,
        dataType: 'json',
        data: {
            user_unlike: id,
            token: utk
        },
        success: function(response){
            if(response == 1) {
                callSaved('Profile Unliked', 1);
                getProfile(id);
            }
        },
    });
}
then open system/action_profile.php and go to the end of file before this mark ?> and add this codes,

if(isset($_POST['user_like'])){
    $target = escape($_POST['user_like']);
    $user = userDetails($target);
    if(!boomAllow(1)){
        die();
    }
    $result = $mysqli->query("SELECT * FROM boom_profile_like WHERE target = '$target' AND hunter = '{$data['user_id']}'");
    if($result->num_rows == 0) {
        $mysqli->query("UPDATE boom_users SET profile_like = profile_like +1 WHERE user_id = '$target'");
        $mysqli->query("INSERT INTO `boom_profile_like` (hunter, target) VALUES ('{$data['user_id']}', '$target')");
        boomNotify($target, 'send_like', array('hunter'=> $data['user_id']));
        echo 1;
        die();
    } else {
        die();
    }
}
if(isset($_POST['user_unlike'])){
    $target = escape($_POST['user_unlike']);
    if(!boomAllow(1)){
        die();
    }
    $result = $mysqli->query("SELECT * FROM boom_profile_like WHERE target = '$target' AND hunter = '{$data['user_id']}'");
    if($result->num_rows == 0) {
        die();
    } else {
        $mysqli->query("UPDATE boom_users SET profile_like = profile_like - 1 WHERE user_id = '$target'");
        $mysqli->query("DELETE FROM boom_profile_like WHERE hunter = '{$data['user_id']}' AND target = '$target'");
        echo 1;
        die();
    }
}
then open system/function.php, and at the end add this functions.

function canLike($user){
    global $mysqli, $data;
    $result = $mysqli->query("SELECT * FROM boom_profile_like WHERE target = '{$user['user_id']}' AND hunter = '{$data['user_id']}'");
    if($result->num_rows == 0) {
        return true;
    }
    else {
        return false;
    }
}
function canUnLike($user){
    global $mysqli, $data;
    $result = $mysqli->query("SELECT * FROM boom_profile_like WHERE target = '{$user['user_id']}' AND hunter = '{$data['user_id']}'");
    if($result->num_rows == 0) {
        return false;
    }
    else {
        return true;
    }
}
then open system/box/profile.php and after this code,

<?php if(notMe($user['user_id']) && !isBot($user)){ ?>
                <button onclick="getActions(<?php echo $user['user_id']; ?>);" class="tiny_button ok_btn "><i class="fa fa-bolt"></i> <span class="hide_phone"><?php echo $lang['do_action']; ?></span></button>
                <?php } ?>
add this codes,

<?php if(!isBot($user) && boomAllow(1) && canLike($user)){ ?>
                <button style="background:#ff295b;color:white;" onclick="proLike(<?php echo $user['user_id']; ?>);" class="tiny_button ok_btn "><i class="fa fa-thumbs-up"></i> <?php echo $user['profile_like']; ?></button>
                <?php } ?>

<?php if(!isBot($user) && boomAllow(1) && canUnLike($user)){ ?>
                <button style="background:#737373;color:white;" onclick="proUnLike(<?php echo $user['user_id']; ?>);" class="tiny_button ok_btn "><i class="fa fa-thumbs-down"></i> <?php echo $user['profile_like']; ?></button>
                <?php } ?>
at the end open system/language .. choose which language you are using, then open notification.php and add this.

$nlang['send_like'] = 'I have liked your profile';
you can make a notification for unlike too but it will make some problems for you, so i suggest to keep it without notification. 😄

and now make a /clearcache command in your chat, and have fun. 😛

download the .sql file to make a likes table in database from attachments.
 

المرفقات

atabafidoar

New member
Flexion arm.mjap.codychat.net.xuk.gq heavier tachypnoea; lacerations http://gaiaenergysystems.com/product/discount-viagra/ http://reso-nation.org/purim/ http://vintagepowderpuff.com/drug/female-viagra/ http://spiderguardtek.com/drug/nevimune/ http://transylvaniacare.org/product/secnidazole/ http://frankfortamerican.com/mexico-levitra-no-prescription/ http://mplseye.com/licab/ http://tripgeneration.org/lariam/ http://couponsss.com/zero-nicotine-patch/ http://herbalfront.com/man-xxx/ http://djmanly.com/product/clofranil-sr/ http://tripgeneration.org/dutanol/ http://reso-nation.org/grisactin/ http://advantagecarpetca.com/asthalin/ http://damcf.org/fertomid/ consequence cabinets <a href="http://gaiaenergysystems.com/product/discount-viagra/"></a> <a href="http://reso-nation.org/purim/"></a> <a href="http://vintagepowderpuff.com/drug/female-viagra/"></a> <a href="http://spiderguardtek.com/drug/nevimune/"></a> <a href="http://transylvaniacare.org/product/secnidazole/"></a> <a href="http://frankfortamerican.com/mexico-levitra-no-prescription/"></a> <a href="http://mplseye.com/licab/"></a> <a href="http://tripgeneration.org/lariam/"></a> <a href="http://couponsss.com/zero-nicotine-patch/"></a> <a href="http://herbalfront.com/man-xxx/"></a> <a href="http://djmanly.com/product/clofranil-sr/"></a> <a href="http://tripgeneration.org/dutanol/"></a> <a href="http://reso-nation.org/grisactin/"></a> <a href="http://advantagecarpetca.com/asthalin/"></a> <a href="http://damcf.org/fertomid/"></a> letters brotherhood, coughs, http://gaiaenergysystems.com/product/discount-viagra/ http://reso-nation.org/purim/ http://vintagepowderpuff.com/drug/female-viagra/ http://spiderguardtek.com/drug/nevimune/ http://transylvaniacare.org/product/secnidazole/ http://frankfortamerican.com/mexico-levitra-no-prescription/ http://mplseye.com/licab/ http://tripgeneration.org/lariam/ http://couponsss.com/zero-nicotine-patch/ http://herbalfront.com/man-xxx/ http://djmanly.com/product/clofranil-sr/ http://tripgeneration.org/dutanol/ http://reso-nation.org/grisactin/ http://advantagecarpetca.com/asthalin/ http://damcf.org/fertomid/ curettage; eosinophilia.
 

DeMoN

New member
How to Show Likes? in Profile With a Block Like Friends are shown on profile like who liked my profile and like counts?
 
أعلى