<html>
<head>
<title>News</title>
<style type='text/css'>
BODY,TD { font: 10 px verdana; }
</style>
</head>
<body>
<?php
#===============================================#
# Another Script by x-gfx.de (Robert k)
#===============================================#
//mysql-connect
@mysql_connect("localhost", "root", "");
@mysql_select_db("foxx21");
//name der mySQL-tabelle
$table = "football";
//das admin-passwort:
$passwort = "test";
//ab hier nichts mehr ändern
//was geht ab? ;)
switch($act)
{
//save@db
case save:
if($pw != $passwort || $pw == "") die("Sorry, falsches Passwort");
$t = time();
$titel = addslashes($titel);
$titel_link = addslashes($titel_link);
$medium = addslashes($medium);
$bild = addslashes($bild);
$q = mysql_query("INSERT INTO $table VALUES('','$t','$titel','$titel_link','$medium','$bild')");
if($q) echo "Der Eintrag wurde gespeichert ... <a href='$PHP_SELF'>zur Startseite</a>\n";
else echo "Datenbankfehler, Eintrag konnte nicht gespeichert werden ...</a>\n";
break;
//admin-form
case admin:
if($pw != $passwort || $pw == "") die("Sorry, falsches Passwort");
echo <<<ende
<form action='$PHP_SELF' method='post'>
<input type='hidden' name='pw' value='$pw'>
<input type='hidden' name='act' value='save'>
Titel:<br>
<input type='text' name='titel' size='50'><p>
Titel-Link:<br>
<input type='text' name='titel_link' size='50'><p>
Medium:<br>
<input type='text' name='medium' size='50'><p>
Bild-URL:<br>
<input type='text' name='bild' size='50'><p>
<input type='submit' value='Speichern'>
</form>
ende;
break;
//login-form
case login_form:
echo <<<end
<p align='center'>
Bitte das Admin-Passwort eingeben:
<form action='$PHP_SELF' method='post'>
<input type='hidden' name='act' value='admin'>
<input type='password' name='pw' size='10'>
<input type='submit' value='Login'>
</form>
</p>
end;
break;
//ausgabe der datensätze
default:
$q = mysql_query("SELECT * FROM $table ORDER BY id DESC");
echo "<table align='center' width='80%' cellpadding='2' cellspacing='0'>\n";
while($row = mysql_fetch_array($q))
{
$titel = stripslashes($titel);
$titel_link = stripslashes($titel_link);
$medium = stripslashes($medium);
$bild = stripslashes($bild);
$img = @getimagesize($row[bild]);
if($cnt % 2) $bg = "#eeeeee";
else $bg = "#cecece";
echo "<tr bgcolor='$bg'>\n";
echo "\t<td width='25%' align='center'>" . strftime("%d.%m.%y", $row[datum]) . "</td>\n";
echo "\t<td width='25%' align='center'><a href='$row[titel_link]' title='$row[titel]'>$row[titel]</a></td>\n";
echo "\t<td width='25%' align='center'>$row[medium]</td>\n";
echo "\t<td width='25%' align='center'><a href='$row[titel_link]'><img src='$row[bild]' alt='$row[titel]' width='$img[0]' height='$img[1]' border='0'></a>\n";
echo "</tr>\n";
$cnt++;
}
echo "<tr>\n<td align='right' colspan='4'>[ <a href='$PHP_SELF?act=login_form'>Neuer Eintrag</a> ]</td>\n</tr>\n";
echo "</table>\n";
break;
}
@mysql_close();
?>
</body>
</html>