backend:
php version: 4.3.10-16Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www/contenido/includes/include.tplcfg_edit_form.php(423) : eval()'d code on line 25
hier der input:
Code: Alles auswählen
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Umfrage
* Author : Alexander Höhn
* Copyright : art & weise medienproduktion
info@auw-media.de
* Created : 16-09-2002
* Modified : 04-07-2003
************************************************/
echo " <table>";
$db = new DB_Contenido;
switch($button1){
//-------------------------- Speichern der Daten in die Tabelle ------------------------------
case "Speichern" : {
if("CMS_VALUE[3]" =="") $eintrag3 = " "; else $eintrag3 = "CMS_VALUE[3]";
if("CMS_VALUE[4]" =="") $eintrag4 = " "; else $eintrag4 = "CMS_VALUE[4]";
if($CMS_VAR[5] =="") $eintrag5 = " "; else $eintrag5 = $CMS_VAR[5];
if($CMS_VAR[6] =="") $eintrag6 = " "; else $eintrag6 = $CMS_VAR[6];
$sql = 'INSERT INTO `umfragen` (`umfragenid`, `Frage`, `zaehlung1`, `zaehlung2`, `zaehlung3`, `zaehlung4`, `zaehlung5`, `zaehlung6`, `ergebnis1`, `ergebnis2`, `ergebnis3`, `ergebnis4`, `ergebnis5`, `ergebnis6`) VALUES (\'\', \'CMS_VALUE[0]\', \'CMS_VALUE[1]\', \'CMS_VALUE[2]\', \''.$eintrag3.'\', \''.$eintrag4.'\', \''.$eintrag5.'\', \''.$eintrag6.'\', \'0\', \'0\', \'0\', \'0\', \'0\', \'0\');'; \');';
$db->query($sql);
break;
}
case "Auswählen" : {
//--------------------------- Auswählen der gewünschten Frege --------------------------------
$db->query('SELECT * FROM umfragen WHERE `Frage` = \''.$CMS_VAR[7].'\'');
$db->next_record();
$frage = $db->f("Frage");
$edit1 = $db->f("zaehlung1");
$edit2 = $db->f("zaehlung2");
$edit3 = $db->f("zaehlung3");
$edit4 = $db->f("zaehlung4");
$edit5 = $db->f("zaehlung5");
$edit6 = $db->f("zaehlung6");
break;
}
}
echo "<tr>
<td> </td>
<td></td>
</tr>";
echo " <tr>
<td>Frage :</td>
<td><input type=\"text\" name=\"CMS_VAR[0]\" value=\"";
if($frage=="") echo "CMS_VALUE[0]"; else echo $frage;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 1 :</td>
<td><input type=\"text\" name=\"CMS_VAR[1]\" value=\"";
if($edit1=="") echo "CMS_VALUE[1]" ; else echo $edit1;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 2 :</td>
<td><input type=\"text\" name=\"CMS_VAR[2]\" value=\"";
if($edit2=="") echo "CMS_VALUE[2]" ; else echo $edit2;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 3 :</td>
<td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"";
if($edit3=="") echo "CMS_VALUE[3]" ; else echo $edit3;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 4 :</td>
<td><input type=\"text\" name=\"CMS_VAR[4]\" value=\"";
if($edit4=="") echo "CMS_VALUE[4]" ; else echo $edit4;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 5 :</td>
<td><input type=\"text\" name=\"CMS_VAR[5]\" value=\"";
if($edit5=="") echo "CMS_VALUE[5]" ; else echo $edit5;
echo "\"></td>
</tr>
<tr>
<td>Möglichkeit 6 :</td>
<td><input type=\"text\" name=\"CMS_VAR[6]\" value=\"";
if($edit6=="") echo "CMS_VALUE[6]" ; else echo $edit6;
echo "\"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type=\"submit\" name=\"button1\" value=\"Speichern\"></td>
</tr>
<tr>
<td colspan=\"2\"><center>";
//---------------------- darstellung in einer drop-down Liste --------------------------------
$db = new DB_Contenido;
if($db->query("SELECT * FROM umfragen")){
for($i=1;$i<=$db->num_rows();$i++){
$db->next_record();
$tab = "tab".$i;
$$tab = $db->f("Frage");
}
}else{
$sql = 'CREATE TABLE `umfragen` ( `umfragenid` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `Frage` TEXT NOT NULL, `zaehlung1` TEXT NOT NULL, `zaehlung2` TEXT NOT NULL, `zaehlung3` TEXT NOT NULL, `zaehlung4` TEXT NOT NULL, `zaehlung5` TEXT NOT NULL, `zaehlung6` TEXT NOT NULL, `ergebnis1` INT(15) NOT NULL, `ergebnis2` INT(15) NOT NULL, `ergebnis3` INT(15) NOT NULL, `ergebnis4` INT(15) NOT NULL, `ergebnis5` INT(15) NOT NULL, `ergebnis6` INT(15) NOT NULL );';
$db->query($sql);
}
echo "<select name=\"CMS_VAR[7]\" size=\"1\">";
if($CMS_VAR[7]!="")echo "<option value=\"$CMS_VAR[7]\">".$CMS_VAR[7]."</option>";
for($i=1;$i<=$db->num_rows();$i++){
$tab = "tab".$i;
if(!isset($CMS_VAR[7]))echo "<option value=\"".$$tab."\">".$$tab."</option>";
if(isset($CMS_VAR[7])) if($$tab!=$CMS_VAR[7])echo "<option value=\"".$$tab."\">".$$tab."</option>";
}
echo "</select>" ;
echo " <input type=\"submit\" name=\"button1\" value=\"Auswählen\"></td>
</tr>";
echo "</table>";
und output:
Code: Alles auswählen
<?php
echo "<form action=\"".$auth->url()."\" method=\"post\" >";
if($button1!="Weiter"){
//---------------------------- Umfrage aus der DB auslesen -----------------------------------
$db = new DB_Contenido;
$db->query('SELECT * FROM umfragen WHERE `Frage` = \'CMS_VALUE[0]\'');
$db->next_record();
$frage = $db->f("Frage");
$antwort1 = $db->f("zaehlung1");
$antwort2 = $db->f("zaehlung2");
$antwort3 = $db->f("zaehlung3");
$antwort4 = $db->f("zaehlung4");
$antwort5 = $db->f("zaehlung5");
$antwort6 = $db->f("zaehlung6");
//--------------- Fragen und Antwortmöglichkeiten darstellen ---------------------------------
echo "<tr><td></td><td height=\"15\" colspan=\"2\" >$frage</td>
</tr>
<tr>
<td width=\"25\"></td><td><input value=\"1\" type=\"radio\" name=\"Radio1\"> ".$antwort1."</td>
</tr>
<tr>
<td width=\"25\" ></td><td><input value=\"2\" type=\"radio\" name=\"Radio1\"> ".$antwort2."</td>
</tr>";
//sollte ein Feld nicht belegt worden sein wird es weggelassen, für Umfragen mit weniger als 6 Antwortmöglichkeiten
if($antwort3 !=" ")
echo "<tr>
<td width=\"25\" ></td><td><input value=\"3\" type=\"radio\" name=\"Radio1\"> ".$antwort3."</td>
</tr>";
if($antwort4!=" ")
echo "<tr>
<td width=\"25\" ></td><td><input value=\"4\" type=\"radio\" name=\"Radio1\"> ".$antwort4."</td>
</tr>";
if($antwort5!=" ")
echo "<tr>
<td width=\"25\" ></td><td><input value=\"5\" type=\"radio\" name=\"Radio1\"> ".$antwort5."</td>
</tr>";
if($antwort6!=" ")
echo "<tr>
<td width=\"25\" ></td><td><input value=\"6\" type=\"radio\" name=\"Radio1\"> ".$antwort6."</td>
</tr>";
echo "<tr>
<td> </td><td> </td>
</tr>
<tr>
<td colspan =\"2\"><center><input type=\"submit\" name=\"button1\" value=\"Weiter\"><br>
</tr>";
}else{
//----------------------------- Datenbank auswertung ----------------------------------------
$db = new DB_Contenido;
$db->query('SELECT * FROM umfragen WHERE `Frage` = \'CMS_VALUE[0]\'');
$db->next_record();
$frage = $db->f("Frage");
$ergeb1 = $db->f("ergebnis1");
$ergeb2 = $db->f("ergebnis2");
$ergeb3 = $db->f("ergebnis3");
$ergeb4 = $db->f("ergebnis4");
$ergeb5 = $db->f("ergebnis5");
$ergeb6 = $db->f("ergebnis6");
switch($Radio1){
case 1 : {
$ergeb1++;
break;
}
case 2 : {
$ergeb2++;
break;
}
case 3 : {
$ergeb3++;
break;
}
case 4 : {
$ergeb4++;
break;
}
case 5 : {
$ergeb5++;
break;
}
case 6 : {
$ergeb6++;
break;
}
}
//--------------------------- Darstellung im Balkendiagramm ----------------------------------
$gesamt = $ergeb1+$ergeb2+$ergeb3+$ergeb4+$ergeb5+$ergeb6;
echo "<h3><center>CMS_VALUE[0]</center></h3><br>";
if($ergeb1!="0") $farbe1= "bgcolor=\"cornflowerblue\"";
echo "<b>CMS_VALUE[1] :";
echo "<table><tr><td ".$farbe1." width=\"";
echo (300*$ergeb1)/$gesamt;
$prozent = (100*$ergeb1)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
if($ergeb2!="0") $farbe2= "bgcolor=\"skyblue\"";
echo "<b>CMS_VALUE[2] :";
echo "<table><tr><td ".$farbe2." width=\"";
echo (300*$ergeb2)/$gesamt;
$prozent = (100*$ergeb2)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
if("CMS_VALUE[3]"!=" "){
if($ergeb3!="0") $farbe3= "bgcolor=\"lightskyblue\"";
echo "<b>CMS_VALUE[3] :";
echo "<table><tr><td ".$farbe3." width=\"";
echo (300*$ergeb3)/$gesamt;
$prozent = (100*$ergeb3)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
}
if("CMS_VALUE[4]"!=" "){
if($ergeb4!="0") $farbe4= "bgcolor=\"lightblue\"";
echo "<b>CMS_VALUE[4] :";
echo "<table><tr><td ".$farbe4." width=\"";
echo (300*$ergeb4)/$gesamt;
$prozent = (100*$ergeb4)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
}
if("CMS_VALUE[5]"!=" "){
if($ergeb5!="0") $farbe5= "bgcolor=\"lightsteelblue\"";
echo "<b>CMS_VALUE[5] :";
echo "<table><tr><td ".$farbe5." width=\"";
echo (300*$ergeb5)/$gesamt;
$prozent = (100*$ergeb5)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
}
if("CMS_VALUE[6]"!=" "){
if($ergeb6!="0") $farbe6= "bgcolor=\"darkgray\"";
echo "<b>CMS_VALUE[6] :";
echo "<table><tr><td ".$farbe6." width=\"";
echo (300*$ergeb6)/$gesamt;
$prozent = (100*$ergeb6)/$gesamt;
echo "\"> </td><td>".round($prozent, 2)." % </td></tr>";
echo "</table><br>";
}
//------------------------- Speichern der neuen Ergebnisse in der DB -------------------------
$sql = 'SELECT `umfragenid` FROM `umfragen` WHERE 1 AND `Frage` = \'CMS_VALUE[0]\' LIMIT 0, 30';
$db->query($sql);
$ID = $db->f("umfragenid");
$sql = 'REPLACE INTO `umfragen` (`umfragenid`, `Frage`, `zaehlung1`, `zaehlung2`, `zaehlung3`, `zaehlung4`, `zaehlung5`, `zaehlung6`, `ergebnis1`, `ergebnis2`, `ergebnis3`, `ergebnis4`, `ergebnis5`, `ergebnis6`) VALUES (\''.$ID.'\', \'CMS_VALUE[0]\', \'CMS_VALUE[1]\', \'CMS_VALUE[2]\', \'CMS_VALUE[3]\', \'CMS_VALUE[4]\', \'CMS_VALUE[5]\', \'CMS_VALUE[6]\', \''.$ergeb1.'\', \''.$ergeb2.'\', \''.$ergeb3.'\', \''.$ergeb4.'\', \''.$ergeb5.'\', \''.$ergeb6.'\');';
$db->query($sql);
}
echo "</td></tr></table>";
?>