Page MenuHomeDevCentral

No OneTemporary

diff --git a/network/mx.php b/network/mx.php
index 332150a..603dbce 100644
--- a/network/mx.php
+++ b/network/mx.php
@@ -1,51 +1,51 @@
<?php
$mail = '';
if (isset($_REQUEST['mail'])) {
$mail = $_REQUEST['mail'];
}
?>
<h2>Search</h2>
<form>
<div class="row collapse">
<div class="ten mobile-three columns">
<input type="text" name="mail" id="mail" value="<?= $mail ?>" placeholder="Enter e-mail address here." />
</div>
<div class="two mobile-one columns">
<input type="submit" class="button expand postfix" value="Search" />
</div>
</div>
</form>
<?php
function is_domain ($string) {
- return preg_match($string, '/[a-zA-Z\d-]{,63}(\.[a-zA-Z\d-]{,63})*/');
+ return preg_match('/[a-zA-Z\d-]{,63}(\.[a-zA-Z\d-]{,63})*/', $string);
}
function print_mx ($domain) {
if (getmxrr($domain, $mxhosts, $weights)) {
echo '<table id="mx" class="result">';
echo '<tr><th>Host</th><th>Weight</th></tr>';
$n = count($mxhosts);
for ($i = 0 ; $i < $n ; $i++) {
echo "<tr><td>$mxhosts[$i]</td><td>$weights[$i]</td></tr>";
}
echo '</table>';
} else {
echo '<p id="mx" class="result emptyresult">—</p>';
}
echo "<h3>Determination method</h3>\n<p><strong>DNS lookup:</strong> $domain MX ?</p>";
}
if ($mail) {
echo "<h2>Result</h2>\n<h3>MX records</h3>";
if (is_mail($mail)) {
//Gets domain name
$data = explode('@', $mail);
print_mx($data[1]);
} elseif (is_domain($mail)) {
//We silently accept direct domain entries given instead of a mail
print_mx($mail);
} else {
echo "<h3>Error</h3>\n<p class='error'>$mail isn't a valid mail address.</p>";
echo "<h3>Improve this tool</h3><p>This code is open source, you can improve it. Fork it and add JS validation mail code. If the mail is wrong, apply the class .error to the input box.</p>";
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Dec 26, 16:46 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2315276
Default Alt Text
(1 KB)

Event Timeline