| 1 |
lars |
1 |
<?php
|
|
|
2 |
echo md5("info@weban.de");
|
|
|
3 |
|
|
|
4 |
session_start();
|
|
|
5 |
$debug=0;
|
|
|
6 |
if(strlen($_POST['form_search'])>0){
|
|
|
7 |
$_SESSION['best_manu.php']['Kundendaten'] = $_POST;
|
|
|
8 |
}
|
|
|
9 |
|
|
|
10 |
if($debug==1) print_r($_SESSION['best_manu.php']['Kundendaten']);
|
|
|
11 |
require_once "../../../Online-Shop/connect2.php";
|
|
|
12 |
|
|
|
13 |
require_once 'system/getCountries.php'); // hier liegt auch die function translate_key($table,$key .. erstmal...
|
|
|
14 |
$landArr = getCountries();
|
|
|
15 |
|
|
|
16 |
$infoMsg['mindEintrag'] = "Ihre Suchbegriffe müssem mindestens 3 Zeichen lang sein.";
|
|
|
17 |
|
|
|
18 |
$errMsg['keinSuchbegriff'] = "Fehler. Kein Suchbegriff eingegeben oder Suchbegriff zu kurz.";
|
|
|
19 |
$errMsg['keinErgebnis'] = "Fehler. Keine Ergebnisse gefunden.";
|
|
|
20 |
|
|
|
21 |
$html = "";
|
|
|
22 |
$selected = 1; // Preselected Deutschland (Länder-selectbox)
|
|
|
23 |
|
|
|
24 |
$html .= build_search_header();
|
|
|
25 |
|
|
|
26 |
switch($_REQUEST['s_action']){
|
|
|
27 |
case "search":
|
|
|
28 |
|
|
|
29 |
$noPost=1;
|
|
|
30 |
|
|
|
31 |
// evtl. Leerzeichen entfernen
|
|
|
32 |
foreach($_REQUEST as $key => $val) {
|
|
|
33 |
$_REQUEST[$key] = trim($val);
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
// Firma
|
|
|
37 |
$wcl = "(";
|
|
|
38 |
if(strlen($_REQUEST['s_Firma'])>2){
|
|
|
39 |
$noPost=0;
|
|
|
40 |
if($j>0) $wcl .= ") and (";
|
|
|
41 |
$wcl .= "Name2 like '%".$_REQUEST['s_Firma']."%'";
|
|
|
42 |
$j++;
|
|
|
43 |
}
|
|
|
44 |
// Vorname
|
|
|
45 |
if(strlen($_REQUEST['s_Vorname'])>2){
|
|
|
46 |
$noPost=0;
|
|
|
47 |
if($j>0) $wcl .= ") and (";
|
|
|
48 |
$wcl .= "Vorname like '%".$_REQUEST['s_Vorname']."%'";
|
|
|
49 |
$j++;
|
|
|
50 |
}
|
|
|
51 |
// Nachname
|
|
|
52 |
if(strlen($_REQUEST['s_Nachname'])>2){
|
|
|
53 |
$noPost=0;
|
|
|
54 |
if($j>0) $wcl .= ") and (";
|
|
|
55 |
$wcl .= "Name1 like '%".$_REQUEST['s_Nachname']."%'";
|
|
|
56 |
$j++;
|
|
|
57 |
}
|
|
|
58 |
// Strasse
|
|
|
59 |
if(strlen($_REQUEST['s_Strasse'])>2){
|
|
|
60 |
$noPost=0;
|
|
|
61 |
if($j>0) $wcl .= ") and (";
|
|
|
62 |
//strasse für die Suche beschneiden
|
|
|
63 |
$strasse = eregi_replace("strasse","",$_REQUEST['s_Strasse']);
|
|
|
64 |
$strasse = eregi_replace("straße","",$strasse);
|
|
|
65 |
$strasse = eregi_replace("str.","",$strasse);
|
|
|
66 |
$strasse = eregi_replace("str,","",$strasse); //tippfehler abfangen
|
|
|
67 |
$wcl .= "Strasse like '%".trim($strasse)."%'";
|
|
|
68 |
$j++;
|
|
|
69 |
}
|
|
|
70 |
// Hausnummer
|
|
|
71 |
if(strlen($_REQUEST['s_Hausnummer'])>0){
|
|
|
72 |
$noPost=0;
|
|
|
73 |
if($j>0) $wcl .= ") and (";
|
|
|
74 |
$wcl .= "Hausnummer like '".$_REQUEST['s_Hausnummer']."%'";
|
|
|
75 |
$j++;
|
|
|
76 |
}
|
|
|
77 |
// PLZ
|
|
|
78 |
if(strlen($_REQUEST['s_PLZ'])>1){
|
|
|
79 |
$noPost=0;
|
|
|
80 |
if($j>0) $wcl .= ") and (";
|
|
|
81 |
$wcl .= "PLZ like '".$_REQUEST['s_PLZ']."%'";
|
|
|
82 |
$j++;
|
|
|
83 |
}
|
|
|
84 |
// Ort
|
|
|
85 |
if(strlen($_REQUEST['s_Ort'])>2){
|
|
|
86 |
$noPost=0;
|
|
|
87 |
if($j>0) $wcl .= ") and (";
|
|
|
88 |
$wcl .= "Ort like '%".$_REQUEST['s_Ort']."%'";
|
|
|
89 |
$j++;
|
|
|
90 |
}
|
|
|
91 |
// Telefon
|
|
|
92 |
if(strlen($_REQUEST['s_Telefon'])>3){
|
|
|
93 |
$noPost=0;
|
|
|
94 |
if($j>0) $wcl .= ") and (";
|
|
|
95 |
$wcl .= "Telefon like '".$_REQUEST['s_Telefon']."%'";
|
|
|
96 |
$j++;
|
|
|
97 |
}
|
|
|
98 |
// Fax
|
|
|
99 |
if(strlen($_REQUEST['s_Fax'])>3){
|
|
|
100 |
$noPost=0;
|
|
|
101 |
if($j>0) $wcl .= ") and (";
|
|
|
102 |
$wcl .= "Fax like '".$_REQUEST['s_Fax']."%'";
|
|
|
103 |
$j++;
|
|
|
104 |
}
|
|
|
105 |
// email
|
|
|
106 |
if(strlen($_REQUEST['s_email'])>2){
|
|
|
107 |
$noPost=0;
|
|
|
108 |
if($j>0) $wcl .= ") and (";
|
|
|
109 |
$wcl .= "E_Mail like '%".$_REQUEST['s_email']."%'";
|
|
|
110 |
$j++;
|
|
|
111 |
}
|
|
|
112 |
// Land
|
|
|
113 |
if(strlen($_REQUEST['s_Land'])>0){
|
|
|
114 |
if($j>0) $wcl .= ") and (";
|
|
|
115 |
$wcl .= "Land = '".$landArr[$_REQUEST['s_Land']]."')";
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
$sql = "select ID,Anrede,Vorname,Name1,Name2,Strasse,Hausnummer,PLZ,Ort,Land,E_Mail,Telefon,Fax,AP_Bemerkung
|
|
|
119 |
from Logins where ".$wcl." order by Name2,Name1,Vorname,E_Mail,PLZ,Ort";
|
|
|
120 |
if($debug==1) echo $sql;
|
|
|
121 |
if($noPost==0){
|
|
|
122 |
$q = mysql_query($sql);
|
|
|
123 |
}else{
|
|
|
124 |
die(build_search_header()."<br/>".$errMsg['keinSuchbegriff']."<br/><br/>".build_search_back().build_search_footer());
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
$html .= "\n\n<script type=\"text/javascript\">\n";
|
|
|
128 |
|
|
|
129 |
$html .= "\tfunction openerRefresh(ID,Anrede,Vorname,Name1,Name2,Strasse,Hausnummer,PLZ,Ort,Land,E_Mail,Telefon,Fax,Bemerkung) {\n";
|
|
|
130 |
$html .= "\t\twindow.opener.document.form_kundendaten.ID.value = ID;\n";
|
|
|
131 |
$html .= "\t\twindow.opener.document.form_kundendaten.Vorname.value = Vorname;\n";
|
|
|
132 |
$html .= "\t\twindow.opener.document.form_kundendaten.Anrede.value = Anrede;\n";
|
|
|
133 |
$html .= "\t\twindow.opener.document.form_kundendaten.Firma.value = Name2;\n";
|
|
|
134 |
$html .= "\t\twindow.opener.document.form_kundendaten.Vorname.value = Vorname;\n";
|
|
|
135 |
$html .= "\t\twindow.opener.document.form_kundendaten.Nachname.value = Name1;\n";
|
|
|
136 |
$html .= "\t\twindow.opener.document.form_kundendaten.Strasse.value = Strasse;\n";
|
|
|
137 |
$html .= "\t\twindow.opener.document.form_kundendaten.Hausnummer.value = Hausnummer;\n";
|
|
|
138 |
$html .= "\t\twindow.opener.document.form_kundendaten.PLZ.value = PLZ;\n";
|
|
|
139 |
$html .= "\t\twindow.opener.document.form_kundendaten.Ort.value = Ort;\n";
|
|
|
140 |
$html .= "\t\twindow.opener.document.form_kundendaten.Land.value = Land;\n";
|
|
|
141 |
$html .= "\t\twindow.opener.document.form_kundendaten.email.value = E_Mail;\n";
|
|
|
142 |
$html .= "\t\twindow.opener.document.form_kundendaten.Telefon.value = Telefon;\n";
|
|
|
143 |
$html .= "\t\twindow.opener.document.form_kundendaten.Fax.value = Fax;\n";
|
|
|
144 |
$html .= "\t\twindow.opener.document.form_kundendaten.Bemerkung.value = Bemerkung;\n";
|
|
|
145 |
$html .= "\t}\n";
|
|
|
146 |
$html .= "</script>\n";
|
|
|
147 |
|
|
|
148 |
$i=0;
|
|
|
149 |
$res_headline = "<h3>Suchergebnis";
|
|
|
150 |
$res="";
|
|
|
151 |
$k=1;
|
|
|
152 |
while($r = @mysql_fetch_assoc($q)){
|
|
|
153 |
$res .= "<div class=\"s_result\">\n";
|
|
|
154 |
$res .= "<br/>Nr.: ".$k;
|
|
|
155 |
$res .= "<br/>ID: ".$r['ID'];
|
|
|
156 |
$res .= "<br/>Firma: ".$r['Name2'];
|
|
|
157 |
$res .= "<br/>Anrede: ".$r['Anrede'];
|
|
|
158 |
$res .= "<br/>Vorname: ".$r['Vorname']."<br/>Nachname: ".$r['Name1'];
|
|
|
159 |
$res .= "<br/>Strasse/Nr.: ".$r['Strasse']." ".$r['Hausnummer'];
|
|
|
160 |
$res .= "<br/>Tel.: ".$r['Telefon'];
|
|
|
161 |
$res .= "<br/>Fax: ".$r['Fax'];
|
|
|
162 |
$res .= "<br/>PLZ/Ort: ".$r['PLZ']." ".$r['Ort'];
|
|
|
163 |
$res .= "<br/>Land: ".$r['Land'];
|
|
|
164 |
$res .= "<br/>E-Mail: ".$r['E_Mail'];
|
|
|
165 |
$res .= "</div>\n";
|
|
|
166 |
$res .= "<div class=\"s_select\">\n";
|
|
|
167 |
$k++;
|
|
|
168 |
$paramsArr = array();
|
|
|
169 |
$j=0;
|
|
|
170 |
$res_html = "";
|
|
|
171 |
foreach($r as $key => $value){
|
|
|
172 |
// Suchergebnis übergeben (Formular)
|
|
|
173 |
if($key=="Land") $value = getCountryIDByName($value,$landArr);
|
|
|
174 |
$key = translate_key("Logins",$key,"table2form");
|
|
|
175 |
$res_html .= "\t<input type=\"hidden\" name=\"".$key."\" value=\"".$value."\" />\n";
|
|
|
176 |
// und für das update per Javascript
|
|
|
177 |
$paramsArr[] = "'".$value."'";
|
|
|
178 |
$j++;
|
|
|
179 |
}
|
|
|
180 |
$params = implode(",",$paramsArr);
|
|
|
181 |
$res .= "<form action=\"?s_action=search\" name=\"sres_".$r['ID']."\" method=\"post\" onsubmit=\"openerRefresh(".$params."); return true\">\n";
|
|
|
182 |
$res .= $res_html;
|
|
|
183 |
|
|
|
184 |
$res .= "\t<input type=\"submit\" onmousedown=\"window.refresh();\" onmouseup=\"javascript:window.close();\" name=\"form_search\" value=\"Firma auswählen\" />\n";
|
|
|
185 |
$res .= build_search_back();
|
|
|
186 |
$res .= "</form>\n";
|
|
|
187 |
$res .= "<hr/></div>\n";
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
if(@mysql_num_rows($q)>0){
|
|
|
191 |
$html .= $res_headline." (".@mysql_num_rows($q)." Treffer):</h3>\n".$res;
|
|
|
192 |
}else{
|
|
|
193 |
die(build_search_header()."<br/>".$errMsg['keinErgebnis']."<br/><br/>".build_search_back().build_search_footer());
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
break;
|
|
|
197 |
default:
|
|
|
198 |
$html .= build_searchform();
|
|
|
199 |
}
|
|
|
200 |
$html .= build_search_footer();
|
|
|
201 |
echo $html;
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
function build_searchform() {
|
|
|
205 |
global $landArr;
|
|
|
206 |
global $selected;
|
|
|
207 |
global $infoMsg;
|
|
|
208 |
|
|
|
209 |
$html = "<form method=\"post\" name=\"form_sucheFirma\" action=\"".$_SERVER['PHP_SELF']."\">
|
|
|
210 |
<fieldset>
|
|
|
211 |
<legend>Kundendaten (Firma auswählen)</legend>
|
|
|
212 |
".$infoMsg['mindEintrag']."
|
|
|
213 |
<table cols=\"2\" cellpadding=\"2\" width=\"100%\" class=\"tablecolor2\" cellspacing=\"2\">
|
|
|
214 |
<tr>
|
|
|
215 |
<td class=\"midcol\"><label for=\"s_Firma\">Firma:</label></td>
|
|
|
216 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Firma\" name=\"s_Firma\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
217 |
</td>
|
|
|
218 |
</tr>
|
|
|
219 |
<tr>
|
|
|
220 |
<td class=\"midcol\"><label for=\"s_Vorname\">Vorname:</td>
|
|
|
221 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Vorname\" name=\"s_Vorname\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
222 |
</td>
|
|
|
223 |
</tr>
|
|
|
224 |
<tr>
|
|
|
225 |
<td class=\"midcol\"><label for=\"s_Nachname\">Nachname:</td>
|
|
|
226 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Nachname\" name=\"s_Nachname\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
227 |
</td>
|
|
|
228 |
</tr>
|
|
|
229 |
<tr>
|
|
|
230 |
<td class=\"midcol\"><label for=\"s_strasse\">Straße:</td>
|
|
|
231 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Strasse\" name=\"s_Strasse\" size=\"20\" class=\"inputbox\" value=\"\">
|
|
|
232 |
<input type=\"text\" name=\"s_Hausnummer\" size=\"4\" class=\"inputbox\" value=\"\">
|
|
|
233 |
</td>
|
|
|
234 |
</tr>
|
|
|
235 |
<tr>
|
|
|
236 |
<td class=\"midcol\"><label for=\"s_PLZ\">PLZ:</td>
|
|
|
237 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_PLZ\" name=\"s_PLZ\" size=\"9\" class=\"inputbox\" value=\"\">
|
|
|
238 |
</td>
|
|
|
239 |
</tr>
|
|
|
240 |
<tr>
|
|
|
241 |
<td class=\"midcol\"><label for=\"s_Ort\">Ort:</td>
|
|
|
242 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Ort\" name=\"s_Ort\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
243 |
</td>
|
|
|
244 |
</tr>
|
|
|
245 |
<tr>
|
|
|
246 |
<td class=\"midcol\"><label for=\"s_Land\">Land:</td>
|
|
|
247 |
<td align=\"left\">";
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
/* SelectBox Länder */
|
|
|
251 |
$html .= buildSelectCountry($landArr,"s_Land",$selected);
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
$html .= "</td>
|
|
|
255 |
</tr>
|
|
|
256 |
<tr>
|
|
|
257 |
<td class=\"midcol\"><label for=\"s_email\">E-Mail:</td>
|
|
|
258 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_email\" name=\"s_email\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
259 |
|
|
|
260 |
</td>
|
|
|
261 |
</tr>
|
|
|
262 |
<tr>
|
|
|
263 |
<td class=\"midcol\"><label for=\"s_Telefon\">Telefon:</td>
|
|
|
264 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Telefon\" name=\"s_Telefon\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
265 |
</td>
|
|
|
266 |
</tr>
|
|
|
267 |
<tr>
|
|
|
268 |
<td class=\"midcol\"><label for=\"s_Fax\">Fax:</td>
|
|
|
269 |
<td class=\"midcol\" align=\"left\"><input type=\"text\" id=\"s_Fax\" name=\"s_Fax\" size=\"26\" class=\"inputbox\" value=\"\">
|
|
|
270 |
</td>
|
|
|
271 |
</tr>
|
|
|
272 |
</table>
|
|
|
273 |
<input type=\"hidden\" name=\"s_action\" value=\"search\" />
|
|
|
274 |
<input type=\"submit\" name=\"submit_search\" value=\"Suche starten\" />
|
|
|
275 |
</fieldset><br>
|
|
|
276 |
</form>";
|
|
|
277 |
return $html;
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
function build_search_header(){
|
|
|
281 |
$html = "<html>\n";
|
|
|
282 |
$html .= "<head>\n";
|
|
|
283 |
$html .= "<title>Firma auswählen</title>\n";
|
|
|
284 |
$html .= "<style>
|
|
|
285 |
body {
|
|
|
286 |
margin:10px;
|
|
|
287 |
background-color: #FFFF00;
|
|
|
288 |
font-family: arial,helvetica,sans-serif;
|
|
|
289 |
font-size:10pt;
|
|
|
290 |
}
|
|
|
291 |
label {
|
|
|
292 |
font-size:10pt;
|
|
|
293 |
}
|
|
|
294 |
</style>";
|
|
|
295 |
$html .= "</head><body>\n";
|
|
|
296 |
return $html;
|
|
|
297 |
}
|
|
|
298 |
|
|
|
299 |
function build_search_footer() {
|
|
|
300 |
$html = "</body></html>\n";
|
|
|
301 |
return $html;
|
|
|
302 |
}
|
|
|
303 |
|
|
|
304 |
function build_search_back(){
|
|
|
305 |
$html = "<input type=\"button\" name=\"button\" onclick=\"javascript:window.location.href='".$_SERVER['PHP_SELF']."'\" value=\"neue Suche\" />\n";
|
|
|
306 |
return $html;
|
|
|
307 |
}
|
|
|
308 |
?>
|