This is some code I already use... you may wish to change the way you
retrieve you whois data.
Ryan

<html>
<head><title>Whois</title></head>
<body>
<form name=theform action="whois.php" method=post>
Hostname:  <input type=text name=host length=30>  <input type=submit>
</form>
<?php
//if a domain name was provided
if ($host) {

        //output the name of the host
        echo "<h3>$host</h3><pre>";
        //backwards tick marks will run this command on the server and echo's it
out to the screen
        echo `whois $host`;
        echo "</pre>";

        //get the timestamp and ip
        $timestamp = date("YmdHis");
        $ip = getenv(REMOTE_ADDR);

        //create your query
        $query = "insert into whois_log (domain, timestamp, ip) values (\"$host\",
\"$timestamp\", \"$ip\")";

        //run the query against the database with your variables for $server,
$username, and $password
        $db = mysql_connect($server,$username,$password);
        mysql_select_db("your_database",$db);
        if (!$result = @mysql_query($query,$db)){
                $error = mysql_error();
                print("Error Processing Query: $error<br>$query<br>");
        }
}
?>
<script>document.theform.host.focus()</script>
</body>
</html>

-----Original Message-----
From: IS [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 4:27 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] store whois requests


I want to store whois requests including the ip address and date/time
stamp into a file or MySQL database (a database is what I prefer to use)
for monitoring the PHP whois script. Anybody an idea of how I could do
this? I'm a beginner in PHP so any help is welcome.

--IS

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to