Me está apareciendo el siguiente error cuando entro a td_addconsulta.php:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/instalal/public_html/miweb/principal/clubSHA/talkdoctor/td_addconsulta.php:1) in /home/instalal/public_html/miweb/principal/clubSHA/cods/validar_sesion_1.php on line 4
Se que no se debe lanzar al navegador ningún html antes del session_start(), incluyendo los caracteres en blanco; esto ya lo sabía porque antes me pasó lo mismo y era por esto.
Lo que me raya ahora es que este error me aparece SOLO CON UNO de los php de la web, CON NINGUN OTRO MAS...!!!! y todos tienen los mismos require_once() al comienzo.
no voy a poner todo el td_addconsulta.php (php + html), pero si les pongo toda la parte de php para ver si detectan un fallo, porque yo no...
Código PHP:
<?php
require_once('../cods/validar_sesion_1.php');
require_once('../cods/sha_clubsha.php');
require_once('../cods/funciones.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
// HASTA AQUI TODOS MIS PHP SON IGUALES
$id_med = "";
if (isset($_GET['id_med'])) {
$id_med = $_GET['id_med'];
}
$fail = 0;
if (isset($_GET['fail'])) {
$fail = $_GET['fail'];
}
$lang = "en";
if (isset($_SESSION['lang'])) {
$lang = $_SESSION['lang'];
}
if (isset($_GET['lang'])) {
$lang = $_GET['lang'];
}
$_SESSION['lang'] = $lang;
$area_lang = 'area_'.$lang;
$desc_lang = 'desc_'.$lang;
if($lang =='es'){
$txt_addconsulta = 'Agregar consulta';
$txt_sel_doc = 'Selecione un médico';
$txt_titulo = 'Asunto';
$txt_doctor = 'Médico';
$txt_mensaje = 'Mensaje';
$btn_enviar = 'Enviar';
$txt_error = 'Su consulta no pudo ser guardada, por favor, vuelva a hacerla. Disculpe el inconveniente.';
}
else {
$txt_addconsulta = 'Add Question';
$txt_sel_doc = 'Select a doctor';
$txt_titulo = 'Subjet';
$txt_doctor = 'Doctor';
$txt_mensaje = 'Message';
$btn_enviar = 'Send';
$txt_error = 'Your request could not be saved, please try it again. We apologize for the inconvenience.';
}
$id_member = $_SESSION['MM_Username'];
// QUERRY DOCTOR DE CONSULTA
mysql_select_db($database_clubsha, $clubsha);
$query_doc = "SELECT * FROM clubsha_medicos";
$doc = mysql_query($query_doc, $clubsha) or die(mysql_error());
$row_doc = mysql_fetch_assoc($doc);
$totalRows_doc = mysql_num_rows($doc);
$addFormAction = $_SERVER['PHP_SELF'];
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "addForm")) {
$error = 0;
$td_add_titulo_txt = reemplaza_saltos_linea_html($_POST['td_add_titulo']);
$td_add_msg_txt = reemplaza_saltos_linea_html($_POST['td_add_msg']);
$date_ahora = date("Y-m-d H:i:s");
$updateSQL = sprintf("INSERT INTO clubsha_foro_status (id_med, id_user, last_preg, last_resp, last_total, last_view_user, last_view_doc, titulo)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s) ",
GetSQLValueString($_POST['td_add_doc'], "int"),
GetSQLValueString($id_member, "text"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($td_add_titulo_txt, "text"));
mysql_select_db($database_clubsha, $clubsha);
$Result = mysql_query($updateSQL, $clubsha) or die(mysql_error());
if ( $Result != 1 ) {$error = 1;}
else {
// QUERY TEXTOS DE CONSULTA
mysql_select_db($database_clubsha, $clubsha);
$query_td_lastid = sprintf("SELECT * FROM clubsha_foro_status WHERE last_preg = %s AND last_total = %s",
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($date_ahora, "date"));
$td_lastid = mysql_query($query_td_lastid, $clubsha) or die(mysql_error());
$row_td_lastid = mysql_fetch_assoc($td_lastid);
$totalRows_td_lastid = mysql_num_rows($td_lastid);
mysql_select_db($database_clubsha, $clubsha);
$updateSQL2 = sprintf("INSERT INTO clubsha_foro_consultas (id_cons, preg_resp, fecha_hora, texto) VALUES (%s, %s, %s, %s) ",
GetSQLValueString($row_td_lastid['id_cons'], "int"),
GetSQLValueString("P", "text"),
GetSQLValueString($date_ahora, "date"),
GetSQLValueString($td_add_msg_txt, "text"));
$Result2 = mysql_query($updateSQL2, $clubsha) or die(mysql_error());
if ( $Result2 != 1 ) {$error = 1;}
}
if ($error == 0 ){
$updateGoTo = "td_misconsultas.php";
}
else {
$updateGoTo = "td_addconsulta.php?fail=1";
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dstd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
....
....
//continua el html....
En mi PC no me sale nada, porque tengo solo los Warning ocultos y con eso funciona, en el servidor he probado con .htaccess poniendo "php_value display_errors off", con esto he logrado que no me aparezca el mensaje, pero al enviar el formulario, me ejecuta todo lo de MySQL, pero me regresa a la misma web, vamos, como si hubiera un error de php pero no me lo muestra.
Bueno, espero que me puedan ayudar, porque ni con un REDBULL he podido encontrar el fallo.
Muchas gracias de antemano como siempre...
Saludos
Carlos