title: Making a secure scoring system in PHP
body: <p>On my website, I display 5 questions (MCQs) per page and when the user requests new page, I am calling a script <code>score_update()</code> with the score of this page and then presenting him with the next page.</p>
  
  <p>The <code>scoreUpdate()</code> script is something like</p>
  
  <pre><code>&lt;?php
  //connect to database
  //update the score
  ?&gt;
  </code></pre>
  
  <p>The problem is that the user may refresh the page and the score may be updated twice or the number of times he refreshes the page or he may directly call the script by viewing the source code.</p>
  
  <p>How can I implement this system?I need an idea.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is my database schema</p>
  
  <p><code>user</code></p>
  
  <pre><code>------------------------------------------
  user_id  | username  |  password  | points
  ------------------------------------------
  </code></pre>
  
  <p>PS :The user may attempt the same question again at some point in future. There is no restriction on it. So no need to keep track of questions attempted by him. He must get marks only if he attempted the question and knocked it right. Hope I am clear.</p>