login}'");
/* ------------------------- */ ?>
Vraag van de Week |
# Filename : index5.php # Author : Mitch Vroege # Projectname : SMART PoLL # Projectversion : 0.7.1 # Releasedate : 16-08-2004 # Include database classfile include("database.php"); # Include poll classfile include("poll.php"); # Run database class $db = new database; # Set query to see if voted already $ip = $_SERVER['REMOTE_ADDR']; $sql = "SELECT * FROM `votes` WHERE `vote_ip` = '" . $ip . "'"; # Run poll class $poll = new poll; # If a match is found show results only if($db->num_rows($sql) == 1) { # Show results echo $poll->showResults(); } else { # Check if form submitted if(!$_POST['vote']) { # Show form echo $poll->showOptions(); } else { # Add data to database # Check for a value if(!$_POST['poll']) { # No option selected # Show poll again echo $poll->showOptions(); } else { # A radio is checked # Update votes $poll->updateVotes($_POST['poll']); # Show results echo $poll->showResults(); } } } ?> |