Advertisement
Ralph_von

Untitled

Mar 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.67 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['key'])){
  4.   die("Das Quiz können sie erst bearbeiten, wenn sie ihre Daten eingegeben haben.");
  5. }
  6. ?>
  7. <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
  8.   <input type="submit" name="refresh" value="Wiederherstellen">
  9.   <input type="submit" name="admin" value="Admin-Login">
  10. <h3>Hören sie sich die 4 Lieder an und geben sie ihre Stimme dazu ab. Wenn sie sich überhaupt nicht sicher sind dann wählen sie bitte unsicher.
  11. </h3>
  12. <h4>Das erste Lied</h4>
  13. <audio id="audio_with_controls"
  14. controls
  15. src="misc/music/m1.mp3"
  16. type="audio/mp3"
  17. >
  18. </audio>
  19. <br>
  20. <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
  21.   <input type="hidden" name="high1" value="0">
  22.   <input type="radio" value="1" name="high1"> Highland cathedral&nbsp
  23.   <input type="hidden" name="ag1" value="0">
  24.   <input type="radio" value="1" name="ag1"> Amazing Grace&nbsp
  25.   <input type="hidden" name="tg1" value="0">
  26.   <input type="radio" value="1" name="tg1"> The Gael&nbsp
  27.   <input type="hidden" name="ca1" value="0">
  28.   <input type="radio" value="1" name="ca1"> Canon&nbsp
  29.   <input type="hidden" name="trp1" value="0">
  30.   <input type="radio" value="1" name="trp1"> The Rebel Piper&nbsp
  31.   <input type="hidden" name="un1" value="0">
  32.   <input type="radio" value="1" name="un1">Unsicher
  33. <br>
  34. <h4> Das zweite Lied </h4>
  35. <audio id="m2.mp3"
  36. controls
  37. src="misc/music/m2.mp3"
  38. type="audio/mp3"
  39. >
  40. </audio>
  41. <br>
  42. <input type="hidden" name="high2" value="0">
  43. <input type="radio" value="1" name="high2"> Highland cathedral&nbsp
  44. <input type="hidden" name="ag2" value="0">
  45. <input type="radio" value="1" name="ag2"> Amazing Grace&nbsp
  46. <input type="hidden" name="tg2" value="0">
  47. <input type="radio" value="1" name="tg2"> The Gael&nbsp
  48. <input type="hidden" name="ca2" value="0">
  49. <input type="radio" value="1" name="ca2"> Canon&nbsp
  50. <input type="hidden" name="trp2" value="0">
  51. <input type="radio" value="1" name="trp2"> The Rebel Piper&nbsp
  52. <input type="hidden" name="un2" value="0">
  53. <input type="radio" value="1" name="un2">Unsicher
  54. <br>
  55. <h4> Das dritte Lied </h4>
  56. <audio id="m3.mp3"
  57. controls
  58. src="misc/music/m3.mp3"
  59. type="audio/mp3"
  60. >
  61. </audio>
  62. <br>
  63. <input type="hidden" name="high3" value="0">
  64. <input type="radio" value="1" name="high3"> Highland cathedral&nbsp
  65. <input type="hidden" name="ag3" value="0">
  66. <input type="radio" value="1" name="ag3"> Amazing Grace&nbsp
  67. <input type="hidden" name="tg3" value="0">
  68. <input type="radio" value="1" name="tg3"> The Gael&nbsp
  69. <input type="hidden" name="ca3" value="0">
  70. <input type="radio" value="1" name="ca3"> Canon&nbsp
  71. <input type="hidden" name="trp3" value="0">
  72. <input type="radio" value="1" name="trp3"> The Rebel Piper&nbsp
  73. <input type="hidden" name="un3" value="0">
  74. <input type="radio" value="1" name="un3">Unsicher
  75. <br>
  76. <h4> Das vierte Lied </h4>
  77. <audio id="m4.mp3"
  78. controls
  79. src="misc/music/m4.mp3"
  80. type="audio/mp3"
  81. >
  82. </audio>
  83. <br>
  84. <input type="hidden" name="high4" value="0">
  85. <input type="radio" value="highland" name="high4"> Highland cathedral&nbsp
  86. <input type="hidden" name="ag4" value="0">
  87. <input type="radio" value="amazing" name="ag4"> Amazing Grace&nbsp
  88. <input type="hidden" name="tg4" value="0">
  89. <input type="radio" value="thegael" name="tg4"> The Gael&nbsp
  90. <input type="hidden" name="ca4" value="0">
  91. <input type="radio" value="canon" name="ca4"> The Canon&nbsp
  92. <input type="hidden" name="trp4" value="0">
  93. <input type="radio" value="rebel" name="trp4"> The Rebel Piper&nbsp
  94. <input type="hidden" name="un4" value="0">
  95. <input type="radio" value="unsure" name="un4">Unsicher<br>
  96. <input type="submit" name="confirm" value="Bestätigen">
  97. </form>
  98. <?php
  99. if (isset($_POST["confirm"])){
  100.   $high1=$_POST["high1"];
  101.   $ag1=$_POST["ag1"];
  102.   $tg1=$_POST["tg1"];
  103.   $ca1=$_POST["ca1"];
  104.   $trp1=$_POST["trp1"];
  105.   $un1=$_POST["un1"];
  106.   $high2=$_POST["high2"];
  107.   $ag2=$_POST["ag2"];
  108.   $tg2=$_POST["tg2"];
  109.   $ca2=$_POST["ca2"];
  110.   $trp2=$_POST["trp2"];
  111.   $un2=$_POST["un2"];
  112.   $high3=$_POST["high3"];
  113.   $ag3=$_POST["ag3"];
  114.   $tg3=$_POST["tg3"];
  115.   $ca3=$_POST["ca3"];
  116.   $trp3=$_POST["trp3"];
  117.   $un3=$_POST["un3"];
  118.   $high4=$_POST["high4"];
  119.   $ag4=$_POST["ag4"];
  120.   $tg4=$_POST["tg4"];
  121.   $ca4=$_POST["ca4"];
  122.   $trp4=$_POST["trp4"];
  123.   $un4=$_POST["un4"];
  124.   if (mysql_connect('localhost','root',''))
  125. echo ("");
  126. else {
  127.   die("Konnte keine Verbindung aufbauen:"
  128.   .mysql_error());
  129. }
  130. if(mysql_select_db('umfrage'))
  131. echo ("");
  132. else {
  133.   die("Keine Datenbank vorhanden".mysql_error());
  134. }
  135. $m1=mysql_query("SELECT * FROM m1");
  136. if($m1){
  137.   while($kntk=mysql_fetch_object($m1)){
  138.     $h1 = $kntk -> high;
  139.     $a1 = $kntk -> ag;
  140.     $t1 = $kntk -> tg;
  141.     $c1 = $kntk -> ca;
  142.     $tr1 = $kntk -> trp;
  143.     $u1 = $kntk -> un;
  144.     }
  145.   }
  146. $h1=$h1+$high1;
  147. $a1=$a1+$ag1;
  148. $t1=$t1+$tg1;
  149. $c1=$c1+$ca1;
  150. $tr1=$tr1+$trp1;
  151. $u1=$u1+$un1;
  152. $daten= "UPDATE m1 SET high='$h1', ag='$a1', tg='$t1', ca='$c1', trp='$tr1', un='$u1';";
  153. if (mysql_query($daten))
  154. echo (" Datensätze erfolgreich angelegt.");
  155. else {
  156.   die ("FEHLER!".mysql_error());
  157. }
  158. // DONE M1!
  159. $m2=mysql_query("SELECT * FROM m2");
  160. if($m2){
  161.   while($kntk=mysql_fetch_object($m2)){
  162.     $h2 = $kntk -> high;
  163.     $a2 = $kntk -> ag;
  164.     $t2 = $kntk -> tg;
  165.     $c2 = $kntk -> ca;
  166.     $tr2 = $kntk -> trp;
  167.     $u2 = $kntk -> un;
  168.     }
  169.   }
  170. $h2=$h2+$high2;
  171. $a2=$a2+$ag2;
  172. $t2=$t2+$tg2;
  173. $c2=$c2+$ca2;
  174. $tr2=$tr2+$trp2;
  175. $u2=$u2+$un2;
  176. $daten= "UPDATE m2 SET high='$h2', ag='$a2', tg='$t2', ca='$c2', trp='$tr2', un='$u2';";
  177. if (mysql_query($daten))
  178. echo (" Datensätze erfolgreich angelegt.");
  179. else {
  180.   die ("FEHLER!".mysql_error());
  181. }
  182. // DONE M2!
  183. $m3=mysql_query("SELECT * FROM m3");
  184. if($m3){
  185.   while($kntk=mysql_fetch_object($m3)){
  186.     $h3 = $kntk -> high;
  187.     $a3 = $kntk -> ag;
  188.     $t3 = $kntk -> tg;
  189.     $c3 = $kntk -> ca;
  190.     $tr3 = $kntk -> trp;
  191.     $u3 = $kntk -> un;
  192.     }
  193.   }
  194. $h3=$h3+$high3;
  195. $a3=$a3+$ag3;
  196. $t3=$t3+$tg3;
  197. $c3=$c3+$ca3;
  198. $tr3=$tr3+$trp3;
  199. $u3=$u3+$un3;
  200. $daten= "UPDATE m3 SET high='$h3', ag='$a3', tg='$t3', ca='$c3', trp='$tr3', un='$u3';";
  201. if (mysql_query($daten))
  202. echo (" Datensätze erfolgreich angelegt.");
  203. else {
  204.   die ("FEHLER!".mysql_error());
  205. }
  206. $m4=mysql_query("SELECT * FROM m4");
  207. if($m4){
  208.   while($kntk=mysql_fetch_object($m4)){
  209.     $h4 = $kntk -> high;
  210.     $a4 = $kntk -> ag;
  211.     $t4 = $kntk -> tg;
  212.     $c4 = $kntk -> ca;
  213.     $tr4 = $kntk -> trp;
  214.     $u4 = $kntk -> un;
  215.     }
  216.   }
  217. $h4=$h4+$high4;
  218. $a4=$a4+$ag4;
  219. $t4=$t4+$tg4;
  220. $c4=$c4+$ca4;
  221. $tr4=$tr4+$trp4;
  222. $u4=$u4+$un4;
  223. $daten= "UPDATE m4 SET high='$h4', ag='$a4', tg='$t4', ca='$c4', trp='$tr4', un='$u4';";
  224. if (mysql_query($daten))
  225. echo (" Datensätze erfolgreich angelegt.");
  226. else {
  227.   die ("FEHLER!".mysql_error());
  228. }
  229. header ("Location: test2.php?seskey=$key");
  230. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement