/ reddit voting system in php


I see for example how to execute a StackOverflow / reddit voting system in php.

Actually I want the up and down arrow box, are there any good examples?

There are many scripts but it is not very difficult to do it yourself.

I have used jQuery (to control AJAX) and a small PHP script first. For example, some pseudo code:

  // Some are checking recent votes from this user if appropriate (isset ($ _ POST ['voteType'], $ _POST ['PostId']) & amp; $ user- & gt; log in) {// Insert in the insert database if the echo json_encode is not already inserted (array ('error' = & gt; wrong)) ; } Else {// bad request / attempted echo json_encode (array ('error' = & gt; true; 'message' = & gt; 'bad parameters sent')); }  

and then some jQuery:

  $ ('# upvote'). Click (function () ($ '.post' ('vote.php', {subtype: 'up', post id: 42}, 'update icon (data, textstats)', 'jason')});  

function update icon (data, textstats) {// if error = wrong highlight upwat icon /

Comments