Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once '../core/config/config.php';
- require_once '../core/config/db.php';
- if(isset($_SESSION['user'])) {
- $post = $_GET['post'];
- if(isset($_GET['post']) and isset($_GET['doit'])) {
- $postQueryPlus = mysqli_query($mysqli, "SELECT * FROM `up4k_posts` WHERE `id` = '$post'");
- $postPlus = mysqli_fetch_assoc($postQueryPlus);
- $nakrutka=mysqli_query($mysqli, "SELECT count(*) FROM `up4k_rating` WHERE `user` = '$_SESSION[user]' and `post` = '$post'");
- $nakrutka=mysqli_fetch_assoc($nakrutka);
- if($nakrutka['count(*)'] == "0" and $postPlus['author'] != $_SESSION['user'])
- {
- mysqli_query($mysqli, "INSERT INTO `up4k_rating`(`user`, `post`, `eq`, `user_to`) values ('$_SESSION[user]', '$postPlus[id]', 'plus', '$postPlus[author]') ;");
- }
- ///////////////////////////////////////////////
- }
- $pcq = mysqli_query($mysqli, "SELECT COUNT(*) FROM `up4k_rating` WHERE `post` = '$post' AND `eq` = 'plus' ");
- $pc = mysqli_fetch_assoc($pcq);
- // echo $pc['COUNT(*)'] . '<br />' ;
- $mcq = mysqli_query($mysqli, "SELECT COUNT(*) FROM `up4k_rating` WHERE `post` = '$post' AND `eq` = 'minus' ");
- $mc = mysqli_fetch_assoc($mcq);
- // echo $mc['COUNT(*)'] . '<br />' ;
- echo $pc['COUNT(*)'] - $mc['COUNT(*)'];
- } else {
- header('HTTP/1.1 403 Forbidden');
- ?>
- <h2>forbidden</h2>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement