PHP + POP up in a new window - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 08-20-2004, 12:08 PM   #1 (permalink)
ADZ
Master Techie
 
Join Date: May 2003
Posts: 2,231
Send a message via Yahoo to ADZ
Default PHP + POP up in a new window

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";
?>
__________________

ADZ is offline  
Old 08-21-2004, 10:40 PM   #2 (permalink)
Super Techie
 
Join Date: Dec 2003
Posts: 333
Send a message via AIM to Harold III
Default

have you tried <form ...blahblahblah... target=newwindow onSubmit=window.open ("{$PHP_SELF}", "newwindow", config="height=600, width=400")>
__________________

__________________
I do this for Aiur. NOT YOU.
Harold III is offline  
Old 08-24-2004, 11:50 AM   #3 (permalink)
ADZ
Master Techie
 
Join Date: May 2003
Posts: 2,231
Send a message via Yahoo to ADZ
Default

I didnt think to try it, hmm..it may work. Cheers mate.
ADZ is offline  
Old 08-26-2004, 10:21 AM   #4 (permalink)
ADZ
Master Techie
 
Join Date: May 2003
Posts: 2,231
Send a message via Yahoo to ADZ
Default

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.
ADZ is offline  
Old 08-26-2004, 04:36 PM   #5 (permalink)
Super Techie
 
Join Date: Dec 2003
Posts: 333
Send a message via AIM to Harold III
Default

sure it is... just do this
if ($_SERVER['REQUEST_METHOD']=='GET') {
/*every thing except result*/
}
elseif ($_SERVER['REQUEST_METHOD']=='POST') {
/*just the result*/
}
__________________
I do this for Aiur. NOT YOU.
Harold III is offline  
Old 08-27-2004, 11:29 AM   #6 (permalink)
ADZ
Master Techie
 
Join Date: May 2003
Posts: 2,231
Send a message via Yahoo to ADZ
Default

Im afraid that is a little out of my league.

I am not too sure where to put this?

Thanks for your help Harold!
ADZ is offline  
Old 08-27-2004, 06:39 PM   #7 (permalink)
Super Techie
 
Join Date: Dec 2003
Posts: 333
Send a message via AIM to Harold III
Default

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;
}
?>
__________________
I do this for Aiur. NOT YOU.
Harold III is offline  
Old 08-27-2004, 06:53 PM   #8 (permalink)
Super Techie
 
Join Date: Dec 2003
Posts: 333
Send a message via AIM to Harold III
Default

<?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";
}
?>
__________________

__________________
I do this for Aiur. NOT YOU.
Harold III is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 12:34 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.