A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

a - mcpaste

a

Von h, 9 Jahre vorher, geschrieben in Plain Text, aufgerufen 2'790 mal.
URL https://mcpaste.de/view/d716021e Einbetten
Paste herunterladen oder Rohtext anzeigen
  1. <?php   // UTF-8 marker äöüÄÖÜ߀
  2. require_once './Page.php';
  3.  
  4. class index extends Page
  5. {      
  6.         private $defaultwahl;
  7.         private $anzahl;
  8.         protected function __construct() {
  9.                 parent::__construct();
  10.                
  11.                 // to do: instantiate members representing substructures/blocks
  12.         }
  13.  
  14.         protected function __destruct() {
  15.                 parent::__destruct();
  16.         }
  17.  
  18.         protected function getViewData() {
  19.                 $defaultwahl = 1;
  20.                 $SQLabfrage1 = "SELECT * FROM bilder ORDER BY challange DESC  ";
  21.             $SQLabfrage2 = "SELECT * FROM bilder WHERE challange = '$defaultwahl'";
  22.             $Recordset = $this->database->query ($SQLabfrage1);
  23.             if (!$Recordset)
  24.                 throw new Exception("Keine Challanges gefunden");
  25.  
  26.                 if ($Recordset){
  27.                 // Benoetigte Eintraege für HTML-Ausgabe auslesen
  28.                 $Record = $Recordset->fetch_assoc();
  29.                         $anzahl = $Record ["challange"];
  30.                 }      
  31.                
  32.                 $Recordset = $this->database->query ($SQLabfrage2);
  33.                 if (!$Recordset)
  34.                 throw new Exception("Keine Challanges gefunden");
  35.        
  36.                 $bilder = array();
  37.                 $bild = array();
  38.             if ($Recordset){
  39.                 // Benoetigte Eintraege für HTML-Ausgabe auslesen
  40.                
  41.                 $Record = $Recordset->fetch_assoc();
  42.                 while ($Record) {
  43.                                
  44.                                 $bild["bild"] = $Record["src"];
  45.                                 $bild["votes"] = $Record["votes"];
  46.                                 $bild["id"] = $Record["id"];
  47.                                 $uploader = $Record["uploader"];
  48.                                 $bilder[$uploader] = $bild;
  49.                     $Record = $Recordset->fetch_assoc();
  50.                 }
  51.                 $Recordset->free();
  52.             }
  53.                 return $bilder;
  54.         }
  55.        
  56.         protected function generateView() {
  57.                 $bilder = $this->getViewData();
  58.  
  59.                 $this->generatePageHeader('Gimpfight');
  60. echo <<<EOT
  61.                 <h1>GIMPBATTLE</h1>
  62.                 <form>
  63.                 <div name = "sel"> <select name = "challangeauswahl" size ="5" >
  64. EOT;
  65.                 for($i = 1; $i <= $anzahl; $i++){
  66.                 echo "<option>$i</option>";
  67.                 }
  68.                
  69.                
  70. echo <<<EOT
  71.                 </select></div>
  72.                 </form>
  73. EOT;
  74.                 $test = array();
  75.                 $test["id"] = 0;
  76.                 $test["bild"] = "pic.bmp";
  77.                 $test["votes"] = 0;
  78.                
  79.                 $links = array();
  80.                 $rechts = array();
  81.                 $r = rand(0, 1);
  82.        
  83.                 if($r == 0){
  84.                         $links = $bilder["tobi"];
  85.                         $rechts = $bilder["benny"];
  86.                 }
  87.                 else{
  88.                         $links = $bilder["benny"];
  89.                         $rechts = $bilder["tobi"];
  90.                 }
  91. echo <<<EOT
  92.                 <form action = "index.php" method = "post">
  93.                 <div name= links style="float:left>
  94. EOT;
  95.                 $id = $links['id'];
  96.                 $pic = $links['bild'];
  97.                 $votes = $links['votes'];
  98. echo <<<EOT
  99.                         <input id="in" type= "hidden" value="$id">;
  100.                         <img src="$pic" alt="bildlinks" width =33% height = 33%/>
  101.                         <label for ="linkssub">$votes<label>
  102.                         <button type=submit id=linkssub>
  103.                 </div>
  104.                 </form>
  105. EOT;
  106.                 $id = $rechts['id'];
  107.                 $pic = $rechts['bild'];
  108.                 $votes = $rechts['votes'];
  109. echo <<<EOT
  110.                 <form action = "index.php" method = "post">
  111.                 <div name= rechts style="float:right">
  112.                         <input id="in" type= "hidden" value=$id>
  113.                         <img src="$pic" alt="bildrechts"/ width =33% height = 33%>
  114.                         <label for ="rechtssub">$votes<label>
  115.                         <button type=submit id="rechtssub">
  116.                 </div>
  117.                 </form>
  118. EOT;
  119.                 $this->generatePageFooter();
  120.         }
  121.  
  122.         protected function processReceivedData() {
  123.                 parent::processReceivedData();
  124.                 $this->defaultwahl = 0;
  125.                 $this->anzahl = 0;
  126.                
  127.                 // Aufruf prüfen:
  128.                 if (isset($_POST["in"]) && isset($_POST["in"])) {
  129.                         // Aufruf durch Formular
  130.                         $id = $_POST["in"];
  131.                         $SQLabfrage = "SELECT * FROM bilder WHERE id = '$id'";
  132.                         $Recordset = $this->database->query ($SQLabfrage);
  133.                         $Record = $Recordset->fetch_assoc();
  134.                 $count = $Record["count"];
  135.                         $Recordset.free();
  136.                         $count = $count +1;
  137.  
  138.                
  139.                         $SQLabfrage = "INSERT INTO bilder SET count = '$count'";
  140.                         $this->database->query ($SQLabfrage);
  141.                 }
  142.         }
  143.  
  144.         public static function main() {
  145.                 try {
  146.                         $page = new index();
  147.                         $page->processReceivedData();
  148.                         $page->generateView();
  149.                 }
  150.                 catch (Exception $e) {
  151.                         header("Content-type: text/plain; charset=UTF-8");
  152.                         echo $e->getMessage();
  153.                 }
  154.         }
  155. }
  156.  
  157. index::main();
  158.  

Antwort auf "a"

Hier kannst Du auf den Paste von oben antworten

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876