Not exactly the exact name. In general, closer to the point.

I have a form on one page in which I write down one word. The form is idw=3&ida=3 in the verification file and returns an $ _GET array of the following type: idw=3&ida=3 . The fact is that if these values ​​are replaced, then the user will be able to calmly pick the wrong combination, to make a different answer to one question. What he could not do need to make some kind of verification code or easier. If I am in the array GET will pass the words themselves answers. But even so there is a possibility of selection. (it turns out like this: idw=Щука&idsa=Я%20многое%20видал )

Algorithm of the site:

  • The user enters a word in the form and presses to send.
  • The verification page accepts the word. Actions are taken on him. If the word is not yet in the database, it is added there, after which in all cases one answer is selected and sent to the user GET by an array back to index.php with the form.
  • On this page, there were initially queries that just took an ID from the GET array and pulled out the words themselves. Now this page directly gets the words themselves and simply derives them from $_GET['idw'] and others ...
  • There is no registration on the site, it is essentially a learning bot, it replenishes its base with the help of users.

It is necessary to make so that changing the array in the address bar does not change / forbid the display of the wrong combination of question-answer.

    1 answer 1

    You can for example store the key in the table and search for it. It will be very difficult to pick up. Here's how I would do it:

     echo md5(uniqid()); 

    This code will issue a key of the form: 8203793574c1abf39a78837a19e7d118
    I think the idea itself is clear. Realizations and fantasies are many. Successful coding ...

    • But will the key be passed to the GET array? The user can take it and send it with data. Obviously I did not understand something. - Telion
    • You can leave only the key as a parameter and make a selection by it. - Urmuz Tagizade
    • Wait, can you describe the sequence of actions? I do not quite understand. The key is stored in the session or where? The user should not have this key, otherwise there will be a vulnerability again. - Telion
    • Where do you keep the data? If in the database, create the key field. And do a sample by key. If you completely describe your task, it will be much easier to help - Urmuz Tagizade
    • I updated the question by adding the algorithm of the site. - Telion