What are some potential methods for restricting multiple votes from the same user in a PHP-based voting system?

To restrict multiple votes from the same user in a PHP-based voting system, you can implement a few methods such as using cookies, IP address tracking, or requiring users to log in before voting.

// Example using cookies to restrict multiple votes from the same user
if(!isset($_COOKIE['voted'])) {
    // Process the user's vote
    setcookie('voted', 'true', time() + (86400 * 30), "/"); // Cookie set to expire in 30 days
    // Update the database with the user's vote
} else {
    echo "You have already voted.";
}