<?php
function smarty_modifier_check_user_vote($user_id,$media_id)
{
global $mysqli;
$sql = "SELECT * FROM user_votes WHERE user_id='$user_id' AND media_id='$media_id' LIMIT 1";
$query = $mysqli->query($sql);
$check = $query->num_rows;
if ($check == 0) {
	return 0;
} else {
	$row = $query->fetch_assoc();
	if ($row['vote_up'] == 1) {
		return 1;
	} else {
		return 2;
	}
}
}

?>