Foros del Web » Programando para Internet » PHP »

Problemas Con El Php

Estas en el tema de Problemas Con El Php en el foro de PHP en Foros del Web. KE TAL AMIGOS: ESTOY TRABANDO PHP CON MYSQL DESDE UN SERVIDOR LOCAL CON EL EASYPHP, PARA REALIZAR CONSULTAS SIMPLES A LA BD NO HAY PROBLEMA ...
  #1 (permalink)  
Antiguo 09/02/2007, 14:28
 
Fecha de Ingreso: mayo-2004
Mensajes: 130
Antigüedad: 19 años, 11 meses
Puntos: 0
Problemas Con El Php

KE TAL AMIGOS: ESTOY TRABANDO PHP CON MYSQL DESDE UN SERVIDOR LOCAL CON EL EASYPHP, PARA REALIZAR CONSULTAS SIMPLES A LA BD NO HAY PROBLEMA MUESTRA LOS DATOS CORRECTAMENTE PERO EL PROBLEMA ESTA POR EJEMPLO EN MI FORMULARIO DE AUNTENTIFICACIÓN DE USUARIOS Y EN CUANDO KIERO GUARDAR DATOS.

EL CÓDIGO DE MI FORM PARA INGRESAR USUARIO Y PASSWORD ES ESTE:

<?PHP
include("conexion.php");
if ($_GET['accion']=="valida"){//validar user

$user=$_POST['user'];
$pass=$_POST['pass'];
str_replace("'","",$user);
str_replace("'","",$pass);

if ($user!='' or $pass!=''){
$sqlValida="select * from Usuarios where ((Usuario='$user') and (Password='$pass'))";
$rsValida=mysql_query($sqlValida,$dbh);
$campo=MySQL_fetch_array($rsValida);
if(mysql_num_rows($rsValida)==1){//entra

$id=$campo["id"];
session_start();
$_SESSION['id']=$id;
header("Location:publicanoticias.php");
break;
}else{
$msg="Datos incorrectos";
header("Location:$PHP_SELF?msg=$msg");
break;
}




}else{
$msg="Falta datos de acceso";
header("Location:$PHP_SELF?msg=$msg");
break;
}
/* while($campousr=mysql_fetch_row($rsusr)){
echo $campousr[0]." - ".$campousr[1];
}
*/



}//fin validar
?>
<title>Per&uacute; Pesca - Panel de Administraci&oacute;n</title>
<link href="estilo/estilo.css" rel="stylesheet" type="text/css">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="150" valign="middle" bgcolor="#FFFFFF"><div align="left"><br>
<br>
<? include("index_cabeza.php");?><br>
<br>
<br>
</div></td>
</tr>
<tr>
<td><div align="center">
<form action="<? $PHP_SELF?>?accion=valida" method="post" name="form1" class="titulo" id="form1">

<? if ($msg!=''){
echo "<span class='titulo'>".$msg."</span>";
}?>
<br />

<table width="300" border="0" align="center" cellpadding="4" cellspacing="4" bordercolor="#FFFFFF" bgcolor="#990000" class="texarescroll">
<tr>
<td colspan="2" class="titulo"><div align="center"></div>
<div align="center" class="bolet&iacute;n">INGRESAR DATOS</div></td>
</tr>
<tr>
<td class="titulo"><div align="center" class="bolet&iacute;n">USUARIO</div></td>
<td><div align="center">
<input name="user" type="text" id="user" maxlength="11" />
</div></td>
</tr>
<tr>
<td class="titulo"><div align="center" class="bolet&iacute;n">CLAVE</div></td>
<td><div align="center">
<input name="pass" type="password" id="pass" maxlength="11" />
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="center" class="titular">
<input name="Submit" type="submit" class="fecha" value="Aceptar" />
&nbsp;&nbsp;
<input name="Submit2" type="reset" class="fecha" value="Limpiar" />
</div></td>
</tr>
</table>
</form>
</div></td>
</tr>
<tr>
<td height="150" valign="middle"><div align="left"><? include("index_pie.php");?></div></td>
</tr>
</table>

Y MANDA LOS SGTES ERRRORES:

Notice: Undefined index: accion in d:\pullcreativoweb\nuevaweb-constructivo\panel\index.php on line 3

Notice: Undefined variable: msg in d:\pullcreativoweb\nuevaweb-constructivo\panel\index.php on line 59

LA LÍNEA 3 DICE ESTO: if ($_GET['accion']=="valida"){//validar user

LA LÍNEA 59: <? if ($msg!=''){

ESTOS ERRORES SALEN CUANDO YO EJECUTO LA PÁGINO PERO SI YO INGRESO MI USER Y MI CLAVE Y LE DOY ENVIAR ME SALE ESTE OTRO ERROR:

You don't have permission to access /constructivo/panel/<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>d:/pullcreativoweb/nuevaweb-constructivo/panel/index.php</b> on line <b>57</b><br /> on this server.


PARA EL CASO DEL FORMULARIO PARA GUARDAR DATOS SUCEDE LO MISMO, ESTE MISMO CÓDIGO LO HE USADO EN UN SERVIDOR REMOTO Y FUNCIONA MUY BIEN PERO AHORA LO USO EN UN SERVIDOR LOCAL Y SALEN ESTOS ERRORES.

LES AGRADECERÉ ME ORIENTEN KE DEBO HACER PARA SOLUCIONAR ESTO.
  #2 (permalink)  
Antiguo 09/02/2007, 15:42
Avatar de DeeR  
Fecha de Ingreso: diciembre-2003
Ubicación: Santiago
Mensajes: 520
Antigüedad: 20 años, 4 meses
Puntos: 17
Re: Problemas Con El Php

No son errores, son como pequeñas advertencias (notices).

Edita tu php.ini (click en easyphp, configuracion - php)
Busca la linea
error_reporting = E_ALL
y reemplazala por
error_reporting = E_ALL & ~E_NOTICE


lo que sucede esq algunas de esas variables en algun momento no existen o no las definitas, ejemplo la primera $_GET['accion'] existe si solo si se paso ese parametro por get al script.

Deberias preguntar primero si esa variable existe con
Código PHP:
<?
if ( isset( $_GET['accion'] ) )
// Existe Variable
}
Pero filo, haciendo eso en el php.ini no te van a salir esos notices :P
  #3 (permalink)  
Antiguo 13/02/2007, 16:31
 
Fecha de Ingreso: mayo-2004
Mensajes: 130
Antigüedad: 19 años, 11 meses
Puntos: 0
Re: Problemas Con El Php

Deer: Muchas gracias por tu información, fue muy valiosa.

Ahora necesito hacerte una consulta, es posible realizar un sistema de noticias en php? con flash o que se yo, en el cual vaya cargándose una noticia de la bd de mysql y luego de unos segundos esta noticia cambie por otra noticia de la bd de mysql estoy hablando de unas 4 ó 5 noticias que carguen aleatoriamente con su imagen y su vínculo a la página donde la puedan leer en detalle.

Yo encontré este enlace http://www.cristalab.com/tutoriales/...h-con-imagenes

Aquí hay un ejemplo pero necesito que la carga de las noticias sea aleatoria, que carguen automáticamente sin necesidad de usar las flechas.

Si tienes alguna información al respecto te agradeceré me indiques que debo hacer o en que página debo buscarla.

Muchas gracias.
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 00:00.