I want to achieve that a user cannot send the same input twice. I use a php script to submit user input.
My idea is to save his inputs in a session array and each time that he submits something check through the array if it matches one of the things he already submitted before.
The code looks like this:
//Compare post with what user has posted so far; if the same, exit (spam protection)
foreach($_SESSION['postarray'][] as $postarray) if($post=$postarray) exit;
//Save post in session of all other posts
$_SESSION['postarray'][]=$post;
I get the following error:
Fatal error: Cannot use [] for reading in /Applications/XAMPP/xamppfiles/htdocs/postish/action/post.php on line 32 (which refers to the line with the foreach() loop)
Even after changing the function to only $_SESSION['post array'], it doesn't work either.
Any help much appreciated :)
Dennis