Foros del Web » Programando para Internet » PHP »

sistema usuario de MODIFICAR

Estas en el tema de sistema usuario de MODIFICAR en el foro de PHP en Foros del Web. Buena noche hace quieres usuario de modificar codigo es muy error Código HTML: Warning: Cannot modify header information - headers already sent by (output started ...
  #1 (permalink)  
Antiguo 22/04/2013, 15:25
 
Fecha de Ingreso: abril-2013
Mensajes: 39
Antigüedad: 11 años
Puntos: 0
Exclamación sistema usuario de MODIFICAR

Buena noche
hace quieres usuario de modificar codigo es muy error
Código HTML:
Warning: Cannot modify header information - headers already sent by (output started at /home/u3805310/public_html/cuentamodificar.php:3) in /home/u3805310/public_html/cuentamodificar.php on line 108
Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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;
}
}
?>
<?php
$colname_cuenta4 
"-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_cuenta4 $_SESSION['MM_Username'];
}
mysql_select_db($database_conexion$conexion);
$query_cuenta4 sprintf("SELECT * FROM usuario WHERE Usuarios = %s"GetSQLValueString($colname_cuenta4"text"));
$cuenta4 mysql_query($query_cuenta4$conexion) or die(mysql_error());
$row_cuenta4 mysql_fetch_assoc($cuenta4);
$totalRows_cuenta4 mysql_num_rows($cuenta4);
?>
<?php 
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['textfield'])) {
  
$loginUsername=$_POST['textfield'];
  
$password=md5($_POST['textfield2']);
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "cuenta.php";
  
$MM_redirectLoginFailed "cuentaerror.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_conexion$conexion);
  
  
$LoginRS__query=sprintf("SELECT Usuarios, Password FROM usuario WHERE Usuarios=%S AND Password=%s",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$conexion) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    if (
PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}

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

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
  
$updateSQL sprintf("UPDATE usuario SET Nombre=%s, Apellido=%s WHERE id=%s",
                       
GetSQLValueString($_POST['Nombre'], "text"),
                       
GetSQLValueString($_POST['Apellido'], "text"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_conexion$conexion);
  
$Result1 mysql_query($updateSQL$conexion) or die(mysql_error());

  
$updateGoTo "micuenta.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}
?>
  #2 (permalink)  
Antiguo 22/04/2013, 15:32
 
Fecha de Ingreso: noviembre-2008
Mensajes: 100
Antigüedad: 15 años, 5 meses
Puntos: 4
Respuesta: sistema usuario de MODIFICAR

si no mal me equivoco no puedes enviar en header como lo estas enviando en esta linea
Código PHP:
 header(sprintf("Location: %s"$updateGoTo)); 
te dejo algo que me sirvio mucho para encontrar hace unos dias un errror parecido:

http://www.forosdelweb.com/wiki/PHP:...n_line_4%22%3F
  #3 (permalink)  
Antiguo 22/04/2013, 15:36
 
Fecha de Ingreso: abril-2013
Mensajes: 39
Antigüedad: 11 años
Puntos: 0
Respuesta: sistema usuario de MODIFICAR

puedo quitar codigo "header" como otro codigo nuevo?
  #4 (permalink)  
Antiguo 22/04/2013, 15:50
 
Fecha de Ingreso: noviembre-2008
Mensajes: 100
Antigüedad: 15 años, 5 meses
Puntos: 4
Respuesta: sistema usuario de MODIFICAR

Cita:
Iniciado por camilomascarell1987 Ver Mensaje
puedo quitar codigo "header" como otro codigo nuevo?
Perdona no entendi la pregunta, quiero creer que estas redireccionando a otra pagina "micuenta.php", cierto?
checa bien el link que postie anteriormente.!
  #5 (permalink)  
Antiguo 22/04/2013, 15:53
 
Fecha de Ingreso: abril-2013
Mensajes: 39
Antigüedad: 11 años
Puntos: 0
Respuesta: sistema usuario de MODIFICAR

micuenta.php hay codigo
Código PHP:
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "";
$MM_donotCheckaccess "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
// For security, start by assuming the visitor is NOT authorized. 
  
$isValid False

  
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  
if (!empty($UserName)) { 
    
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    
// Or, you may restrict access to only certain users based on their username. 
    
if (in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && true) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "index.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0
  
$MM_referrer .= "?" $_SERVER['QUERY_STRING'];
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
<?php 
require_once('Connections/conexion.php'); 

if (!
function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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;
}
}

$colname_cuenta3 "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_cuenta3 $_SESSION['MM_Username'];
}
mysql_select_db($database_conexion$conexion);
$query_cuenta3 sprintf("SELECT * FROM usuario WHERE Usuarios = %s"GetSQLValueString($colname_cuenta3"text"));
$cuenta3 mysql_query($query_cuenta3$conexion) or die(mysql_error());
$row_cuenta3 mysql_fetch_assoc($cuenta3);
$totalRows_cuenta3 mysql_num_rows($cuenta3);

// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['textfield'])) {
  
$loginUsername=$_POST['textfield'];
  
$password=md5($_POST['textfield2']);
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "cuenta.php";
  
$MM_redirectLoginFailed "cuentaerror.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_conexion$conexion);
  
  
$LoginRS__query=sprintf("SELECT Usuarios, Password FROM usuario WHERE Usuarios=%s AND Password=%s",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$conexion) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    if (
PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}
?>
  #6 (permalink)  
Antiguo 22/04/2013, 15:55
 
Fecha de Ingreso: noviembre-2008
Mensajes: 100
Antigüedad: 15 años, 5 meses
Puntos: 4
Respuesta: sistema usuario de MODIFICAR

el error dice que esta en;
Código:
cuentamodificar.php on line 108
es la linea del header cierto?? si estoy mal corrigeme

Etiquetas: html, modificar, mysql, select, sistema, sql, usuario, usuarios, variables
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 19:37.