
halcom IT Datenbanksuche 3.2
Suchbegriff eingeben:
';
echo '
';
echo 'Letzte 25 Kunden anzeigen
';
echo 'Letzte 50 Kunden anzeigen
';
echo 'Letzte 100 Kunden anzeigen
';
} else {
echo "
";
echo "
";
echo 'Keine Berechtigung zum Aufrufen dieser Seite!';
$error = "TRUE";
}
if ($error == "FALSE") {
echo "
";
// Datenbankparameter
$tcp = '10.0.10.18';
$user = "db_online";
$password = "VMcaRX92yOhDjm8I";
$database = "wws_halcom";
$s = 0;
$db_link = mysqli_connect ($tcp,$user,$password,$database);
if (!mysqli_set_charset($db_link, "Latin1")) {
printf("Error loading character set Latin1: %s\n", mysqli_error($db_link));
exit();
}
if ( $db_link )
{
if ($suchstring == '') {
if ($set_post == "TRUE") {
echo "
Der Suchbegriff darf nicht leer sein!
";
die;
} else {
die;
}
}
// Hier Quelltest bei erfolgreicher Datenbankverbindung
$pos = strpos($suchstring,"%");
if ($pos !== FALSE) { // Wenn % im String vorkommt
$sqlquery = "SELECT `kdnr`, `anrede`, `name`, `vorname`, `zusatz`, `str`, `nr`, `plz`, `ort`, `tel`, `mo`, `email`, `typ`, `comment`, `comment2` FROM `kunden` WHERE `kdnr` > '1000' ORDER BY `kdnr` DESC LIMIT 100;";
} elseif ($suchstring == 'LAST25') {
$sqlquery = "SELECT `kdnr`, `anrede`, `name`, `vorname`, `zusatz`, `str`, `nr`, `plz`, `ort`, `tel`, `mo`, `email`, `typ`, `comment`, `comment2` FROM `kunden` WHERE `kdnr` > '1000' ORDER BY `kdnr` DESC LIMIT 25;";
} elseif ($suchstring == 'LAST50') {
$sqlquery = "SELECT `kdnr`, `anrede`, `name`, `vorname`, `zusatz`, `str`, `nr`, `plz`, `ort`, `tel`, `mo`, `email`, `typ`, `comment`, `comment2` FROM `kunden` WHERE `kdnr` > '1000' ORDER BY `kdnr` DESC LIMIT 50;";
} elseif ($suchstring == 'LAST100') {
$sqlquery = "SELECT `kdnr`, `anrede`, `name`, `vorname`, `zusatz`, `str`, `nr`, `plz`, `ort`, `tel`, `mo`, `email`, `typ`, `comment`, `comment2` FROM `kunden` WHERE `kdnr` > '1000' ORDER BY `kdnr` DESC LIMIT 100;";
} else {
$suchstring = mysqli_real_escape_string($db_link, $suchstring);
$sqlquery = utf8_decode("SELECT `kdnr`, `anrede`, `name`, `vorname`, `zusatz`, `str`, `nr`, `plz`, `ort`, `tel`, `mo`, `email`, `typ`, `comment`, `comment2` FROM `kunden` WHERE ((`kdnr` LIKE '%".$suchstring."%' OR `name` LIKE '%".$suchstring."%' OR `vorname` LIKE '%".$suchstring."%' OR `str` LIKE '%".$suchstring."%' OR `plz` LIKE '%".$suchstring."%' OR `ort` LIKE '%".$suchstring."%' OR `tel` LIKE '%".$suchstring."%' OR `mo` LIKE '%".$suchstring."%' OR `email` LIKE '%".$suchstring."%') AND `kdnr` > '1000') ORDER BY `kdnr` DESC;");
}
$result = mysqli_query($db_link,$sqlquery);
//printf("Error: %s\n", mysqli_error($db_link));
while ($row = mysqli_fetch_assoc($result)) {
// Ergebnis-Satz
print "Kundennummer: ".utf8_encode($row['kdnr'])."
";
print "Anrede: ".$row['anrede']."
";
if (($row['name'] <> "")) {
print "Name: ".utf8_encode($row['name'])."
";
}
if (($row['vorname'] <> "")) {
print "Vorname: ".utf8_encode($row['vorname'])."
";
}
if (($row['zusatz'] <> "")) {
$zusatz = utf8_encode($row['zusatz']);
$zusatz = str_replace("$%$","",$zusatz);
print "Zusatz: ".$zusatz."
";
}
print "Straße und Nr.: ".utf8_encode($row['str'])." ".utf8_encode($row['nr'])."
";
print "PLZ: ".utf8_encode($row['plz'])."
";
print "Ort: ".utf8_encode($row['ort'])."
";
if (($row['tel'] <> "")) {
$tel_show = utf8_encode($row['tel']);
$tel_link = str_replace(" ","",$tel_show);
$tel_link = str_replace(" / ","/",$tel_link);
$tel_link = "".$tel_link."";
print "Telefon: ".$tel_link."
";
// print "Telefon: ".$tel_show."
";
}
if (($row['mo'] <> "")) {
$tel_show = utf8_encode($row['mo']);
$tel_link = str_replace(" ","",$tel_show);
$tel_link = str_replace(" / ","/",$tel_link);
$tel_link = "".$tel_link."";
// print "Telefon 2: ".$tel_show."
";
print "Telefon 2: ".$tel_link."
";
}
if ($row['typ'] == '1') {
$kdtyp = "Standard";
} elseif ($row['typ'] == '2') {
$kdtyp = "Standard gewerblich";
} elseif ($row['typ'] == '3') {
$kdtyp = "Rabatt-Vereinbarung";
} elseif ($row['typ'] == '4') {
$kdtyp = "!!! GESPERRT !!!";
}
print "Kundentyp: ".$kdtyp."
";
if (($row['email'] <> "")) {
print "Email: ".utf8_encode($row['email'])."
";
}
if (($row['comment'] <> "")) {
print "Kommentar: ".utf8_encode($row['comment'])."
";
}
if (($row['comment2'] <> "")) {
print "Kommentar (intern): ".utf8_encode($row['comment2'])."
";
}
if (($row['str'] <> "")) {
print "
Öffnen in:";
print "Google Maps";
print " ";
print "Apple Karten
";
}
print "
";
print "
";
// Ende Ergebnis-Satz
print "
";
$s = $s+1;
}
mysqli_free_result($result);
} else {
die('Keine Verbindung möglich: ' . mysqli_error());
}
}
?>