Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/10/2008, 22:10
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 5 meses
Puntos: 43
error al mostrar la imagen (header...)

Bueno estoy intentando hacer un captcha con un formulario pero me da error de:
Warning: Cannot modify header information - headers already sent by (output started at /home/destor77/public_html/proyectos/includes/head.php:22) in /home/destor77/public_html/proyectos/includes/funciones.php on line 109

el archivo donde genero la imagen es funciones.php:
Código PHP:
function randomText($length) {
    
$pattern "1234567890abcdefghijklmnopqrstuvwxyz";
    for(
$i=0;$i<$length;$i++) {
      
$key .= $pattern{rand(0,35)};
    }
    return 
$key;
}


/**
 * crea un captcha
 *
 * @return image
 */
function captcha(){
      
session_start();
      
$_SESSION['tmptxt'] = randomText(8);
      
$captcha imagecreatefromgif("images/bgcaptcha.gif");
      
$colText imagecolorallocate($captcha000);
      
imagestring($captcha5167$_SESSION['tmptxt'], $colText);
      
header("Content-type: image/gif");
      return 
imagegif($captcha);
      

mi formulario es:
Código PHP:
<div class="paginacion"><? echo $links;?></div>  
        <?
        $imagen
=captcha();
        
?>
        <br>Dejanos tu mensaje:<br><br>
        <form action="" method="post">
          Email: <input name="email" type="text" value="<? echo $_REQUEST['email']; ?>"><br><br>
          Nombre: <input name="nombre" type="text" value="<? echo $_REQUEST['nombre']; ?>"><br><br>
          Mensaje:<br><br>
          <textarea rows="10" cols="30" name="texto"><? echo $_REQUEST['texto']; ?></textarea><br>
          <img src="<? //echo $imagen; ?>" width="100" height="30"><br><br>
          Ingrese codigo de seguridad:<br><br>
          <input name="tmptxt" type="text"><br><br>
          <input name="btget" type="submit" value="Verificar Codigo">
          <input name="action" type="hidden" value="checkdata">
        </form>
        
    <?
      
//session_start();
      
if ($_POST['action'] == "checkdata") {
          if (
$_SESSION['tmptxt'] == $_POST['tmptxt']) {
              
$mensaje=nuevoMensaje($_REQUEST['email'],$_REQUEST['nombre'],$_REQUEST['texto']);
              if(!empty(
$mensaje)){
                if(
$mensaje[0]==1){?>
                                <div id="error">
                                    <? echo $mensaje[1];?>
                                    <a href="index.php?modulo=mensajes">Volver</a>
                                </div>
                             <?
                             

                             else{
                                 if(
$mensaje[0]==0){?>
                                 <div id="ok">
                                    <? echo $mensaje[1];?>
                                    <a href="index.php">Volver</a>
                                </div>
                            
                            <? }   
                }  
            }
        }
    }
?>        
                    
        </div>
y mi head.php tiene:
Código PHP:
<?php
/**
 *  @author : Lucas Martn Sastre
 *     @copyright : Onrico Sistemas
 *     @link : http://www.oniricosistemas.com.ar
 *     @version : 1.1
 *     @package : Leon Gieco
 *  @name : head.php
 * 
 *     contiene todo los includes y la cabecera del html
 */

    
include 'config.php';
    
//include 'funciones.php';
    
include 'PHPPaging.lib.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link type="text/css" rel="stylesheet" href="css/estilos.css" />
<title>LeonGieco.com | SITIO OFICIAL | <? echo $_REQUEST['modulo']; ?></title>
</head>

<body>
<div id="contenedor">
    <div id="logo"><img src="images/hed.jpg" alt="" /></div>
<div id="contenido">

en que le estoy errando para que no se muestre correctamente la imagen?

desde ya muchas gracias