<% //check_referer(); %> <% // TODO: Referer abtesten // function check_referer() { global $HTTP_GET_VARS; $dom=file("/u/web/delitz/branchen/domref"); foreach($dom as $val) { $val=chop($val); if (preg_match("/https?:\/\/([^\/]*)$val.*/i", $HTTP_GET_VARS[HTTP_REFERER])) $z=1; } if ($z!=1) include('refcheck.php'); } include('dbinfo.php'); $dbh = mysql_connect($dbhost,$dbuser,$dbpass) or die("Could not connect"); mysql_select_db($dbname, $dbh) or die("Could not select database"); // Branchenbezeichnung function getBranche() { global $HTTP_GET_VARS; $sth = mysql_query("select Branche from bbBranchen where BrNr='$HTTP_GET_VARS[br]'") or die("Query failed"); $branche = mysql_result($sth,0,"Branche"); /* Free resultset */ mysql_free_result($sth); return $branche; } %> <% if ($HTTP_GET_VARS[br] == "") { // keine Branche ausgewählt %> Wählen Sie bitte eine Branche aus. <% } else { %>
<%=getBranche();%>
<% // Verweise auf andere Branchen $sth = mysql_query("select Siehe, Branche from bbBrBr, bbBranchen where bbBrBr.BrNr='$HTTP_GET_VARS[br]' AND bbBrBr.Siehe = bbBranchen.BrNr") or die("Query failed"); while ($row = mysql_fetch_array($sth, MYSQL_ASSOC)) { %> siehe auch "> <%=$row["Branche"];%>
<% } /* Free resultset */ mysql_free_result($sth); %>
<% // Brancheneinträge selektieren $sth = mysql_query("select A.AdrNr, Name, Vorname, Ortsteil, Strasse, Nr, Ort, Telefon, Logo, EMail, URL, Plan, X, Y, EintragsTyp from bbAdrBr=B, bbAdressen=A where B.BrNr = '$HTTP_GET_VARS[br]' and B.AdrNr=A.AdrNr order by Ort, Name") or die("Query failed"); $num = mysql_numrows($sth); if ($num == 0) { %>

keine Einträge gefunden

<% } else { $vorwahl = ""; $ort = ""; $ortalt = ""; while ($row = mysql_fetch_array($sth, MYSQL_ASSOC)) { $ort = $row["Ort"]; if ($ort != $ortalt) { // Ortseintrag & Vorwahl anzeigen if ($ortalt != "") { %>
<% } $ortalt = $ort; $vorwahl = strtok($row["Telefon"],"-"); if (preg_match("/0130\|0165\|168\|0161\|0171\|0172\|0177/",$vorwahl)) { $vorwahl = " "; } %> <%=$ort%> (<%=$vorwahl%>)
<% } // Brancheneintrag aufbereiten $name = $row["Name"]; $vorname = $row["Vorname"]; $ortsteil = $row["Ortsteil"]; $strasse = preg_replace("/str\.$\| Str\.$\|-Str\.$/","-",$row["Strasse"]); $nr = $row["Nr"]; $tel = preg_replace("/$vorwahl-/","",$row["Telefon"]); $logo = $row["Logo"]; $email = $row["EMail"]; $plan = $row["Plan"]; $x = $row["X"]; $y = $row["Y"]; $typ = $row["EintragsTyp"]; $url = $row["URL"]; if ($url != "") { if (preg_match("/^http:/",$url) == 0) { $url = "/$url"; } } $adrNr = $row["AdrNr"]; $sthTxt = mysql_query("select * from bbAdrTxt where AdrNr = '$adrNr'") or die("Query failed"); $numTxt = mysql_numrows($sthTxt); if ($numTxt != 0 ) { $txt1 = mysql_result($sthTxt,0,"Txt1"); $txt2 = mysql_result($sthTxt,0,"Txt2"); $txt3 = mysql_result($sthTxt,0,"Txt3"); $txt4 = mysql_result($sthTxt,0,"Txt4"); $txt5 = mysql_result($sthTxt,0,"Txt5"); } /* Free resultset */ mysql_free_result($sthTxt); %> <% if ($typ == "B3") { %>
<% // Zusatztext anzeigen if ($numTxt != 0 ) { %> <% } %>
<% if ($logo != "") { %> <% if ($url != "") { %> <% } %> <% if ($url != "") { %> <% } %> <% } // logo %> <% if ($url != "") { %> <% } %> <%=$name%> <% if ($vorname != "") { %>
<%=$vorname%> <% } %> <% if ($url != "") { %>
<% } %>
<% if ($ortsteil != "") { %> <%=$ortsteil%>, <% } %> <%=$strasse%> <%=$nr%>
<%=$tel%> <% if ($email != "") { %>
E-Mail: <%=$email%> <% } if ($plan != "") { %>
Stadtplan <% } %>
<% if ($txt1 != "") { %> <%=$txt1%> <% } if ($txt2 != "") { %>
<%=$txt2%> <% } if ($txt3 != "") { %>
<%=$txt3%> <% } if ($txt4 != "") { %>
<%=$txt4%> <% } if ($txt5 != "") { %>
<%=$txt5%> <% } %>
<% } // Ende gestalteter Eintrag %> <% // ------------------------------------------------ // hervorgehobenen Brancheneintrag anzeigen %> <% if ($typ == "B2") { %>
<% if ($url != "") { %> <% } else { %> <% } %> <%=$name%> <%=$vorname%> <% if ($url != "") { %> <% } else { %> <% } %>
<% if ($ortsteil != "") { %> <%=$ortsteil%>, <% } %> <%=$strasse%> <%=$nr%>
<%=$tel%> <% if ($email != "") { %>
E-Mail: <%=$email%> <% } %>
<% } // Ende hervorgehobener Eintrag %> <% // ------------------------------------------------ // standard Brancheneintrag anzeigen %> <% if ($typ == "B1" || $typ == "") { %>
<%=$name%> <%=$vorname%> <% if ($ortsteil != "") { %> <%=$ortsteil%>, <% } %> <%=$strasse%> <%=$nr%> <%=$tel%>
<% } // Ende Standardeintrag %> <%} //for } /* Free resultset */ mysql_free_result($sth); /* Closing connection */ mysql_close($dbh); } %>