Foros del Web » Programando para Internet » PHP »

Buscador de dominios

Estas en el tema de Buscador de dominios en el foro de PHP en Foros del Web. Hola , soy algo nuevo en esto del php y necesito de su ayuda con un buscador de dominios que tengo, el detalle es el ...
  #1 (permalink)  
Antiguo 09/05/2005, 12:25
Avatar de cocytech  
Fecha de Ingreso: junio-2003
Ubicación: Tuxtla Gutierrez, Chiapas
Mensajes: 16
Antigüedad: 20 años, 10 meses
Puntos: 0
Información Buscador de dominios

Hola , soy algo nuevo en esto del php y necesito de su ayuda con un buscador de dominios que tengo, el detalle es el siguiente, ya lo tengo hecho (whois), pero en una pagina que tiene los campos donde se pone el nombre del dominio, un selec, donde se selecciona el tipo de dominio y un cuadro de texto que me despilega el resultado,lo que quiero hacer es poner ese buscador en mi pagina principal (solo el input del dominio, el select y el boton de envio)y de ahi enviar los resultados a la pagina que ya tengo hecha (donde ya desplegaria los resultados y daria la opcion de buscar otro dominio, si asi se requisiera), , por que no se como llamar a otra pagina para que me muestre los resultados ahi toda ayuda sera agradecida
__________________
No hay peor lucha que la que no se hace, ni mejor victoria que la propia.
  #2 (permalink)  
Antiguo 09/05/2005, 13:09
 
Fecha de Ingreso: agosto-2004
Mensajes: 349
Antigüedad: 19 años, 7 meses
Puntos: 3
si pones el código facilitarás que te puedan responder de manera precisa
  #3 (permalink)  
Antiguo 10/05/2005, 10:48
Avatar de cocytech  
Fecha de Ingreso: junio-2003
Ubicación: Tuxtla Gutierrez, Chiapas
Mensajes: 16
Antigüedad: 20 años, 10 meses
Puntos: 0
el codigo

tengo 2 archivos el primero se llama config.inc.php y tiene lo siguiente:
Código PHP:
<?php
error_reporting
(0);
$config['domain']['extensions'] = array (

'com','net','org','biz','info','com.mx','gob.mx'

);

$config['domain']['purchase_url'] = 'http://www.maximared.com.mx/dominios/registro.html';

$config['domain']['purchase_text'] = '<a href="'.$config['domain']['purchase_url'].'"> Clic para registrar su dominio {DOMAIN}!</a>';

$config['domain']['available_text'] = '{DOMAIN} se encuentra disponible!';

$config['domain']['whois_results'] = 1;

$config['domain']['unavailable_text'] = '{DOMAIN} no se encuentra disponible!';

$config['domain']['log_whois'] = 1;

$config['domain']['whois_log_location'] = 'whois.log';

$config['user']['admin_email'] = '[email protected]';

$message['error']['no_query_file']  = '<span class="message"><b>Fatal Error:</b> Los archivos requeridos no han sido encontrados enel directorio. Por favor contacte al <a href="mailto:'.$config['user']['admin_email'].'">adminitrador.</a></span>';

$message['error']['lessthan3']      = '<span class="message">Es necesario escribir un dominio, por favor intentelo nuevamente.</span>';

$message['error']['hyphens']        = '<span class="message">The domain name can not start or end with a hyphen.</span>';

$message['error']['characters']     = '<span class="message">The domain may only contain alpha-numeric characters and hyphens.</span>';

$message['error']['open_log_file']  = '<span class="message">Whois was unable to open the log file. Check it is in the same directory as this file and try again.</span>';

$message['error']['perms_log_file'] = '<span class="message">The log file has not been set to the correct permissions (666). Please CHMOD the file and try again.</span>';

?>
el segundo archivo se llama core.inc.php y tiene lo siguiente:

Código PHP:
<?php
error_reporting
(E_ALL);

function 
formExtensions (){
    global 
$config;
    foreach (
$config['domain']['extensions'] as $tld){
        echo 
'<option value="'.$tld.'">'.$tld.'</option>';
    }
}

function 
showPrevious (){
   if (isset(
$_POST['domainForm'])){
       echo 
$_POST['domainForm'];
   }
}

