Inital commit

This commit is contained in:
Tilman
2011-10-26 10:11:42 +02:00
commit c0da376199
888 changed files with 44367 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<?php
$access_restricted = false;
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/startup.php');
$pagetitle = 'Adressen';
$breadcrumb = 'Adressen';
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/pageheader.php');
?>
<?php
mysql_connect('localhost', 'dbu1022769', 'fuB0gar7') or die ('Database error: Unable to connect to database.');
mysql_select_db('db1022769-php') or die ('Database error: Unable to select database.');
if (isset($_GET['Vorname'])) {
$insert = mysql_query('INSERT INTO adressen (Vorname,Nachname,Anschrift,PLZ,Ort,Telefon,Tel_alt,Tel_Mobil,eMail,eMail_alt,Geburtstag,Gruppe,Bemerkung) VALUES ("'.$_GET['Vorname'].'","'.$_GET['Nachname'].'","'.$_GET['Anschrift'].'","'.$_GET['PLZ'].'","'.$_GET['Ort'].'","'.$_GET['Telefon'].'","'.$_GET['Tel_alt'].'","'.$_GET['Tel_Mobil'].'","'.$_GET['eMail'].'","'.$_GET['eMail_alt'].'","'.$_GET['Geburtstag'].'","'.$_GET['Gruppe'].'","'.$_GET['Bemerkung'].'")');
if (!$insert) {
echo '<p>Insert failed: '.mysql_error().'</p>';
}
}
if (isset($_GET['delete'])) {
$delete = mysql_query('DELETE FROM adressen WHERE id='.$_GET['delete']);
if (!$delete) {
echo '<p>Could not delete '.$_GET['delete'].': '.mysql_error().'</p>';
}
}
$orderby = 'id';
if (isset($_GET['orderby'])) {
$orderby = urldecode($_GET['orderby']);
}
$result = mysql_query('SELECT * FROM adressen ORDER BY "'.$orderby.'" ASC');
if (!$result) {
die('Database error: Unable to get table (order by: '.$orderby.')');
}
function getSortingLink($row, $title) {
return '<a href="'.$_SERVER['PHP_SELF'].'?orderby='.urlencode($row).'">'.$title.'</a>';
}
?>
<div style="font-family: Arial, sans-serif; margin-left: 1em;">
<table border="1" style="font-size: x-small; border-collapse: collapse;">
<tr>
<th><?php echo getSortingLink('id', 'ID'); ?></th>
<th><?php echo getSortingLink('Vorname', 'Vorname'); ?></th>
<th><?php echo getSortingLink('Nachname', 'Nachname'); ?></th>
<th><?php echo getSortingLink('Anschrift', 'Anschrift'); ?></th>
<th><?php echo getSortingLink('PLZ', 'PLZ'); ?></th>
<th><?php echo getSortingLink('Ort', 'Ort'); ?></th>
<th><?php echo getSortingLink('Telefon', 'Telefon'); ?></th>
<th><?php echo getSortingLink('Tel_alt', 'Tel. alt.'); ?></th>
<th><?php echo getSortingLink('Tel_Mobil', 'Mobil'); ?></th>
<th><?php echo getSortingLink('eMail', 'E-Mail'); ?></th>
<th><?php echo getSortingLink('eMail_alt', 'E-Mail alt.'); ?></th>
<th><?php echo getSortingLink('Geburtstag', 'Geburtstag'); ?></th>
<th><?php echo getSortingLink('Gruppe', 'Gruppe'); ?></th>
<th><?php echo getSortingLink('Bemerkung', 'Bemerkung'); ?></th>
<th></th>
<th></th>
</tr>
<?php
while ($row = mysql_fetch_array($result)) {
echo "\t\t<tr>";
echo "\t\t\t<td>\t\t\t\t".$row['id']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Vorname']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Nachname']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Anschrift']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['PLZ']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Ort']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Telefon']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Tel_alt']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Tel_Mobil']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['eMail']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['eMail_alt']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Geburtstag']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Gruppe']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t".$row['Bemerkung']."\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t<a href=\"".$_SERVER['PHP_SELF']."?edit=".$row['id']."\">edit</a>\t\t\t</td>";
echo "\t\t\t<td>\t\t\t\t<a href=\"".$_SERVER['PHP_SELF']."?delete=".$row['id']."\">del</a>\t\t\t</td>";
echo "\t\t</tr>";
}
?>
</table>
<div style="margin-top: 1em;">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
<table border="1" style="font-size: x-small; border-collapse: collapse;">
<tr>
<td>Vorname</td>
<td>Nachname</td>
<td>Anschrift</td>
<td>PLZ</td>
<td>Ort</td>
</tr>
<tr>
<td><input type="text" name="Vorname" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="Nachname" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="Anschrift" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="PLZ" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="Ort" size="12" style="font-size: x-small;" /></td>
</tr>
</table>
<table border="1" style="margin-top: 1ex; font-size: x-small; border-collapse: collapse;">
<tr>
<td>Tel. privat</td>
<td>Tel. geschäftlich</td>
<td>Tel. mobil</td>
<td>E-Mail privat</td>
<td>E-Mail geschäftlich</td>
</tr>
<tr>
<td><input type="text" name="Telefon" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="Tel_alt" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="Tel_Mobil" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="eMail" size="12" style="font-size: x-small;" /></td>
<td><input type="text" name="eMail_alt" size="12" style="font-size: x-small;" /></td>
</tr>
</table>
<table border="1" style="margin-top: 1ex; font-size: x-small; border-collapse: collapse;">
<tr>
<td>Geburtstag</td>
<td>Gruppe</td>
<td>Bemerkung</td>
</tr>
<tr>
<td><input type="text" name="Geburtstag" size="12" style="font-size: x-small;" /></td>
<td>
<select name="Gruppe" style="font-size: x-small;">
<option>Familie</option>
<option>Beethoven</option>
<option>Uni</option>
<option>Bekannte</option>
<option>Ärzte</option>
<option>Bettinas Familie</option>
<option>Bettinas Bekannte</option>
</select>
</td>
<td><input type="text" name="Bemerkung" size="44" style="font-size: x-small;" /></td>
</tr>
</table>
<input type="submit" value="Hinzufügen" style="font-size: x-small" />
</form>
</div>
</div>
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/pagefooter.php');
?>
@@ -0,0 +1,50 @@
<?php
/*
* getresource.php wird an Stelle geschützter Resourcen in eine Seite
* eingebunden. Die Ressourcen liegen dafür in einem geschützten Verzeichnis,
* das über den Webserver nicht erreichbar ist.
* getresource.php öffnet die geschützte Datei lokal und "reicht sie durch";
* auf diese Weise hat der PHP-Code die Kontrolle über die Herausgabe.
* Damit getresource.php nicht von außen mit GET-Parametern gefüttert werden
* kann, überprüft es bei jedem Aufruf, ob der Nutzer die Berechtigung zum
* Öffnen der Datei hat.
*
* $_GET['item'] enthält den absoluten Pfad zur Resource.
* Dieser wird mit security.itemURL() generiert.
*/
@session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/security.php');
if (isset($_GET['item'])) {
$item = $_GET['item'];
if (itemAccessible($item)) {
$fp = fopen($item, 'r');
// Content-type ermitteln
$imageInfo = getimagesize($item);
switch ($imageInfo[2]) {
case 1:
header('Content-type: image/gif');
break;
case 2:
header('Content-type: image/jpeg');
break;
case 3:
header('Content-type: image/png');
break;
case 4:
header('application/x-shockwave-flash');
break;
default:
header('Content-type: text/plain');
}
fpassthru($fp);
fclose($fp);
exit;
}
}
header('HTTP/1.0 403 Forbidden');
?>
@@ -0,0 +1,45 @@
<?php
function check_pw($u, $p) {
return true;
}
if (!isset($_SERVER['PHP_AUTH_USER'])
or !check_pw($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']))
{
Header("WWW-Authenticate: Basic realm=\"My Realm\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel button\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}
?>
<?php
/* $pagetitle = 'tilman.de';
$breadcrumb = 'Seite';
// $keywords = '';
// $description = '';
include_once($_SERVER["DOCUMENT_ROOT"].'/pageheader.php');
include_once($_SERVER["DOCUMENT_ROOT"].'/functions.php');
$authorized = false;
$authorized = isAuthorized($_SERVER["SCRIPT_FILENAME"]);
if ($authorized) {
?>
<div class="content">
</div>
<?php
}
else {
showUnauthorizedMessage();
}
include_once($_SERVER["DOCUMENT_ROOT"].'/pagefooter.php');
*/
?>
@@ -0,0 +1,26 @@
<?php
@session_start();
$pagetitle = 'tilman.de';
$breadcrumb = 'Seite';
// $keywords = '';
// $description = '';
include_once($_SERVER['DOCUMENT_ROOT'].'/security.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/pageheader.php');
if (itemAccessible($_SERVER['SCRIPT_FILENAME'])) {
?>
<div class="content">
Geschütztes Bild: <img src="<?php echo itemURL('siegel.gif'); ?>" />
</div>
<?php
}
else {
showUnauthorizedMessage();
}
include_once($_SERVER['DOCUMENT_ROOT'].'/daten/php/pagefooter.php');
?>