PHP + POP up in a new window

Status
Not open for further replies.

ADZ

Fully Optimized
Messages
2,231
Hello all,
I have googled this and there are resources out there...but im not too sure why they are not working for me.

When I hit Submit, I want the results to open up in a new window maybe 400 by 600. I have tried numerous things, but they dont like me. Can anyone suggest a solution?

Thanks.

<?php

// Whois.php
// Retrieves whois information about domain names
// Peter Loh

$whois = array (
".com" => array ("type" => "Commercial", "server" => "whois.internic.net"),
".net" => array ("type" => "Network", "server" => "whois.internic.net"),
".org" => array ("type" => "Organisation", "server" => "whois.internic.net"),
".edu" => array ("type" => "Education", "server" => "whois.internic.net"),
".gov" => array ("type" => "Government", "server" => "whois.nic.gov"),
".biz" => array ("type" => "Business", "server" => "whois.pacificroot.com"),
".name" => array ("type" => "Name", "server" => "whois.nic.name"),
".info" => array ("type" => "Information", "server" => "whois.afilias.info"),
".au" => array ("type" => "Australia", "server" => "whois.ausregistry.net"),
".ca" => array ("type" => "Canada", "server" => "whois.cira.ca"),
".de" => array ("type" => "Germany", "server" => "whois.denic.de"),
".dk" => array ("type" => "Denmark", "server" => "whois.dk-hostmaster.dk"),
".fr" => array ("type" => "France", "server" => "whois.nic.fr"),
".ru" => array ("type" => "Russia", "server" => "whois.ripn.net"),
".uk" => array ("type" => "United Kingdom", "server" => "whois.nic.uk"),
".us" => array ("type" => "United States", "server" => "whois.us"),
);

echo "<HTML>\n";
echo "<HEAD>\n";
echo " <TITLE>Whois</TITLE>\n";
echo "</HEAD>\n\n";
echo "<BODY>\n";
echo ' <FORM METHOD="POST" ACTION="', "{$PHP_SELF}", '" >', "\n";
echo ' Domain: <INPUT TYPE="text" NAME="domain" VALUE="', "{$domain}", '" SIZE="30">', "\n";
echo ' <INPUT TYPE="submit" VALUE="Lookup">', "\n";
echo ' </FORM>';

if (!empty ($domain))
{
echo '
', "\n", '<HR NOSHADE>', "\n";

$tld = explode (".", $domain);
$tld = "." . $tld[count($tld)-1];
if (!array_key_exists ($tld, $whois))
{
die ("This script currently does not support the {$tld} TLD.");
}

ob_start();
system ("whois -h {$whois[$tld]["server"]} {$domain}");
$whoisdata = ob_get_contents();
ob_end_clean();

print_r (eregi_replace ("\n", "
\n", $whoisdata));
}

echo ' </BODY>', "\n", '</HTML>', "\n";
?>
 
have you tried <form ...blahblahblah... target=newwindow onSubmit=window.open ("{$PHP_SELF}", "newwindow", config="height=600, width=400")>
 
ok, that worked...BUT...what I want it to do is JUST display the results on a new page (not the rest of the website) is that possible?
I want the rest of the page to stay as it is, but the results of the whois to pop up in a new window.

Thanks.
 
sure it is... just do this
if ($_SERVER['REQUEST_METHOD']=='GET') {
/*every thing except result*/
}
elseif ($_SERVER['REQUEST_METHOD']=='POST') {
/*just the result*/
}
 
Im afraid that is a little out of my league.

I am not too sure where to put this?

Thanks for your help Harold!
 
for example you have a form on that page, and after the user click submit, there should be a window popped up with the same page but it displays the result rather than the form.

<?php
if ($_SERVER['REQUEST_METHOD']=='GET') {
?>
<form action="{$PHP_SELF}" method="post">
wtf: <input type=text name="wtf" value="what the ****">
<input type="submit">
</form>
<?php
}
elseif ($_SERVER['REQUEST_METHOD']=='POST') {
$wtf=$_POST['wtf'];
echo $wtf;
}
?>
 
<?php

// Whois.php
// Retrieves whois information about domain names
// Peter Loh

if ($_SERVER['REQUEST_METHOD']=='GET') {
?>
<HTML>
<HEAD>
<TITLE>Whois</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="<?php echo $PHP_SELF; ?>" target=newwindow onSubmit=window.open ("<?php echo $domain; ?>", "newwindow", config="height=600, width=400")>
Domain: <INPUT TYPE="text" NAME="domain" VALUE="{$domain}" SIZE="30">
<INPUT TYPE="submit" VALUE="Lookup">
</FORM>


<?php
}
elseif ($_SERVER['REQUEST_METHOD']=='POST') {
$whois = array (
".com" => array ("type" => "Commercial", "server" => "whois.internic.net"),
".net" => array ("type" => "Network", "server" => "whois.internic.net"),
".org" => array ("type" => "Organisation", "server" => "whois.internic.net"),
".edu" => array ("type" => "Education", "server" => "whois.internic.net"),
".gov" => array ("type" => "Government", "server" => "whois.nic.gov"),
".biz" => array ("type" => "Business", "server" => "whois.pacificroot.com"),
".name" => array ("type" => "Name", "server" => "whois.nic.name"),
".info" => array ("type" => "Information", "server" => "whois.afilias.info"),
".au" => array ("type" => "Australia", "server" => "whois.ausregistry.net"),
".ca" => array ("type" => "Canada", "server" => "whois.cira.ca"),
".de" => array ("type" => "Germany", "server" => "whois.denic.de"),
".dk" => array ("type" => "Denmark", "server" => "whois.dk-hostmaster.dk"),
".fr" => array ("type" => "France", "server" => "whois.nic.fr"),
".ru" => array ("type" => "Russia", "server" => "whois.ripn.net"),
".uk" => array ("type" => "United Kingdom", "server" => "whois.nic.uk"),
".us" => array ("type" => "United States", "server" => "whois.us"),
);


if (!empty ($domain))
{
echo '
', "\n", '<HR NOSHADE>', "\n";

$tld = explode (".", $domain);
$tld = "." . $tld[count($tld)-1];
if (!array_key_exists ($tld, $whois))
{
die ("This script currently does not support the {$tld} TLD.");
}

ob_start();
system ("whois -h {$whois[$tld]["server"]} {$domain}");
$whoisdata = ob_get_contents();
ob_end_clean();

print_r (eregi_replace ("\n", "
\n", $whoisdata));
}

echo ' </BODY>', "\n", '</HTML>', "\n";
}
?>
 
Status
Not open for further replies.
Back
Top Bottom