whois script not working in IE

Reply

Join Date: Oct 2006
Posts: 200
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

whois script not working in IE

 
0
  #1
Jul 14th, 2008
hi guys,

I found a simple whois script and intregrated it completely into my site before testing it on IE (oooops!) and it only works on firefox and safari. On IE the result text that should be written as a result of the below section of the code:
  1. if (eregi('No match',$result)) {
  2. echo 'Domain Name '.$_POST['domain'].' is free.';

dosnt show up... the script im using is below.

  1. <?
  2. if ($_POST['type']!="") define('TYPE', $_POST['type']); else define('TYPE', '');
  3. if ($_POST['domain']!="") define('DOMAIN', $_POST['domain']); else define('DOMAIN', '');
  4. // .com domains
  5. define('COM_SERVER', "rs.internic.net"); // server to lookup for domain name
  6. define('COM_NOMATCH', "No match"); // string returned by server if the domain is not found
  7. define('COM_INCLUDE', true); // include this domain in lookup
  8.  
  9. function search_form($error){
  10. echo $error;
  11. ?>
  12. <form name="whois" method="post" action="">
  13. <input name="domain" style="text-align:center" type="text" id="domain" value="Choose your domain!" />
  14. <input name="Search" type="submit" id="Search" value="Go!">
  15. </form>
  16. <?
  17. }
  18.  
  19. if($_REQUEST['Search']){
  20.  
  21. if($error){
  22. search_form($error);
  23. }
  24. else{
  25.  
  26. $ns = fsockopen('rs.internic.net',43);
  27. fputs($ns, $_POST['domain']."\r\n");
  28. $result = '';
  29.  
  30. while(!feof($ns)) $result .= fgets($ns,128);
  31. fclose($ns);
  32. if (eregi('No match',$result)) {
  33. echo 'Domain Name '.$_POST['domain'].' is free.';
  34. }
  35. else {
  36. echo 'Domain Name '.$_POST['domain'].' is not available.';
  37. }
  38. }
  39. }
  40. else{
  41. search_form($error);
  42. }
  43.  
  44. ?>

Any ideas why not?

Thanks for the help,

Max
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: whois script not working in IE

 
0
  #2
Jul 14th, 2008
Umm.. I tried this script. It worked only for www.yahoo.com (on both mozilla and firefox). It didn't work for www.microsoft.com , www.daniweb.com or even www.whois.net. I think something is wrong with the script.
Edit: It worked for www.msn.com
Last edited by nav33n; Jul 14th, 2008 at 3:34 pm.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 200
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: whois script not working in IE

 
0
  #3
Jul 14th, 2008
ah well i took out all of the irelavent information before posting it - for example at the moment if the whois dosnt find anything for a domain it will write a paypal add to basket button so i took all that out and in the process might have killed it a bit

here is an example of where the script is working:
http://www.economizerz.com/daniweb/w...iptexample.php

the full script im currently using is:

  1. <?
  2. if ($_POST['type']!="") define('TYPE', $_POST['type']); else define('TYPE', '');
  3. if ($_POST['domain']!="") define('DOMAIN', $_POST['domain']); else define('DOMAIN', '');
  4. // .com domains
  5. define('COM_SERVER', "rs.internic.net"); // server to lookup for domain name
  6. define('COM_NOMATCH', "No match"); // string returned by server if the domain is not found
  7. define('COM_INCLUDE', true); // include this domain in lookup
  8.  
  9. function search_form($error){
  10. echo $error;
  11. ?>
  12. <center><form name="whois" method="post" action="">
  13. <input name="domain" style="text-align:center" type="text" id="domain" value="Choose your domain!" onclick="clearwhois();" onblur="returnwhois()" />
  14. <input name="Search" type="submit" id="Search" value="Go!">
  15. </form></center>
  16. <?
  17. }
  18.  
  19. if($_REQUEST['Search']){
  20.  
  21. if($error){
  22. search_form($error);
  23. }
  24. else{
  25.  
  26. $ns = fsockopen('rs.internic.net',43);
  27. fputs($ns, $_POST['domain']."\r\n");
  28. $result = '';
  29.  
  30. $suffix = strstr($_POST['domain'], '.');
  31. if ($suffix == '.co.uk') $suffixprice = '3';
  32. if ($suffix == '.com') $suffixprice = '5';
  33. if ($suffix == '.net') $suffixprice = '8';
  34.  
  35. while(!feof($ns)) $result .= fgets($ns,128);
  36. fclose($ns);
  37. if (eregi('No match',$result)) {
  38. echo '<center><form name="whois" method="post" action="">
  39. <input name="domain" style="text-align:center" type="text" id="domain" value="Choose your domain!" onclick="clearwhois();" onblur="returnwhois()" />
  40. <input name="Search" type="submit" id="Search" value="Go!">
  41. </form>
  42.  
  43. <table border="0" cellpadding="0" cellspacing="3"><tr><th align="center" valign="middle" scope="col"><img src="../../images/other/tick.png"></tr><th align="center" valign="middle" scope="col">Domain Name '.$_POST['domain'].' is free.</tr></table><br /></form>
  44. <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  45. <input type="submit" value="Add to basket!">
  46. <input type="hidden" name="add" value="1">
  47. <input type="hidden" name="cmd" value="_cart">
  48. <input type="hidden" name="business" value="example@email.com">
  49. <input type="hidden" name="item_name" value="'.$_POST['domain'].'">
  50. <input type="hidden" name="amount" value="'.$suffixprice.'">
  51. <input type="hidden" name="item_number" value="">
  52. <input type="hidden" name="no_shipping" value="0">
  53. <input type="hidden" name="no_note" value="1">
  54. <input type="hidden" name="currency_code" value="GBP">
  55. <input type="hidden" name="lc" value="GB">
  56. <input type="hidden" name="bn" value="PP-ShopCartBF">
  57. </form>
  58. </center>
  59. ';
  60. }
  61. else {
  62. echo '<center><form name="whois" method="post" action="">
  63. <input name="domain" style="text-align:center" type="text" id="domain" value="Choose your domain!" onclick="clearwhois();" onblur="returnwhois()" />
  64. <input name="Search" type="submit" id="Search" value="Go!">
  65. </form>
  66.  
  67. <table border="0" cellpadding="0" cellspacing="3"><tr><th align="center" valign="middle" scope="col"><img src="../../images/other/cross.png"></tr><th align="center" valign="middle" scope="col">Domain Name '.$_POST['domain'].' is not available.</tr></table><br /></form></center>';
  68. }
  69. }
  70. }
  71. else{
  72. search_form($error);
  73. }
  74.  
  75. ?>

Max
Last edited by MaxMumford; Jul 14th, 2008 at 4:34 pm.
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: whois script not working in IE

 
0
  #4
Jul 14th, 2008
Nope. Still the same result. Maybe you would like to use this script
http://www.hotscripts.com/PHP/Script...ois/index.html (Max's Whois). I have tried it and it works like a charm!
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 200
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: whois script not working in IE

 
0
  #5
Jul 15th, 2008
Ah thanks for the new script. Im testing it all out but I do have one problem which is that I cant integrate a .co.uk domain suffix into it.

this is an example of the code used to check the .com suffix:

  1. $this->serverList[0]['top'] = 'com';
  2. $this->serverList[0]['server'] = 'whois.crsnic.net';
  3. $this->serverList[0]['response'] = 'No match for';
  4. $this->serverList[0]['check'] = true;

and this is what i wrote (at the end of the suffix list) to try and get .co.uk working

  1. $this->serverList[9]['top'] = 'co.uk';
  2. $this->serverList[9]['server'] = 'whois.nic.uk';
  3. $this->serverList[9]['response'] = 'No match for';
  4. $this->serverList[9]['check'] = false;

iv tried quite a few different servers and none of them work however i think the problem its the .uk section of it (presumerably the ".") because when I put .uk it works normally but obviously dosnt find a proper result. do you have any idea how to fix it? I think it might be more complicated than just adding my .co.uk section but i cant find any support from any of the websites holding the script or any other forums.

Thanks
(youv been helping me with web designing for AAAAGES now!! its MUCH appreciated )

Max

Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: whois script not working in IE

 
0
  #6
Jul 15th, 2008
Argh! You are right. Php doesn't like . in the names of form elements. It replaces . by _.
  1. <?php
  2. print_r($_POST);
  3. ?>
  4. <html>
  5. <body>
  6. <form method="post">
  7. <input type="text" name="some.name">
  8. <input type="submit" name="submit.1" value="submit">
  9. </form>
  10. </body>
  11. </html>
Hmm.. strange! Lets see if someone else has an idea !
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: whois script not working in IE

 
0
  #7
Jul 15th, 2008
Since "_" is an invalid character for a domain, does that mean that you will never have an underscore in the any of the form entity names?

if so, you could try this
  1. foreach($_POST as $key=>$value)
  2. {
  3. $_POST[str_replace("_", ".", $key)] = $value;
  4. }
  5. print_r($_POST);
  6. echo "<br />" . $_POST['.co.uk'];
it does work.
Last edited by R0bb0b; Jul 15th, 2008 at 2:59 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 200
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: whois script not working in IE

 
0
  #8
Jul 15th, 2008
Thanks r0bb0b and nav33n however im not quite sure what to do with the code.

presumerably i put it at the beginning of the php script to make sure that it changes all strings with an underscore to have full stops instead however im not sure what $key or $value are meant to be.

I have a domain name field called "domain" and checkboxes for domain suffixes to be checked called "top_". its the domain field where the underscores need to be changed to fullstops

thanks again
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: whois script not working in IE

 
0
  #9
Jul 15th, 2008
You know that there are two parts to an array cell(or what ever you want to call it) right?
array[0] = "red";
echo array[0] and get "red";

0 is the key.
"red" is the value.

so, you can do a foreach loop with just he value like this
  1. foreach($array as $value)
  2. {
  3. $value = "red";
  4. }
or with key and value
  1. foreach($array as $key=>$value)
  2. {
  3. $key = 0;
  4. $value = "red";
  5. }
Maybe that will help, ya?
You can stick it at the very top of the script and it will replace all "_" with "." in the $_POST names.
Last edited by R0bb0b; Jul 15th, 2008 at 10:13 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 200
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: whois script not working in IE

 
0
  #10
Jul 16th, 2008
Ahhh okay I see so it finds any array's where co_uk is written and converts it to co.uk

- i got a parse error:



  1. Parse error: syntax error, unexpected T_FOREACH, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/sites/economizerz.com/public_html/test/maxwhois/maxWhois.class.php on line 8

  1. <?php
  2.  
  3. class maxWhois{
  4.  
  5. var $serverList;
  6. var $tr = 0;
  7.  
  8. foreach($_POST as 9 = 'co_uk')
  9. {
  10. $_POST[str_replace("_", ".", $key)] = $value;
  11. }
  12. print_r($_POST);
  13.  
  14. echo "<br />" . $_POST['.co.uk'];

possibly my server is using an old version of php or something?
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC