29 lines
		
	
	
		
			882 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			882 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?PHP include("config.php");
 | 
						|
 | 
						|
if (!$_POST) {
 | 
						|
    Header("Location: index.php"); 
 | 
						|
    die();
 | 
						|
}
 | 
						|
 | 
						|
/**foreach($_POST as $key => $data) {
 | 
						|
	echo ($key.": ".$data ."<br />\n");
 | 
						|
}**/
 | 
						|
 | 
						|
$answerSet = "(0";
 | 
						|
foreach($_POST as $questionID => $answerID) {
 | 
						|
	if (is_numeric(ltrim($questionID,'qid'))) $answerSet .= ",".$answerID;
 | 
						|
}
 | 
						|
$answerSet .= ")";
 | 
						|
 | 
						|
//echo $answerSet;
 | 
						|
 | 
						|
$result = mysql_query("UPDATE gforum_SurveyAnswer SET Answer_Votes = Answer_Votes + 1 WHERE Answer_ID IN ".$answerSet) OR die(mysql_error());
 | 
						|
 | 
						|
$result = mysql_query("INSERT INTO gforum_SurveyVote (Survey_ID_FK, User_ID_FK, Vote_IP, Vote_Time) VALUES (1, ".$_POST['uid'].", '".$_POST['ip']."', UNIX_TIMESTAMP(NOW()) )") OR die(mysql_error());
 | 
						|
 | 
						|
$result = mysql_query("INSERT INTO gforum_SurveyRecord (Survey_ID_FK, Record_Set) VALUES (1, '".$answerSet."')") OR die(mysql_error());
 | 
						|
 | 
						|
Header("Location: index.php?thank_you=1");
 | 
						|
 | 
						|
?>
 |