mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 00:42:15 +00:00
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
// Holt den Hexcode eines Bildes aus der DB wandelt es in Zeichen
|
||||
// um und gibt das ein Bild zurueck.
|
||||
// Aufruf mit <img src='bild.php?src=frage&frage_id=1
|
||||
require_once('../../config.inc.php');
|
||||
|
||||
//Hexcode in String umwandeln
|
||||
function hexstr($hex)
|
||||
{
|
||||
$string="";
|
||||
for ($i=0;$i<strlen($hex)-1;$i+=2)
|
||||
$string.=chr(hexdec($hex[$i].$hex[$i+1]));
|
||||
return $string;
|
||||
}
|
||||
|
||||
//Connection Herstellen
|
||||
if(!$conn = pg_pconnect(CONN_STRING))
|
||||
die('Fehler beim oeffnen der Datenbankverbindung');
|
||||
|
||||
//Hex Dump aus der DB holen
|
||||
$qry = '';
|
||||
if(isset($_GET['src']) && $_GET['src']=='frage' && isset($_GET['frage_id']))
|
||||
{
|
||||
$qry = "SELECT bild FROM testtool.tbl_frage WHERE frage_id='".addslashes($_GET['frage_id'])."'";
|
||||
}
|
||||
elseif(isset($_GET['src']) && $_GET['src']=='vorschlag' && isset($_GET['vorschlag_id']))
|
||||
{
|
||||
$qry = "SELECT bild FROM testtool.tbl_vorschlag WHERE vorschlag_id='".addslashes($_GET['vorschlag_id'])."'";
|
||||
}
|
||||
else
|
||||
echo 'Unkown type';
|
||||
|
||||
if($qry!='')
|
||||
{
|
||||
//Header fuer Bild schicken
|
||||
header("Content-type: image/gif");
|
||||
$result = pg_query($conn, $qry);
|
||||
$row = pg_fetch_object($result);
|
||||
//HEX Werte in Zeichen umwandeln und ausgeben
|
||||
echo hexstr($row->bild);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ if($frage->frage_id!='')
|
||||
//Wenn ein Bild vorhanden ist, dann anzeigen
|
||||
if($frage->bild!='')
|
||||
{
|
||||
echo "\n<tr><td width=400 height=300><img src='bild.php?src=frage&frage_id=$frage->frage_id' width=400 height=300></td>";
|
||||
echo "\n<tr><td width=400 height=300><img src='../bild.php?src=frage&frage_id=$frage->frage_id' width=400 height=300></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -324,7 +324,7 @@ if($frage->frage_id!='')
|
||||
$vorschlag->bild = '';
|
||||
}
|
||||
//Vorschlag
|
||||
echo '<b>Vorschlag</b><br><br>';
|
||||
echo '<b>Vorschlag'.($vorschlag_id!=''?' Edit':'').'</b><br><br>';
|
||||
echo "<form method=POST ENCTYPE='multipart/form-data' action='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id'>";
|
||||
echo "<input type='hidden' name='vorschlag_id' value='$vorschlag->vorschlag_id'>";
|
||||
echo '<table>';
|
||||
@@ -338,7 +338,7 @@ if($frage->frage_id!='')
|
||||
echo "<td>Bild:</td><td><input type='file' name='bild'></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr><td>Nummer:</td><td><input type='text' name='nummer' size=3 value='$vorschlag->nummer'></td></tr>";
|
||||
echo "<tr><td colspan='2' align='right'><input type='submit' name='submitvorschlag' value=Speichern ></td></tr>";
|
||||
echo "<tr><td colspan='2' align='right'><input type='submit' name='submitvorschlag' value='Speichern'>".($vorschlag_id!=''?"<input type='button' value='Abbrechen' onclick=\"document.location.href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id'\">":'')."</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
@@ -354,7 +354,7 @@ if($frage->frage_id!='')
|
||||
foreach ($vorschlag->result as $vs)
|
||||
{
|
||||
$i++;
|
||||
echo "<tr class='liste".($i%2)."'><td>$vs->nummer</td><td>$vs->antwort</td><td>$vs->text</td><td><img src='bild.php?src=vorschlag&vorschlag_id=$vs->vorschlag_id'></td><td><a href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id&vorschlag_id=$vs->vorschlag_id'>edit</a></td><td><a href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id&vorschlag_id=$vs->vorschlag_id&type=delete' onclick=\"return confirm('Wollen Sie diesen Eintrag wirklich loeschen?')\">delete</a></td></tr>";
|
||||
echo "<tr class='liste".($i%2)."'><td>$vs->nummer</td><td>$vs->antwort</td><td>$vs->text</td><td><img src='../bild.php?src=vorschlag&vorschlag_id=$vs->vorschlag_id'></td><td><a href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id&vorschlag_id=$vs->vorschlag_id'>edit</a></td><td><a href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&gruppe_id=$gruppe_id&frage_id=$frage->frage_id&vorschlag_id=$vs->vorschlag_id&type=delete' onclick=\"return confirm('Wollen Sie diesen Eintrag wirklich loeschen?')\">delete</a></td></tr>";
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user