Prevent successive comments from users PHP
<p>Hi I am wondering how to do the first if statement. The rest works as expected (although longwinded) not sure how to optimise that, but that's for another time. What I need is to give an error message if a user attempts to post twice in succession.</p>

<p>Thank you</p>

<pre><code>function saveCommentToDatabase($stack, $name, $comment)
    {   
        if($name == previousauthor){
            return 'Can\'t post twice';
        }
        else if(!$name){ 
            return 'You seem to have an existential problem. You do not exist.';
        }
        else if($name == 'Charles Dickens'){
            return 'You are NOT Charles Dickens.';
        }
        else if($name == 'Author'){
            return 'You should try being a little more imaginative with your name.'; 
        }
        else if($name == 'password1'){
           $name = 'User One'; 
        }   
        else if($name == 'password2'){
           $name = 'User Two'; 
        }   
        else if($name == 'password3'){
           $name = 'User Three'; 
        }
              else if($name == 'password4'){
           $name = 'User Four'; 
        }
</code></pre>
