Пример #1
0
<form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
<p><b><label for="domain">Domain/IP Address:</label></b> <input type="text" name="domain" id="domain" value="<?php 
echo $domain;
?>
"> <input type="submit" value="Lookup"></p>
</form>
<?php 
if ($domain) {
    $domain = trim($domain);
    if (substr(strtolower($domain), 0, 7) == "http://") {
        $domain = substr($domain, 7);
    }
    if (substr(strtolower($domain), 0, 4) == "www.") {
        $domain = substr($domain, 4);
    }
    if (ValidateIP($domain)) {
        $result = LookupIP($domain);
    } elseif (ValidateDomain($domain)) {
        $result = LookupDomain($domain);
    } else {
        die("Invalid Input!");
    }
    echo "<pre>\n" . $result . "\n</pre>\n";
}
?>
</body>
</html>
<?php

$domain = $_POST['domain'];
ValidateDomain($domain);
function ValidateDomain($domain)
{
    if (!preg_match("/^([-a-z0-9]{2,100})\\.([a-z\\.]{2,8})\$/i", $domain)) {
        echo '<div class="alert alert-success">';
        die("<strong>Domain invalid !</strong> Please use domain name without slash or http: (example : mydomain.com) ");
        echo '</div>';
    }
    return $domain;
}
?>


<?php 
session_start();
require_once "../../config.php";
date_default_timezone_set("America/New_York");
$con = new MongoClient();
if ($_SESSION["sessemail"]) {
    if ($con) {
        $db = $con->{$users};
        $selection = $db->{$myusers};
        $document = array("email" => $_SESSION["sessemail"]);
        $result = $selection->findOne($document);
        if ($result) {
            //echo "<h1> SESSION EMAIL : $email</h1>";
            //echo "<h1> SESSION PASS  : $password</h1>";
        } else {