| 1 |
lars |
1 |
<? require_once "connect.php"; ?>
|
|
|
2 |
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>Pinnwand</title>
|
|
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
7 |
<meta name="author" content="Webagentur Niewerth - www.weban.de">
|
|
|
8 |
<meta name="revisit-after" content="30 days">
|
|
|
9 |
<meta name="language" content="deutsch, de">
|
|
|
10 |
<meta name="distribution" content="global">
|
|
|
11 |
<meta name="robots" content="all">
|
|
|
12 |
</head>
|
|
|
13 |
|
|
|
14 |
<body bgcolor="#FFFFFF" text="#000000">
|
|
|
15 |
|
|
|
16 |
<?
|
|
|
17 |
function index() { ?>
|
|
|
18 |
Pinnwand: Übersicht<p>
|
|
|
19 |
<table border=0 width=100%>
|
|
|
20 |
<tr><td>Gesuche:<p>
|
|
|
21 |
<?
|
|
|
22 |
$query = "select * from pinnwand where art='suchen' order by id desc";
|
|
|
23 |
$result = mysql_query($query);
|
|
|
24 |
//$nummer = mysql_numrows($result);
|
|
|
25 |
|
|
|
26 |
while ($row=mysql_fetch_array($result)) {
|
|
|
27 |
$id = $row[id];
|
|
|
28 |
$produkt = $row[produkt];
|
|
|
29 |
?>
|
|
|
30 |
<li><a href="pinnwand.php?action=show&id=<? print $id; ?>"><? print $produkt; ?></a>
|
|
|
31 |
<?
|
|
|
32 |
}
|
|
|
33 |
?></td><TD>Angebote:<p><?
|
|
|
34 |
$query = "Select * from pinnwand where art='bieten' order by id desc";
|
|
|
35 |
$result = mysql_query($query);
|
|
|
36 |
while ($row=mysql_fetch_array($result)) {
|
|
|
37 |
$id = $row[id];
|
|
|
38 |
$produkt = $row[produkt];
|
|
|
39 |
?>
|
|
|
40 |
<li><a href="pinnwand.php?action=show&id=<? print $id; ?>"><? print $produkt; ?></a>
|
|
|
41 |
<?
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
?>
|
|
|
46 |
</td></tr></table>
|
|
|
47 |
<form name="form3" method="post" action="">
|
|
|
48 |
<input type="hidden" name="action" value="add">
|
|
|
49 |
<input type="submit" name="Abschicken" value="Neuen Eintrag vornehmen">
|
|
|
50 |
</form>
|
|
|
51 |
<form name="form4" method="post" action="">
|
|
|
52 |
<input type="hidden" name="action" value="search">
|
|
|
53 |
<input type="submit" name="Abschicken" value="Eintrag suchen">
|
|
|
54 |
</form>
|
|
|
55 |
<?
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
function add() {
|
|
|
59 |
?>
|
|
|
60 |
|
|
|
61 |
Eintrag hinzufügen<p>
|
|
|
62 |
<form name="form1" action="" method="post">
|
|
|
63 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
64 |
<tr><td>Ihr Name:</td><td><input type="text" name="name"></td></tr><tr>
|
|
|
65 |
<td>Strasse/Nr.:</td><td><input type="text" name="strasse"></td></tr><tr>
|
|
|
66 |
<td>PLZ/Ort:</td><td><input type="text" name="plz" size="5"> <input type="text" name="ort"></td></tr><tr>
|
|
|
67 |
<td>Art der Anzeige: </td><td><select name="art">
|
|
|
68 |
<option value="bieten">Ich biete</option>
|
|
|
69 |
<option value="suchen">Ich suche</option>
|
|
|
70 |
</select>
|
|
|
71 |
</td></tr><tr>
|
|
|
72 |
<td>Telefon:</td><td><input type="text" name="telefon"></td></tr><tr>
|
|
|
73 |
<td>Was suchen/bieten Sie?</td><td><input type="text" name="produkt"></td></tr><tr>
|
|
|
74 |
<td>Beschreibung:</td><td><textarea name="beschreibung"></textarea></td></tr>
|
|
|
75 |
</table><p>
|
|
|
76 |
<input type="hidden" name="action" value="post">
|
|
|
77 |
<input type="submit" name="Abschicken" value="Abschicken">
|
|
|
78 |
</form>
|
|
|
79 |
|
|
|
80 |
<?
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
function search() { ?>
|
|
|
84 |
Eintrag suchen<p>
|
|
|
85 |
<form name="form5" method="post" action="">
|
|
|
86 |
Suche: <input type="text" name="query"> suche in <input type="radio" name="suchein" value="beschreibung">Beschreibung <input type="radio" name="suchein" value="produkt">Titel <input type="radio" name="suchein" value="plz">Postleitzahl<p>
|
|
|
87 |
<input type="hidden" name="action" value="search_result">
|
|
|
88 |
<input type="submit" name="Abschicken" value="Suche starten">
|
|
|
89 |
</form>
|
|
|
90 |
<?
|
|
|
91 |
}
|
|
|
92 |
function search_result() {
|
|
|
93 |
global $suchein, $query;
|
|
|
94 |
if ($suchein == "") {
|
|
|
95 |
?>Pinnwand: Fehler<p>
|
|
|
96 |
Bitte eine Suchkategorie anwählen. <?
|
|
|
97 |
}
|
|
|
98 |
else {
|
|
|
99 |
?>
|
|
|
100 |
|
|
|
101 |
Pinnwand: Suchergebnisse<p>
|
|
|
102 |
<?
|
|
|
103 |
$sql = "select * from pinnwand where $suchein like '%$query%'";
|
|
|
104 |
$result = mysql_query($sql);
|
|
|
105 |
while ($row=mysql_fetch_array($result)) {
|
|
|
106 |
$id = $row[id];
|
|
|
107 |
$produkt = $row[produkt];
|
|
|
108 |
$art = $row[art];
|
|
|
109 |
if ($art == "suchen") {
|
|
|
110 |
$art = "Gesuch";
|
|
|
111 |
}
|
|
|
112 |
if ($art == "bieten") {
|
|
|
113 |
$art = "Gebot";
|
|
|
114 |
}
|
|
|
115 |
?>
|
|
|
116 |
<li> <a href="pinnwand.php?action=show&id=<? print $id; ?>"><? print $produkt; ?></a> Kategorie: <? print $art; ?>
|
|
|
117 |
<?
|
|
|
118 |
} ?>
|
|
|
119 |
<P>
|
|
|
120 |
<form name="form2" method="post" action="">
|
|
|
121 |
<input type="hidden" name="action" value="index">
|
|
|
122 |
<input type="submit" name="Abschicken" value="Zur Übersicht">
|
|
|
123 |
</form> <?
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
function post() {
|
|
|
128 |
global $name, $strasse, $plz, $ort, $telefon, $art, $produkt, $beschreibung;
|
|
|
129 |
|
|
|
130 |
if ($name == "" or $strasse == "" or $plz == "" or $ort == "" or $telefon == "" or $art == "" or $produkt == "" or $beschreibung == "") {
|
|
|
131 |
?>Sie müßen alle Felder ausfüllen<?
|
|
|
132 |
}
|
|
|
133 |
else {
|
|
|
134 |
|
|
|
135 |
$query = "insert into pinnwand (id, name, strasse, plz, ort, telefon, produkt, beschreibung, art) values ('', '$name', '$strasse', '$plz', '$ort', '$telefon', '$produkt', '$beschreibung', '$art')";
|
|
|
136 |
$result = mysql_query($query);
|
|
|
137 |
?>
|
|
|
138 |
|
|
|
139 |
Sie haben folgende Angaben gemacht:<p>
|
|
|
140 |
<table boder =0 width=100%><tr>
|
|
|
141 |
<td>Sie <? print $art; ?>:</td><td><? print $produkt; ?></td></tr><tr>
|
|
|
142 |
<td>Sie heissen:</td><td><? print $name; ?></td></tr><tr>
|
|
|
143 |
<td>Ihre Adresse:</td><td><? print $strasse; ?> in <? print $plz; ?> <? print $ort; ?></td></tr><tr>
|
|
|
144 |
<td valign=_top>Ihre Beschreibung:</td><td><? print $beschreibung; ?></td></tr></table><p>
|
|
|
145 |
Vielen Dank für Ihre Eingabe.
|
|
|
146 |
<form name="form2" method="post" action="">
|
|
|
147 |
<input type="hidden" name="action" value="index">
|
|
|
148 |
<input type="submit" name="Abschicken" value="Zur Übersicht">
|
|
|
149 |
</form>
|
|
|
150 |
<?
|
|
|
151 |
}
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
function show() {
|
|
|
155 |
global $id;
|
|
|
156 |
if ($id == "") {
|
|
|
157 |
?>
|
|
|
158 |
Ungültiger Aufruf!
|
|
|
159 |
<?
|
|
|
160 |
}
|
|
|
161 |
else {
|
|
|
162 |
?>
|
|
|
163 |
Pinnwand<p>
|
|
|
164 |
<?
|
|
|
165 |
$query = "select * from pinnwand where id='$id'";
|
|
|
166 |
$result = mysql_query($query);
|
|
|
167 |
$row = mysql_fetch_array($result);
|
|
|
168 |
$id = $row[id];
|
|
|
169 |
$name = $row[name];
|
|
|
170 |
$produkt = $row[produkt];
|
|
|
171 |
$beschreibung = nl2br($row[beschreibung]);
|
|
|
172 |
$strasse = $row[strasse];
|
|
|
173 |
$plz = $row[plz];
|
|
|
174 |
$ort = $row[ort];
|
|
|
175 |
$telefon = $row[telefon];
|
|
|
176 |
?>
|
|
|
177 |
Eintrag Nummer: <? print $id; ?><br>Aufgegeben von: <? print $name; ?><br>
|
|
|
178 |
<b><? print $produkt; ?></b><p>
|
|
|
179 |
<? print $beschreibung; ?><p>
|
|
|
180 |
Kontakt:<br>
|
|
|
181 |
<? print $name; ?><br>
|
|
|
182 |
<? print $strasse; ?><br>
|
|
|
183 |
<? print $plz; ?> <? print $ort; ?><br>
|
|
|
184 |
Telefon: <? print $telefon; ?><p>
|
|
|
185 |
<form name="form2" method="post" action="">
|
|
|
186 |
<input type="hidden" name="action" value="index">
|
|
|
187 |
<input type="submit" name="Abschicken" value="Zur Übersicht">
|
|
|
188 |
</form>
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
<?
|
|
|
192 |
}
|
|
|
193 |
}
|
|
|
194 |
|
|
|
195 |
switch($action) {
|
|
|
196 |
|
|
|
197 |
case "show":
|
|
|
198 |
show();
|
|
|
199 |
break;
|
|
|
200 |
|
|
|
201 |
case "add":
|
|
|
202 |
add();
|
|
|
203 |
break;
|
|
|
204 |
|
|
|
205 |
case "search":
|
|
|
206 |
search();
|
|
|
207 |
break;
|
|
|
208 |
|
|
|
209 |
case "post":
|
|
|
210 |
post();
|
|
|
211 |
break;
|
|
|
212 |
|
|
|
213 |
case "search_result":
|
|
|
214 |
search_result();
|
|
|
215 |
break;
|
|
|
216 |
|
|
|
217 |
default:
|
|
|
218 |
index();
|
|
|
219 |
}
|
|
|
220 |
?>
|
|
|
221 |
</body>
|
|
|
222 |
</html>
|