title: CSRF (Cross-site request forgery) attack example and prevention in PHP
body: <p>I have an website where people can place a vote like this:</p>
  
  <pre><code>http://mysite.com/vote/25
  </code></pre>
  
  <p>This will place a vote on item 25. I want to only make this available for registered users, and only if they want to do this. Now I know when someone is busy on the website, and someone gives them a link like this:</p>
  
  <pre><code>http://mysite.com/vote/30
  </code></pre>
  
  <p>then the vote will be places for him on the item without him wanting to do this.</p>
  
  <p>I have read the <a href="http://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)" rel="noreferrer">explanation on the OWASP website</a>, but i don't really understand it</p>
  
  <p>Is this an example of CSRF, and how can I prevent this. The best thing i can think off is adding something to the link like a hash. But this will be quite irritating to put something on the end of all the links. Is there no other way of doing this.</p>
  
  <p>Another thing can someone maybe give me some other example of this, because the website seems fairly fugue to me.</p>