Current File : /pages/54/47/d0016649/home/private/Datensicherungen/Unterlagen/Software/pc/servicecenter/votes.php
<?php
// This script count votes.
// Input data: 
//		IDInquire (declares the inquire - that way, we can use the same log for all inquires)
//		IDUser (declares the user who answers the inquire)
//		IDAnswer (declares the answer, the user has chosen)
// GET or POST

//session_start();
// User must be logged in
//if (!session_is_registered("user_logged")) die('Please, log in...');


$SUFFIX='php';
if (file_exists('includes/mail2date.cfg.php')) $SUFFIX='php';
elseif (file_exists('includes/mail2date.cfg.php3')) $SUFFIX='php3';
elseif (file_exists('includes/mail2date.cfg.php4')) $SUFFIX='php4';
elseif (file_exists('includes/mail2date.cfg.php5')) $SUFFIX='php5';
include_once 'includes/mail2date.cfg.'.$SUFFIX;

//$VOTES_LOG_FILENAME = 'logs/votes.txt';
//$MAX_VOTES_FILESIZE = 100000;

$IDInquire = (isset($_POST['IDInquire']))?$_POST['IDInquire']:$_GET['IDInquire'];
$IDUser = (isset($_POST['IDUser']))?$_POST['IDUser']:$_GET['IDUser'];
$IDAnswer = (isset($_POST['IDAnswer']))?$_POST['IDAnswer']:$_GET['IDAnswer'];
// Exit if one of the parameter empty
if($IDInquire=='' or $IDUser=='' or $IDAnswer=='') exit;

// TODO Check file size, if more then MAX_VOTES_FILESIZE then stop appending.

$fp = fopen($VOTES_LOG_FILENAME, "a");
if($fp) {
	fwrite($fp, join(';',array($IDInquire, $IDUser, $IDAnswer))."\n");
	fclose($fp);
}

include 'templates/thanks_survey.tmpl.php';

?>