| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//$Id: best_manu_search.php 3932 2011-09-16 08:28:03Z tiefland $
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
7 |
* @author Patrick Lautsch <lautsch@weban.de>
|
|
|
8 |
* @copyright 2008 Webagentur Niewerth
|
|
|
9 |
* @package Content-management
|
|
|
10 |
* @version $Rev: 3932 $
|
|
|
11 |
* @license propietary
|
|
|
12 |
* @filesource
|
|
|
13 |
*
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
*
|
|
|
18 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
19 |
* @author Patrick Lautsch <lautsch@weban.de>
|
|
|
20 |
* @copyright 2008 Webagentur Niewerth
|
|
|
21 |
* @package Content-management
|
|
|
22 |
*/
|
|
|
23 |
|
|
|
24 |
function suchen()
|
|
|
25 |
{
|
|
|
26 |
global $Suchfelder, $suchfelder;
|
|
|
27 |
// Wenn die Variable "$_POST['suchen']" gesetzt ist Frage die Kunden ab
|
|
|
28 |
if ( isset($_POST["suchen"]) && ($_POST['suchen']!="false") )
|
|
|
29 |
{
|
|
|
30 |
foreach ( $Suchfelder as $recht )
|
|
|
31 |
{
|
|
|
32 |
|
|
|
33 |
if ( $recht == "PLZ_Ort" )
|
|
|
34 |
{
|
|
|
35 |
if ( $_POST["PLZ"] )
|
|
|
36 |
{
|
|
|
37 |
$cond_arr[] = "PLZ LIKE '%" . $_POST["PLZ"] . "%'";
|
|
|
38 |
}
|
|
|
39 |
if ( $_POST["Ort"] )
|
|
|
40 |
{
|
|
|
41 |
$cond_arr[] = "ORT LIKE '%" . $_POST["Ort"] . "%'";
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
else
|
|
|
45 |
{
|
|
|
46 |
if ( $_POST[$recht] )
|
|
|
47 |
{
|
|
|
48 |
$cond_arr[] = "$recht LIKE '%" . $_POST[$recht] . "%'";
|
|
|
49 |
}
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
$sql = "SELECT
|
|
|
56 |
ID, Vorname, Name1, Ort, Name2 AS Firma
|
|
|
57 |
FROM
|
|
|
58 |
Logins
|
|
|
59 |
";
|
|
|
60 |
|
|
|
61 |
if ( count($cond_arr) )
|
|
|
62 |
{
|
|
|
63 |
$cond = implode( " AND ", $cond_arr );
|
|
|
64 |
$sql .= "WHERE
|
|
|
65 |
$cond";
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
$result = mysql_query( $sql ) or die( mysql_error() . "<hr />" . $sql );
|
|
|
69 |
$i = 0;
|
|
|
70 |
for ( $i = 0; $row = mysql_fetch_assoc($result); $i++ )
|
|
|
71 |
{
|
|
|
72 |
$loop[$i]['ID'] = $row['ID'];
|
|
|
73 |
$loop[$i]['Vorname'] = ($row['Vorname']) ? $row['Vorname']:" ";
|
|
|
74 |
$loop[$i]['Name1'] = ($row['Name1']) ? $row['Name1'] :" ";
|
|
|
75 |
$loop[$i]['Ort'] = ($row['Ort']) ? $row['Ort'] :" ";
|
|
|
76 |
$loop[$i]['Firma'] = ($row['Firma']) ? $row['Firma'] :" ";
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
// Überprüfe ob 50 Einträge existieren und setzte limit_erreicht auf 'true'
|
|
|
80 |
if ( count($loop) >= 9999 )
|
|
|
81 |
{
|
|
|
82 |
$limit_erreicht = 'true';
|
|
|
83 |
$GLOBALS["ui"]->assign( "limit_erreicht", $limit_erreicht );
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
// Überprüfe ob überhaupt Einräge existieren und setze dann keine_eintraege = 'true'
|
|
|
87 |
if ( count($loop) <= 0 )
|
|
|
88 |
{
|
|
|
89 |
$keine_eintraege = 'true';
|
|
|
90 |
$GLOBALS["ui"]->assign( "keine_eintraege", $keine_eintraege );
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
$GLOBALS["ui"]->assign( "loop", $loop );
|
|
|
94 |
$GLOBALS["ui"]->assign( "suchen", ($_POST['suchen'])?$_POST['suchen']:"false" );
|
|
|
95 |
$GLOBALS["ui"]->assign( "suchfelder", $suchfelder );
|
|
|
96 |
//////////////////////////////////////////////////////////////////////
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
?>
|