Foros del Web » Programando para Internet » PHP »

Error en PHP...

Estas en el tema de Error en PHP... en el foro de PHP en Foros del Web. Tengo un problema, tengo este codigo que me permite enviar un formulario a una base de datos MySQL. Los datos son enviados bien pero me ...
  #1 (permalink)  
Antiguo 08/06/2007, 19:06
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Error en PHP...

Tengo un problema, tengo este codigo que me permite enviar un formulario a una base de datos MySQL.

Los datos son enviados bien pero me sale el siguiente error :

Código PHP:
[B]WarningCannot modify header information headers already sent in datos.php on line 54[/B
datos.php esta con codigo 777

Le dejo el codigo para ver si me pueden ayudar...

Código PHP:
<?php virtual('/Connections/datos.php'); ?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
  #2 (permalink)  
Antiguo 08/06/2007, 19:44
Avatar de demiurgo_daemon  
Fecha de Ingreso: diciembre-2006
Ubicación: Querétaro
Mensajes: 184
Antigüedad: 17 años, 4 meses
Puntos: 2
Re: [B]Error en PHP... Ayuda[/B]

Hola,

header debe ser llamado antes de enviar cualquier salida al cliente.

Código PHP:
<?php virtual('/Connections/datos.php'); ?>
Si el archivo que incluyes tiene código de salida i.e. HTML, ahí está tu error; esto debe ser llamado después de header. El manual de PHP tiene información al respecto.

saludos
  #3 (permalink)  
Antiguo 08/06/2007, 19:55
Avatar de hectorejch  
Fecha de Ingreso: junio-2005
Ubicación: Argentina
Mensajes: 172
Antigüedad: 18 años, 10 meses
Puntos: 2
Re: [B]Error en PHP... Ayuda[/B]

eso lo solucionas, como dice en el manual con las funciones ob_start(), y la funcion ob_end_flush()
__________________
"El Reino de Dios no consiste en palabras, sino en poder"
  #4 (permalink)  
Antiguo 08/06/2007, 20:31
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

Gracias por la respuesta, la verdad no se que estan respondiendo ya que soy nuevo en PHP y MySQL.

El problema que tengo es que despues de que envia los datos al formulario me deveria enviar a la pagina datosok.php pero no lo hace...

Ojala pudieran revisar eso...

Gracias
  #5 (permalink)  
Antiguo 08/06/2007, 20:43
Avatar de hectorejch  
Fecha de Ingreso: junio-2005
Ubicación: Argentina
Mensajes: 172
Antigüedad: 18 años, 10 meses
Puntos: 2
Re: [B]Error en PHP... Ayuda[/B]

Precisamente eso, que ya enviaste datos del formulario, y una vez que enviaste los datos PHP no te permite redirigir la página (PHP 5), para poder hacer eso tienes que usar las funciones que te dije arriba, esto maneja una buferes de salida, con lo cual puedes redireccionar en cualquier momento tu pagina, hayas o no enviado la información
__________________
"El Reino de Dios no consiste en palabras, sino en poder"
  #6 (permalink)  
Antiguo 08/06/2007, 21:45
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

Estimado Hector....

Disculpa si soy tan weon... pero nececito que me expliques en detalle que tengo que hacer....quizas te suene un poco patudo ,pero si puedes arreglar el codigo de arriba y pegarlo con las modificaciones, me ayudarias mucho.

Un dato si te sirve es que en mi servidor tiene PHP 4.

Gracias
  #7 (permalink)  
Antiguo 08/06/2007, 22:11
Avatar de hectorejch  
Fecha de Ingreso: junio-2005
Ubicación: Argentina
Mensajes: 172
Antigüedad: 18 años, 10 meses
Puntos: 2
Re: [B]Error en PHP... Ayuda[/B]

Ok, no hay problema, prueba con esto, si no te funciona ahi vemos :D
Código PHP:
<?php virtual('/Connections/datos.php'); ?>
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
ob_end_flush();
?>
__________________
"El Reino de Dios no consiste en palabras, sino en poder"
  #8 (permalink)  
Antiguo 08/06/2007, 22:20
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

Compadre me arrojo el siguiente error...

El mismo de antes pero en la linea 55


Código PHP:
WarningCannot modify header information headers already sent in /home/zeopccl/public_html/clasetecnica/datos.php on line 55 
  #9 (permalink)  
Antiguo 08/06/2007, 22:46
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

Compadre leyendo las respuestas de un colega, encontre una info, relevante ya que yo estoy incluyendo codigo HTML en el PHP, quizas no deveria pero te voy a copiar todo el codigo para que lo revises y me des tu opinion.


Código PHP:
<?php virtual('/Connections/datos.php'); ?>
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
ob_end_flush();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>CLASE DIGITAL   V1.0</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>

<body>
<table width="700" border="0" align="center">
  <tr>
    <td><div align="center"><img src="img/barraarriba.jpg" width="777" height="100" /></div></td>
  </tr>
  <tr>
    <td><table width="783">
      <tr>
        <td width="124" align="center" valign="top" bgcolor="#ADE7E7"><p>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="#version=5,0,0,0" width="100" height="20">
            <param name="BGCOLOR" value="#ADE7E7" />
            <param name="movie" value="button1.swf" />
            <param name="quality" value="high" />
            <embed src="button1.swf" width="100" height="20" quality="high" pluginspage="" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
          </object>
            <br />
            </p>
          <p>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=".cab#version=5,0,0,0" width="100" height="20">
              <param name="BGCOLOR" value="#ADE7E7" />
              <param name="movie" value="button2.swf" />
              <param name="quality" value="high" />
              <embed src="button2.swf" width="100" height="20" quality="high" pluginspage="P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
            </object>
            <br />
            </p>
          <p>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="#version=5,0,0,0" width="100" height="20">
              <param name="BGCOLOR" value="#ADE7E7" />
              <param name="movie" value="button5.swf" />
              <param name="quality" value="high" />
              <embed src="button5.swf" width="100" height="20" quality="high" pluginspage="/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
            </object>
          </p>
          <form id="form2" name="form2" method="post" action="dataProcess2.php">
            <p>
              <input type="hidden" name="logIn2" value="yes" />
            </p>
            <p align="center"><strong>ACCESO A SUPERVISORES </strong> </p>
            <p align="center">USUARIO :<br />
                <input name="loginName" type="text" id="loginName" size="20" />
                <br />
              CONTRASE&Ntilde;A :<br />
  <input name="passWord" type="text" id="passWord" size="20" />
  <input type="submit" name="Submit2" value="Entrar" />
            </p>
            </form>
          <p>&nbsp; </p></td>
        <td width="523" bgcolor="#ADE7E7">
          <p align="center"><font color="#FF0000" size="+2"><strong>&iexcl;&iexcl;&iexcl; PAGINA EN CONSTRUCCION !!! </strong></font></p>
          <p align="center">ACTUALMENTE SOLO SE RECIBEN LAS DATOS DE INSCRIPCI&Oacute;N DEL CURSO.</p>
          <p align="center"><font color="#FF0000"><strong>RECUERDA QUE ESTE TIENE UN VALOR DE $2.000 MENSUALES Y SERAN COBRADOS LA PRIMERA CLASE DE CADA MES.</strong></font></p>
          <p align="center"><strong><font color="#FF0000">INICIO DE CLASE</font></strong><br />
            <strong>MARTES 19 DE JUNIO 19:00 Hrs<br />
            LUGAR<br />
            ESCUELA DE QUEBRADA DE ALVARADO.</strong></p>
          <p align="center"><strong><font size="2">DATOS DEL ALUMNO </font></strong></p>
          <p align="center"><strong><span class="Estilo1"><font color="#FF0000">INGRESA LOS DATOS COMPLETOS</font></span></strong></p>
          <p align="center"><strong>SI NO TIENES MAIL DEJA EL ESPACIO EN BLANCO, DENTRO DE 24 HORAS TE CREAREMOS UNO EN NUESTROS SERVIDORES.<br />
            PARA PODER REVISARLO DEBERAS ENTRAR A </strong></p>
          <p align="center"><strong>USUARIO : [email protected]<br />
            CONTRASE&Ntilde;A : tu RUT asi XX.XXX.XXX-X </strong></p>
          <p align="center">&nbsp;</p>
          
          <form method="post" name="form3" action="<?php echo $editFormAction?>">
            <table align="center">
              <tr valign="baseline">
                <td nowrap align="right">Rut:</td>
                <td><input type="text" name="rut" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Dverificador:</td>
                <td><input type="text" name="dverificador" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Nombre:</td>
                <td><input type="text" name="nombre" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Email:</td>
                <td><input type="text" name="email" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Direccion:</td>
                <td><input type="text" name="direccion" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Comuna:</td>
                <td><input type="text" name="comuna" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Ciudad:</td>
                <td><input type="text" name="ciudad" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Pais:</td>
                <td><input type="text" name="pais" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Carea:</td>
                <td><input type="text" name="carea" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Telefono:</td>
                <td><input type="text" name="telefono" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><input type="submit" value="Insertar registro"></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form3">
          </form>
          <p>&nbsp;</p>
          <p>&nbsp;</p></td>
        <td width="120" align="center" valign="top" bgcolor="#ADE7E7"><form action="dataProcess.php" method="post" name="form1" target="_self" id="form1">
        <input type="hidden" name="logIn" value="yes">
          <p align="center"><strong>ACCESO A ALUMNOS          </strong>          </p>
          <p align="center">USUARIO :<br />
            <input name="loginName" type="text" size="20" />
            <br />
            CONTRASE&Ntilde;A :<br />
            <input name="passWord" type="text" size="20" />
            <input type="submit" name="Submit" value="Entrar" />
            </label>
          </p>
          </form>
        
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
Gracias
  #10 (permalink)  
Antiguo 08/06/2007, 23:06
Avatar de hectorejch  
Fecha de Ingreso: junio-2005
Ubicación: Argentina
Mensajes: 172
Antigüedad: 18 años, 10 meses
Puntos: 2
Re: [B]Error en PHP... Ayuda[/B]

Si, es mucha mezcla de código, en realidad deberías separarlo, pero prueba con esto:
Código PHP:
<?php virtual('/Connections/datos.php'); ?>
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>CLASE DIGITAL   V1.0</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>

<body>
<table width="700" border="0" align="center">
  <tr>
    <td><div align="center"><img src="img/barraarriba.jpg" width="777" height="100" /></div></td>
  </tr>
  <tr>
    <td><table width="783">
      <tr>
        <td width="124" align="center" valign="top" bgcolor="#ADE7E7"><p>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="#version=5,0,0,0" width="100" height="20">
            <param name="BGCOLOR" value="#ADE7E7" />
            <param name="movie" value="button1.swf" />
            <param name="quality" value="high" />
            <embed src="button1.swf" width="100" height="20" quality="high" pluginspage="" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
          </object>
            <br />
            </p>
          <p>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=".cab#version=5,0,0,0" width="100" height="20">
              <param name="BGCOLOR" value="#ADE7E7" />
              <param name="movie" value="button2.swf" />
              <param name="quality" value="high" />
              <embed src="button2.swf" width="100" height="20" quality="high" pluginspage="P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
            </object>
            <br />
            </p>
          <p>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="#version=5,0,0,0" width="100" height="20">
              <param name="BGCOLOR" value="#ADE7E7" />
              <param name="movie" value="button5.swf" />
              <param name="quality" value="high" />
              <embed src="button5.swf" width="100" height="20" quality="high" pluginspage="/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#ADE7E7" ></embed>
            </object>
          </p>
          <form id="form2" name="form2" method="post" action="dataProcess2.php">
            <p>
              <input type="hidden" name="logIn2" value="yes" />
            </p>
            <p align="center"><strong>ACCESO A SUPERVISORES </strong> </p>
            <p align="center">USUARIO :<br />
                <input name="loginName" type="text" id="loginName" size="20" />
                <br />
              CONTRASE&Ntilde;A :<br />
  <input name="passWord" type="text" id="passWord" size="20" />
  <input type="submit" name="Submit2" value="Entrar" />
            </p>
            </form>
          <p>&nbsp; </p></td>
        <td width="523" bgcolor="#ADE7E7">
          <p align="center"><font color="#FF0000" size="+2"><strong>&iexcl;&iexcl;&iexcl; PAGINA EN CONSTRUCCION !!! </strong></font></p>
          <p align="center">ACTUALMENTE SOLO SE RECIBEN LAS DATOS DE INSCRIPCI&Oacute;N DEL CURSO.</p>
          <p align="center"><font color="#FF0000"><strong>RECUERDA QUE ESTE TIENE UN VALOR DE $2.000 MENSUALES Y SERAN COBRADOS LA PRIMERA CLASE DE CADA MES.</strong></font></p>
          <p align="center"><strong><font color="#FF0000">INICIO DE CLASE</font></strong><br />
            <strong>MARTES 19 DE JUNIO 19:00 Hrs<br />
            LUGAR<br />
            ESCUELA DE QUEBRADA DE ALVARADO.</strong></p>
          <p align="center"><strong><font size="2">DATOS DEL ALUMNO </font></strong></p>
          <p align="center"><strong><span class="Estilo1"><font color="#FF0000">INGRESA LOS DATOS COMPLETOS</font></span></strong></p>
          <p align="center"><strong>SI NO TIENES MAIL DEJA EL ESPACIO EN BLANCO, DENTRO DE 24 HORAS TE CREAREMOS UNO EN NUESTROS SERVIDORES.<br />
            PARA PODER REVISARLO DEBERAS ENTRAR A </strong></p>
          <p align="center"><strong>USUARIO : [email protected]<br />
            CONTRASE&Ntilde;A : tu RUT asi XX.XXX.XXX-X </strong></p>
          <p align="center">&nbsp;</p>
          
          <form method="post" name="form3" action="<?php echo $editFormAction?>">
            <table align="center">
              <tr valign="baseline">
                <td nowrap align="right">Rut:</td>
                <td><input type="text" name="rut" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Dverificador:</td>
                <td><input type="text" name="dverificador" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Nombre:</td>
                <td><input type="text" name="nombre" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Email:</td>
                <td><input type="text" name="email" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Direccion:</td>
                <td><input type="text" name="direccion" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Comuna:</td>
                <td><input type="text" name="comuna" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Ciudad:</td>
                <td><input type="text" name="ciudad" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Pais:</td>
                <td><input type="text" name="pais" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Carea:</td>
                <td><input type="text" name="carea" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Telefono:</td>
                <td><input type="text" name="telefono" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><input type="submit" value="Insertar registro"></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form3">
          </form>
          <p>&nbsp;</p>
          <p>&nbsp;</p></td>
        <td width="120" align="center" valign="top" bgcolor="#ADE7E7"><form action="dataProcess.php" method="post" name="form1" target="_self" id="form1">
        <input type="hidden" name="logIn" value="yes">
          <p align="center"><strong>ACCESO A ALUMNOS          </strong>          </p>
          <p align="center">USUARIO :<br />
            <input name="loginName" type="text" size="20" />
            <br />
            CONTRASE&Ntilde;A :<br />
            <input name="passWord" type="text" size="20" />
            <input type="submit" name="Submit" value="Entrar" />
            </label>
          </p>
          </form>
        
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<?php
    ob_end_flush
();
?>
Si te sigue dando el problema mandame un MP
__________________
"El Reino de Dios no consiste en palabras, sino en poder"
  #11 (permalink)  
Antiguo 09/06/2007, 01:02
Avatar de korg1988  
Fecha de Ingreso: junio-2006
Ubicación: Santa Fe, Argentina
Mensajes: 825
Antigüedad: 17 años, 9 meses
Puntos: 19
De acuerdo Re: [B]Error en PHP... Ayuda[/B]

Hermano esto es muy facil y lamento tener que corregir a los uqe pusieron al final de el codigo el flush
esto lo tienes que hacer de la siguiente forma
Código PHP:
 <?php virtual('/Connections/datos.php'); ?>
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
ob_clean();
  
header(sprintf("Location: %s"$insertGoTo));
  exit();
}

