Bin neu hier und hoffe, dass ich hier eine hilfsreichere Antwort erhalte als in einem anderen Forum, dort hat mir niemand weiter helfen können.
Ich habe eine Abfrage aus einer DB. Die funktioniert, wenn ich sie zu oberst hin platziere. Platziere ich sie aber an die stelle wo jetzt "hier sollte xxxx stehen", so funktioniert der ganze script nicht mehr. kann mir ev. jemand sagen warum.
Ansicht des ergebnis (funktionier) http://test.sonne.goip.de/index.php
Ansicht des ergebnis (funktioniert nicht) http://test.sonne.goip.de/index1.php
Preisabfrage:
$SQL0 = "SELECT * FROM dsp where (dscode like '$tld'"; $SQL0R = odbc_exec($conn, $SQL0); while($SQL0Z = odbc_fetch_array($SQL0R)) { echo $SQL0Z["dendung"]; echo $SQL0Z["dpreis"]; }
<html><body><table border="0"><tr><td width="140">Domain</td><td width="70">Status</td><td>Info</td></tr> <?php include_once("servers.php"; $domain = $_POST['domain']; $tld = $_POST['tld']; $_DSN ="dbserver"; $_User = "dbuser"; $_PW = "dbpass"; $conn = odbc_connect($_DSN, $_User, $_PW) or die("Verbindung fehlgeschlagen"; $SQL0 = "SELECT * FROM dsp where (dscode like '$tld'"; $SQL0R = odbc_exec($conn, $SQL0); while($SQL0Z = odbc_fetch_array($SQL0R)) { echo $SQL0Z["dendung"]; echo $SQL0Z["dpreis"]; } if(!headers_sent()) header("Content-Type: text/html; charset=UTF-8"; if(!isset($_SESSION)) session_start(); function check_domain($domain, $tld, $whoisserver) { $fp = @fsockopen($whoisserver, 43, $errno, $errstr, 5); if(!$fp) return "<strong>Fehler</strong><br />".$errstr." (".$errno."n"; else { if($tld != "de" && !preg_match("/^[a-zA-Z0-9-]*$/", $domain)) { try { require_once("idna2.php"; $idn = Net_IDNA2::getInstance(); $domain = $idn->encode($domain); } catch(Exception $e) { return "<strong>Fehler</strong><br />".$e->getMessage()."n"; } } $flag = ""; if($tld == "de" $flag = "-T dn "; fwrite($fp, $flag.$domain.".".$tld."rn"; $string = ""; while(!feof($fp)) $string .= fread($fp, 128); fclose($fp); return $string; } } if(!preg_match("/^[^_./]{1,}$/", $domain)) echo "<span class="error">nungültiger Domainname</span>n"; else { function print_domain($domain, $tld, $whoisservers) { global $limit_exceeded; $status_free = "not found|no match|nothing found|not have an entry|status: available|is free|status: free|no entries|no such domain"; $status_invalid = "status: invalid|invalid pattern|not a valid domain|invalid request|not understand the query|"; $status_invalid .= "error for|invalid domain|invalid characters|idn unsupported|unassignable|currently restricted|not allowed|invalid parameter"; $status_limit = "limit exceeded"; $string = check_domain($domain, $tld, $whoisservers[$tld]); preg_match_all("/Whois Server: (.*?)n/i", $string, $matches); if(isset($matches[1][0]) && trim($matches[1][0]) != "" $string = check_domain($domain, $tld, $matches[1][0]); if(preg_match("/Fehler/", $string)) { echo "<tr><td width="1400">".$domain.".".$tld."</td><td width="70" class="error">Fehler</td>"; echo "<td><a href="popup.php?tld=".$tld."" onclick="window.open('popup.php?tld=".$tld."','Details','width=800,height=600,scrollbars=yes'; return false">Details</a></td>"; echo "</tr>n"; $_SESSION['details'][$tld] = $string; } else { if(preg_match("/".$status_free."/i", preg_replace("/ss+|t/", " ", $string))) echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70"class="success">ist frei!</td><td>n"; if ($tld =='at' echo 'hier sollte at22.90 stehen'; elseif(preg_match("/".$status_invalid."/i", $string)) echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">ungültig</td></tr>n"; elseif(preg_match("/".$status_limit."/i", $string)) { echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">Abfragelimit erreicht *</td></tr>n"; $limit_exceeded = true; } else { echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">ist belegt</td><td>"; echo "<a href="popup.php?tld=".$tld."" onclick="window.open('popup.php?tld=".$tld."','Details','width=800,height=600,scrollbars=yes'; return false">Inhaber ist</a>"; echo "</td></tr>n"; $_SESSION['details'][$tld] = "<pre>n".$string."</pre>"; } } } $limit_exceeded = false; echo "<table class="list">n"; if($tld == "all" { foreach($whoisservers as $tld_ => $value) print_domain($domain, $tld_, $whoisservers); } else print_domain($domain, $tld, $whoisservers); echo "</table>n"; if($limit_exceeded) echo "<span>(* Bitte versuchen Sie es in ein paar Minuten erneut)</span>n"; } ?> </table><body><html>
<html><body><table border="0"><tr><td width="140">Domain</td><td width="70">Status</td><td>Info</td></tr> <?php include_once("servers.php"; $domain = $_POST['domain']; $tld = $_POST['tld']; $_DSN ="dbserver"; $_User = "dbuser"; $_PW = "dbpass"; $conn = odbc_connect($_DSN, $_User, $_PW) or die("Verbindung fehlgeschlagen"; if(!headers_sent()) header("Content-Type: text/html; charset=UTF-8"; if(!isset($_SESSION)) session_start(); function check_domain($domain, $tld, $whoisserver) { $fp = @fsockopen($whoisserver, 43, $errno, $errstr, 5); if(!$fp) return "<strong>Fehler</strong><br />".$errstr." (".$errno."n"; else { if($tld != "de" && !preg_match("/^[a-zA-Z0-9-]*$/", $domain)) { try { require_once("idna2.php"; $idn = Net_IDNA2::getInstance(); $domain = $idn->encode($domain); } catch(Exception $e) { return "<strong>Fehler</strong><br />".$e->getMessage()."n"; } } $flag = ""; if($tld == "de" $flag = "-T dn "; fwrite($fp, $flag.$domain.".".$tld."rn"; $string = ""; while(!feof($fp)) $string .= fread($fp, 128); fclose($fp); return $string; } } if(!preg_match("/^[^_./]{1,}$/", $domain)) echo "<span class="error">nungültiger Domainname</span>n"; else { function print_domain($domain, $tld, $whoisservers) { global $limit_exceeded; $status_free = "not found|no match|nothing found|not have an entry|status: available|is free|status: free|no entries|no such domain"; $status_invalid = "status: invalid|invalid pattern|not a valid domain|invalid request|not understand the query|"; $status_invalid .= "error for|invalid domain|invalid characters|idn unsupported|unassignable|currently restricted|not allowed|invalid parameter"; $status_limit = "limit exceeded"; $string = check_domain($domain, $tld, $whoisservers[$tld]); preg_match_all("/Whois Server: (.*?)n/i", $string, $matches); if(isset($matches[1][0]) && trim($matches[1][0]) != "" $string = check_domain($domain, $tld, $matches[1][0]); if(preg_match("/Fehler/", $string)) { echo "<tr><td width="1400">".$domain.".".$tld."</td><td width="70" class="error">Fehler</td>"; echo "<td><a href="popup.php?tld=".$tld."" onclick="window.open('popup.php?tld=".$tld."','Details','width=800,height=600,scrollbars=yes'; return false">Details</a></td>"; echo "</tr>n"; $_SESSION['details'][$tld] = $string; } else { if(preg_match("/".$status_free."/i", preg_replace("/ss+|t/", " ", $string))) echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70"class="success">ist frei!</td><td>n"; //Hier soll der Script Preisabfrage funktionieren. $SQL0 = "SELECT * FROM dsp where (dscode like '$tld'"; $SQL0R = odbc_exec($conn, $SQL0); while($SQL0Z = odbc_fetch_array($SQL0R)) { echo $SQL0Z["dpreis"]; } elseif(preg_match("/".$status_invalid."/i", $string)) echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">ungültig</td></tr>n"; elseif(preg_match("/".$status_limit."/i", $string)) { echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">Abfragelimit erreicht *</td></tr>n"; $limit_exceeded = true; } else { echo "<tr><td width="140">".$domain.".".$tld."</td><td width="70" class="error">ist belegt</td><td>"; echo "<a href="popup.php?tld=".$tld."" onclick="window.open('popup.php?tld=".$tld."','Details','width=800,height=600,scrollbars=yes'; return false">Inhaber ist</a>"; echo "</td></tr>n"; $_SESSION['details'][$tld] = "<pre>n".$string."</pre>"; } } } $limit_exceeded = false; echo "<table class="list">n"; if($tld == "all" { foreach($whoisservers as $tld_ => $value) print_domain($domain, $tld_, $whoisservers); } else print_domain($domain, $tld, $whoisservers); echo "</table>n"; if($limit_exceeded) echo "<span>(* Bitte versuchen Sie es in ein paar Minuten erneut)</span>n"; } ?> </table><body><html>
Kommentar