Location: PHPKode > projects > ProjectPress > projectpress/profile/like.php
<?php
/**
 * ProjectPress like wall comment
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();
define('access',true);
require_once(dirname(dirname(__FILE__)) . '/config.inc.php');
require_once(PM_DIR . 'pm-includes/global.inc.php');

// Checks if user is logged in; if not redirect to login page.
if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();
	
	if($_REQUEST['postId'])
	{
		$username = $_SESSION['username'];
		
		pmdb::connect()->query("update ". DB ."wall_posts set likes=likes+1 where p_id= '".$_REQUEST['postId']."'");
		
		pmdb::connect()->query("INSERT INTO ". DB ."wall_likes_username (l_user,post_id) VALUES('".$username."','".$_REQUEST['postId']."')");
		
		$total_likes = pmdb::connect()->query("SELECT * FROM ". DB ."wall_posts where p_id = '".$_REQUEST['postId']."'");
		$likes = $total_likes->fetch_array();
		$likes = $likes['likes'];
	}
	echo $likes;
Return current item: ProjectPress