?>

ob_clea
n();

header(sprintf("Location: %s", $insertGoTo));
exit();
con el ob_clean() limpias el buffer antes de que se haga el redireccionamiento sino que sentido tiene hacerlo al final luego del header seria lo mismo que no ponerlo, tienes que limpiar el buffer antes de redireccionar, exactamente en el momento del redireccionamiento lo limpias y le pones un exit() para que no pierda tienmpo con lo que sigue de codigo
Suerte despues me contas como te fue
  #12 (permalink)  
Antiguo 09/06/2007, 13:36
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

estimado

Sigue el mismo error

Warning: Cannot modify header information - headers already sent in /home/zeopccl/public_html/clasetecnica/datos.php on line 56
  #13 (permalink)  
Antiguo 09/06/2007, 14:02
Avatar de sumolari  
Fecha de Ingreso: mayo-2006
Ubicación: localhost
Mensajes: 1.367
Antigüedad: 17 años, 11 meses
Puntos: 18
Re: [B]Error en PHP... Ayuda[/B]

una pregunta, ¿el código lo ha generado dreamweaver? Lo digo porque entonces en la primera línea debería ser un require, al menos a mi siempre me aparece así, quedaría así:
Código PHP:
<?php require_once('/Connections/datos.php'); ?>
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
ob_clean();
  
