session_start();
$nombreEncuesta="Moveact11";
foreach($_GET as $variable => $valorVariable){
$clave=$variable;
}
?>
Obets. University of Alicante - Terms of use
// para que escriba la página antes de procesar el log y el mensaje
ob_flush();
flush();
// CUESTIONARIO MULTIIDIOMA
switch ($clave) {
case "en":
$idiomapreguntas="en";
break;
case "pl":
$idiomapreguntas="pl";
break;
case "ro":
$idiomapreguntas="ro";
break;
case "de":
$idiomapreguntas="de";
break;
default:
$idiomapreguntas="en";
}
$textos=$_SESSION['textos'];
// cargar los textos de la db la primera vez
if ($textos["textosIdioma"] !== $idiomapreguntas ) {
$db="encuestas";
$dbhost="localhost";
$dbusuario="root";
$dbpassword="NECH";
$dbtabla=$nombreEncuesta."_preguntas_".$idiomapreguntas;
$conexion = mysql_connect($dbhost, $dbusuario, $dbpassword);
mysql_query("SET NAMES 'utf8'");
mysql_select_db($db, $conexion);
$zsql="select * from $dbtabla ORDER BY id";
$zresultado = mysql_query($zsql);
if (!$zresultado)
{
echo "BIG PROBLEM WITH THE DATABASE!";
} else {
while ($textoleido = mysql_fetch_array($zresultado))
{
//$textos[$textoleido[pregunta]]=htmlentities($textoleido[texto]);
$textos[$textoleido[pregunta]]=$textoleido[texto];
}
mysql_close ($conexion);
$textos["textosIdioma"]=$idiomapreguntas;
}
$_SESSION['textos']=$textos;
}
// FIN CUESTIONARIO MULTIIDIOMA
// CONTADOR
if ($clave=="en" OR $clave=="de" OR $clave=="pl" OR $clave=="ro")
{
$archivo_contador = "/var/www/html/moveact/survey/contador.txt";
} else {
$archivo_contador = "/var/www/html/moveact/survey/contador_noaut.txt";
}
// Abrimos el archivo_contador para solamente leerlo
$abre = fopen($archivo_contador, "r");
// Leemos el contenido del archivo_contador
$total = fread($abre, filesize($archivo_contador));
// Cerramos la conexiÛn al archivo_contador
fclose($abre);
if (basename($PHP_SELF)=="index.php")
{
// Abrimos nuevamente el archivo_contador
$abre = fopen($archivo_contador, "w");
// Sumamos 1 nueva visita
$total = $total + 1;
// Y reemplazamos por la nueva cantidad de visitas
$grabar = fwrite($abre, $total);
// Cerramos la conexiÛn al archivo_contador
fclose($abre);
}
// FIN CONTADOR
// e-mail
/*
$to = "oscar.santacreu@ua.es";
$subject = "[MOVEACT] Survey control - ".$clave."";
$remitente = "Webmaster";
$EmailRemitente = "obets@ua.es";
$mensaje = "Someone entered in the survey webpage with keyword: ".$clave."\n\n";
$message = "$mensaje\n\n============\nMessage from MOVEACT (www.moveact.eu)\ne-mail: info@moveact.eu\n";
$headers = "From: $remitente <$EmailRemitente>\nReply-To: $EmailRemitente\n";
// EnvÌo del mensaje
mail($to, $subject, $message, $headers);
*/
// fin e-mail
?>