daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     require_once '../core/config/config.php';
  3.     require_once '../core/config/db.php';
  4.     if(isset($_SESSION['user'])) {
  5.         $post = $_GET['post'];
  6.         if(isset($_GET['post']) and isset($_GET['doit'])) {
  7.             $postQueryPlus = mysqli_query($mysqli, "SELECT * FROM `up4k_posts` WHERE `id` = '$post'");
  8.             $postPlus = mysqli_fetch_assoc($postQueryPlus);
  9.             $nakrutka=mysqli_query($mysqli, "SELECT count(*) FROM `up4k_rating` WHERE `user` = '$_SESSION[user]' and `post` = '$post'");
  10.             $nakrutka=mysqli_fetch_assoc($nakrutka);
  11.             if($nakrutka['count(*)'] == "0" and $postPlus['author'] != $_SESSION['user'])
  12.             {
  13.                 mysqli_query($mysqli, "INSERT INTO `up4k_rating`(`user`, `post`, `eq`, `user_to`) values ('$_SESSION[user]', '$postPlus[id]', 'plus', '$postPlus[author]') ;");
  14.             }
  15.             ///////////////////////////////////////////////
  16.         }
  17.         $pcq = mysqli_query($mysqli, "SELECT COUNT(*) FROM `up4k_rating` WHERE `post` = '$post' AND `eq` = 'plus' ");
  18.         $pc = mysqli_fetch_assoc($pcq);
  19.         // echo $pc['COUNT(*)'] . '<br />' ;
  20.         $mcq = mysqli_query($mysqli, "SELECT COUNT(*) FROM `up4k_rating` WHERE `post` = '$post' AND `eq` = 'minus' ");
  21.         $mc = mysqli_fetch_assoc($mcq);
  22.         // echo $mc['COUNT(*)'] . '<br />' ;
  23.         echo $pc['COUNT(*)'] - $mc['COUNT(*)'];
  24.     } else {
  25.         header('HTTP/1.1 403 Forbidden');
  26.         ?>
  27.         <h2>forbidden</h2>
  28.         <?php
  29.     }
  30. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top