header(sprintf("Location: %s"$insertGoTo));
  exit();
}

?>
  #14 (permalink)  
Antiguo 09/06/2007, 14:18
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: [B]Error en PHP... Ayuda[/B]

Es definitivo, el codigo lo genero Dreamweaver...
pero en la primera fila tengo esto
Código PHP:
<?php virtual('/Connections/datos.php'); ?>
he probado con tu codigo y me arroja estos errores y ademas deja de mostrarme la pagina.

Código PHP:
Warningmain() [function.main]: open_basedir restriction in effectFile(/Connections/datos.phpis not within the allowed path(s): (/home/zeopccl:/usr/lib/php:/usr/local/lib/php:/tmpin /home/zeopccl/public_html/clasetecnica/datos.php on line 1

Warning
main(/Connections/datos.php) [function.main]: failed to open streamOperation not permitted in /home/zeopccl/public_html/clasetecnica/datos.php on line 1

Fatal error
main() [function.require]: Failed opening required '/Connections/datos.php' (include_path='.:/usr/lib/php:/usr/local/lib/php'in /home/zeopccl/public_html/clasetecnica/datos.php on line 1 
Espero su ayuda...

Última edición por zeoneo; 09/06/2007 a las 14:26
  #15 (permalink)  
Antiguo 10/06/2007, 00:26
Avatar de sumolari  
Fecha de Ingreso: mayo-2006
Ubicación: localhost
Mensajes: 1.367
Antigüedad: 17 años, 11 meses
Puntos: 18
Re: [B]Error en PHP... Ayuda[/B]

Mira si la dirección del archivo es correcto, y luego vuelve a probar el código que te di, el error que da es que no puede abrir el archivo.Si no, comprueba la dirección del archivo y prueba con el tuyo

con archivo me refiero a datos.php
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 23:02.