Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
3 lars 1
<?
2
	if ($_POST[action])
3
	{
4
		$required = array
5
					(
6
						"Name",
7
						"mail",
8
						"homepage",
9
						"Stadt",
10
						"Bundesland",
11
						"Staat",
12
						"text"
13
					);
14
 
15
		$transportArray = array();
16
		$error = array();
17
		foreach($required as $key)
18
		{
19
			if (!$_POST[$key]) { $error[] = $key; }
20
			$transportArray[] = $key."=".urlencode($_POST[$key]);
21
		}
22
		$transportArray[] = "error=".implode(";",$error);
23
 
24
		if ($error == true)
25
		{
26
			header("Location: gaestebuchinput.htm?".implode("&",$transportArray));
27
			exit;
28
		}
29
 
30
		$query="
31
			insert into gaestebuch_eintraege
32
			(
33
				site,
34
				Name,
35
				mail,
36
				homepage,
37
				Stadt,
38
				Bundesland,
39
				Staat,
40
				headline,
41
				text,
42
				erstellt_am,
43
				erstellt_von,
44
				letzte_Aenderung_am,
45
				letzte_Aenderung_von
46
			)
47
			values
48
			(
49
				'mediaran.de',
50
				'$_POST[Name]',
51
				'$_POST[mail]',
52
				'$_POST[homepage]',
53
				'$_POST[Stadt]',
54
				'$_POST[Bundesland]',
55
				'$_POST[Staat]',
56
				'$_POST[headline]',
57
				'$_POST[text]',
58
				NOW(),
59
				'Webinterface',
60
				NOW(),
61
				'Webinterface'
62
			)
63
		";
64
		$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
65
	}
66
 
67
	$query="
68
		SELECT
69
			*,
70
			DATE_FORMAT(erstellt_am, '%d.%m.%Y') as Datum
71
		FROM
72
			gaestebuch_eintraege
73
		WHERE
74
			site='mediaran.de'
75
		ORDER BY
76
			erstellt_am desc";
77
	$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
78
?>
79
<div class=whiteBox style="padding:3px">
80
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
81
    <tr>
82
      <td class="tablecolor2">
83
        <center>
84
          <a href="gaestebuchinput.htm"><strong>Neueintrag</strong></a>
85
        </center>
86
      </td>
87
    </tr>
88
  </table>
89
</div>
90
<?
91
	while ($zeile=mysql_fetch_array($result))
92
	{
93
?>
94
<div class=whiteBox style="padding:3px">
95
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
96
    <tr>
97
      <td nowrap><?=$zeile[headline];?></td>
98
      <td align="right"><?=$zeile[Datum];?></td>
99
    </tr>
100
    <tr>
101
      <td colspan="2">
102
        <? if ($zeile[mail]) { echo "<a href=\"mailto:$zeile[mail]\">$zeile[Name]</a>"; } else { echo $zeile[Name]; } ?>
103
        &nbsp;
104
        <? if ($zeile[homepage]) { echo "<a href=\"$zeile[homepage]\" target=\"_blank\">$zeile[homepage]</a>"; } ?>
105
      </td>
106
    </tr>
107
    <tr>
108
      <td colspan="2">
109
        <?=$zeile[Stadt]; ?>
110
        <?=$zeile[Bundesland]; ?>
111
        <?=$zeile[Staat]; ?>
112
      </td>
113
    </tr>
114
    <tr>
115
      <td colspan="2">&nbsp;</td>
116
    </tr>
117
    <tr>
118
      <td colspan="2">
119
        <?=nl2br($zeile[text]); ?>
120
      </td>
121
    </tr>
122
  </table>
123
</div>
124
<?
125
	}
126
?>
127
<div class=whiteBox style="padding:3px">
128
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
129
    <tr>
130
      <td class="tablecolor2">
131
        <center>
132
          <a href="gaestebuchinput.htm"><strong>Neueintrag</strong></a>
133
        </center>
134
      </td>
135
    </tr>
136
  </table>
137
</div>