function 
whoisLog ($domain){
    global 
$message$config;
    if (@
is_writable($config['domain']['whois_log_location'])){
    if (!
$fp = @fopen($config['domain']['whois_log_location'], 'a')){
        echo 
$message['error']['open_log_file'];
    }
    @
fwrite($fpdate('Y-m-d @ H:i:s').' - '.$domain."\r\n");
    @
fclose($fp);
    } else {
        echo 
$message['error']['perms_log_file'];
    }
}

function 
domainResults (){
    global 
$config$message;
if (isset(
$_POST['submitForm']) && $_POST['submitForm'] == 'Check'){

    if (
strlen($_POST['domainForm']) < 3){
        echo 
$message['error']['lessthan3'];
        exit();
    } elseif (
ereg("^-|-$"$_POST['domainForm'])){
        echo 
$message['error']['hyphens'];
        exit();
    } elseif (!
ereg("([a-z]|[A-Z]|[0-9]|-){".strlen($_POST['domainForm'])."}"$_POST['domainForm'])){
        echo 
$message['error']['characters'];
        exit();
    } else {

        if (
file_exists('queries.inc.php')){
            require_once(
'queries.inc.php');
        } else {
            exit(
$message['error']['no_query_file']);
        }

        
$domain $_POST['domainForm'].'.'.$_POST['extForm'];
        
$ns fsockopen($server43); fputs($ns"$domain\r\n");
        
$result '';
        while(!
feof($ns)) $result .= fgets($ns128); fclose($ns);
            if (
eregi($error$result)){
                
// Domain is available.
                
if ($config['domain']['purchase_url'] != ''){
                
$output str_replace('{DOMAIN}'$domain$config['domain']['available_text']);
                
$output .= str_replace('{DOMAIN}'$domain$config['domain']['purchase_text']);
            } else {
                 
$output str_replace('{DOMAIN}'$domain$config['domain']['available_text']);
            }
            echo 
$output;
            } else {
                
// Domain is unavailable.
                
if ($config['domain']['whois_results'] == 1){
                    
$output str_replace('{DOMAIN}'$domain$config['domain']['unavailable_text']);
                    echo 
$output;
                    echo 
'<pre>';
                    
$fp fsockopen($server43);
                    
fputs($fp"$domain\r\n");
                    while(!
feof($fp)){
                        echo 
fgets($fp128);
                    }
                    
fclose($fp);
                    echo 
'</pre>';

                } else {
                    
$output str_replace('{DOMAIN}'$domain$config['domain']['unavailable_text']);
                    echo 
$output;
                }
            }
            if (
$config['domain']['log_whois'] == 1){
            
whoisLog($domain);
            }
        }
    }
}

?>
y la pagina de la que lamo la funcion tiene el siguiente codigo (index.html):

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Máxima Red México :: Buscdor de dominios ::</title>
<script type="text/javascript" language="Javascript">
function focus(){ document.whoisForm.domainForm.focus(); }
</script>
</head>

<body onload="focus()">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0" class="mainTable">
  <tr>
  </tr>
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" class="whoisInfo">
      <tr>
        <td colspan="4" align="center" valign="middle" class="whoisInfo">Por favor escriba el nombre del dominio a registrar y seleccione una extensión. </td>
        </tr>
      <tr>
        <td colspan="4" align="center" valign="middle" class="genHeader"><form name="whoisForm" id="whoisForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
          <input name="domainForm" type="text" id="domainForm" value="<?php showPrevious(); ?>" />
          <select name="extForm" id="extForm">
            <?php /* This shows the domain extensions in the drop-down box. */ formExtensions(); ?>
          </select>
          <input name="submitForm" type="submit" id="submitForm" value="Check" />
        </form></td>
      </tr>
      <tr>
        <td colspan="4" align="left" valign="top" class="genHeader">
        <div name="whoisResults" style="border: solid 1px #CCCCCC; padding: 2px 2px 2px 2px; width:722px; height:325px; overflow-y: scroll; overflow: -moz-scrollbars-vertical">
        <?php /* This shows the domain available/unavailable message, and the whois results. */ domainResults(); ?>
        </div>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30" align="center" valign="middle" class="mainFooter">&copy; 1999-2005 Máxima Red México. Todos los derechos reservados.</td>
  </tr>
</table>
</body>
</html>
lo que quiero hacer es poner el form de esta pagina (sin el div que muestra los resultados) en mi pagina principal y de ahi llamar a esta pagina donde se mostraran los resultados y tiene la opcion de seguir realizando la busqueda, espero que puedan ayudarme, gracias.
__________________
No hay peor lucha que la que no se hace, ni mejor victoria que la propia.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:42.