Reputation: 483
I want to run a check when a user submits a form that will compare the new post to old once to avoid double (or more) postings of the same content.
I thought of something like
if(strtolower($string1) == strtolower($string2))
{
//do this
}
but not sure how that would work for checking an entire website full of posts with unique id's
Any help is much appreciated!
Upvotes: 2
Views: 101
Reputation: 68536
You could use the similar_text
in PHP..
<?php
$post1 = 'test1';
$post2 = 'test2';
similar_text($post1, $post2, $percent);
if(round($percent)>90)
{
echo "The two posts are 90% similar.. sorry try again. No spamming !";
}
Upvotes: 1