Guest User

tuto-voting-system.php

a guest
Apr 8th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. $server = "localhost";
  4. $username = "root";
  5. $password = "root";
  6. $db = "slabefore";
  7.  
  8. $bdd = mysqli_connect($server,$username,$password,$db);
  9.  
  10. mysqli_set_charset($bdd,"utf8");
  11.  
  12. console.log("a");
  13.  
  14. if($_POST) {
  15. mysqli_query($bdd,"update rating set up=up+1 where mes_id='$id'");
  16.  
  17. //$query = $bdd->execute('UPDATE postslabefore SET ranking = ranking '.$_POST['value'].' WHERE id='.$_POST['id'].''); // Update number with +1 or -1
  18.  
  19. //$rating = $bdd->getOne('SELECT ranking FROM postslabefore WHERE id='.$_POST['id'].''); // Get the new number value
  20.  
  21. //$expire = 24*3600; // 1 day
  22. //setcookie('tcVotingSystem'.$_POST['id'], 'voted', time() + $expire, '/'); // Place a cookie
  23. console.log("a");
  24. //echo $value['ranking']; // Send back the new number value
  25. }
  26. ?>
Add Comment
Please, Sign In to add comment