Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2009, 11:33
mega0079
 
Fecha de Ingreso: agosto-2008
Mensajes: 272
Antigüedad: 15 años, 9 meses
Puntos: 1
formulario register globals off

hola lo que sucede es que quiero hacer un formulario, pero mi host tiene los register globals off y pues bueno no jala mi fomulario, segun creo debo cambiar el nombre a algunas variables, pero no se como, me ayudarian porfavor, el formulario es el siguiente

en contact.php
Código:
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTMLExtensible HyperText Markup Language 1.0 Strict//EN"

        "http://www.w3.org/TR/xhtml1/DTDDocument Type Definition/xhtml1-strict.dtd">

   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">

        <head profile="http://gmpg.org/xfn/1">

                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

                <title>Formulario de Contacto</title>

                <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

                <script type="text/javascript">

                function stoperror(){

                        return true

                }

                window.onerror=stoperror

                </script>

                <link rel="stylesheet" type="text/css" href="style.css" media="screen" />

                </head>

                <body>
                

        <div id="contactform">
        

                <h1>Formulario de Contacto</h1>

                <form id="contact-form" method="post" onsubmit="return emailCheck(this.email.value);" action="email.php">

                                <fieldset>

                                <legend>Datos Personales &raquo;</legend>

                        <div>

                                <label for="visitorname">

                                        <span style="color:c00;">*</span>Nombre:

                                </label>

                                        <input type="text" name="name" id="visitorname" title="Tu Nombre" />

                                </div>

                                <div>

                                        <label for="visitorsurname">

                                                <span style="color:c00;">*</span>Apellidos:

                                        </label>

                                        <input type="text" name="surname" id="visitorsurname" title="Tu Apellido" />

                                </div>

                                <div>

                                        <label for="visitormail">

                                                <span style="color:c00;">*</span>Direcci&oacute;n de correo:

                                        </label>

                                <input type="text" name="email" id="visitormail" value="<?php echo $email; ?>" title="Tu dirección de correo" />

                        </div>

                        <div>

                                <label for="url">Página Web:</label>

                                        <input type="text" name="url" id="url" class="text" title="Tu página web" />

                                </div>

                           <div>

                                   <label for="phone">Teléfono:</label>

                                        <input type="text" name="phone" id="phone" class="text" title="Tu número de telefono" />

                                </div>

                        <div>

                                <label for="postcode">Codigo Postal:</label>

                                <input type="text" name="postcode" id="postcode" class="text" title="El codigo postal de tu localidad" />

                        </div>

                        <div>

                                <input type="submit" id="submit" name="send" value="Enviar &raquo;" title="Pulsa una vez para enviar el mensaje, y espera a la pantalla de confirmación" />

                        </div>

                </fieldset>

                <fieldset>

                <legend>Envianos tu Mensaje &raquo;</legend>

                        <div>

                           <label for="subject">

                                <span style="color:c00;">*</span>Motivo del mensaje:

                           </label>

                        <input type="text" name="sub" id="subject" title="El motivo de tu mensaje" />

                </div>

                <div>

                        <label for="notes">

                                <span style="color:c00;">*</span>Cuerpo del Mensaje:

                        </label>

                        <textarea name="text" id="notes" rows="" cols="" onkeyup="val=this.value; if (val.length > 800) { alert('Lo siento, has sobrepasado el limite de 800 caracteres'); this.value = val.substring(0,800); }  this.form.count.value=800-parseInt(this.value.length); "><?php echo $text; ?></textarea>

                </div>

                <div>

                        <label for="count">Caracteres disponibles:</label>

                                <input type="text" name="count" id="counter" value="800" size="2" />

                                <?php $text_len = preg_match_all('/./', $str, $dummy); ?>

                        </div>

                </fieldset>

           </form>

                <p><span style="color:c00;">*</span>Campos Obligatorios</p>

                <p><span style="color:red;font-weight:bold;"><?php echo $error ?></span></p>

                <script type="text/javascript" src="var.js"></script>

                </div>

   </body>

   </html>
en send.php

Código:
<?php

        if (empty($name)) $error .= "No has introducido tu nombre";

        if (empty($surname)) $error .= "No has introducido tu apellido";

        if (empty($email)) $error .= "No has introducido tu dirección de e-mail";

        if (empty($sub)) $error .= "No has introducido un titulo para el mensaje";

        if (empty($text)) $error .= "No has escrito nada en el cuerpo del mensaje<br/>";

        $str = $text;

        $text_len = strlen($str);

        if($text_len > 800) {

            $error .= "Lo siento, has superado el maximo de 800 caracteres en el cuerpo del mensaje. El numero total de caracteres es $text_len - por favor, acorta tu mensaje.";

        }

        if($email) {

            if(isset($_POST['email'])) {

                if (preg_match('/^[-!$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i',trim($email))) {

                } else {

                    $error .= "Tu dirección de e-mail contiene un error.";

                }

                $ok = TRUE;

                $ok = eregi( "^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email,

      $check);

                $ok = getmxrr(substr(strstr($check[0], '@'), 1), $dummy);

                if($ok === false) {

                    $host = substr($email, strpos($email, '@') + 1);

                    if(gethostbyname($host) != $host) {

                        $ok = true;

                    }

                    if ($ok != true) {

                        $error .= "La dirección de e-mail no parece correcta, por favor, compruebalo";

                    }

                }

            }

        }

        if($error) {

            include("index.php");

        } else {

             include("email.php");

        }

    ?>