RE: store whois requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:is@think.nl]
Sent: Tuesday, September 16, 2003 4:27 PM
To: php-general@lists.php.net
Cc: php-db@lists.php.net
Subject:  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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux