bueno, después de estar liado un poco.... acá pego el código para saber donde le estoy pifiando...
Código PHP:
<? ob_start(); session_start();include_once"config.php";
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
// header("Location: login.php");
}else{
$user_data = "".$_SESSION['username']."";
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE `username`='".$user_data."'"));
}
if(isset($_POST['update'])){
$oldp = $_POST['oldpass'];
$newp = $_POST['newpass'];
$conp = $_POST['conpass'];
// tu codigo -------------------------------------------
$username=$_SESSION['username']; //sería mejor que guardaras la id en una sesion
$edad=$_POST['edad'];
$ciudad=$_POST['ciudad'];
$pais=$_POST['pais'];
$DNI=$_POST['DNI'];
$direccion=$_POST['direccion'];
$telefono=$_POST['telefono'];
$movil=$_POST['movil'];
$provincia=$_POST['provincia'];
//------- hasta aqui-------------------------------------
if($oldp == NULL OR $newp == NULL OR $conp == NULL){
$final_report.="Complete todos los campos!";
}else{
$check_pass = mysql_query("SELECT * FROM `members` WHERE `username`='".$user_data."'");
$check_data = mysql_fetch_array($check_pass);
if($check_data['password'] != $oldp){
$final_report.="Su clave no coincide con la que posee!";
}else{
if(strlen($newp) <= 5 || strlen($newp) >= 12){
$final_report.="Su clave debe tener entre 6 y 12 caracteres!";
}else{
if($newp != $conp){
$final_report.="Confirme nuevamente su clave!";
}else{
// tu otra parte del codigo, aqui.
$update_pass = mysql_query("UPDATE `members` SET edad='$edad',
ciudad='$ciudad',
pais='$pais',
DNI='$DNI',
direccion='$direccion',
telefono='$telefono',
movil='$movil',
provincia='$provincia'
WHERE username='$username'"); // hasta la linea anterior a esta...
$final_report.="Su clave se ha cambiado correctamente, espere para volver a ingresar al sitio.";
@session_destroy();
header( 'refresh: 3; url=login.php');
}}}}}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>.</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
a:link {
color: #0066FF;
}
a:visited {
color: #0066FF;
}
a:hover {
color: #0066FF;
}
a:active {
color: #0066FF;
}
.title {
color: #0066CC;
font-weight: bold;
font-size: 18px;
}
.header { color:#FFFFFF;}
-->
</style>
</head>
<body>
<form method="post">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="163">Clave actual: </td>
<td width="531"><input name="oldpass" type="text" id="oldpass" value="<? echo ''.$_SESSION['password'].'';?>" readonly="readonly"></td>
</tr>
<tr>
<td>Coloque su nueva Clave: </td>
<td><input name="newpass" type="password" id="newpass"></td>
</tr>
<tr>
<td>Confirme su nueva clave: </td>
<td><input name="conpass" type="password" id="conpass"></td>
</tr>
<tr>
<td width="163">Nombre: </td>
<td width="531"><input name="nombre" type="text" id="nombre" value="<? echo ''.$_SESSION['nombre'].'';?>"></td>
</tr>
<tr>
<td width="163">Apellido: </td>
<td width="531"><input name="apellido" type="text" id="apellido" value="<? echo ''.$_SESSION['apellido'].'';?>"></td>
</tr>
<tr>
<td width="163">Edad: </td>
<td width="531"><input name="edad" type="text" id="edad"></td>
</tr>
<tr>
<td width="163">DNI: </td>
<td width="531"><input name="DNI" type="text" id="DNI"></td>
</tr>
<tr>
<td width="163">Dirección: </td>
<td width="531"><input name="direccion" type="text" id="direccion"></td>
</tr>
<tr>
<td width="163">Teléfono: </td>
<td width="531"><input name="telefono" type="text" id="telefono"></td>
</tr>
<tr>
<td width="163">Móvil: </td>
<td width="531"><input name="movil" type="text" id="movil"></td>
</tr>
<tr>
<td width="163">Ciudad: </td>
<td width="531"><input name="ciudad" type="text" id="ciudad"></td>
</tr>
<tr>
<td width="163">Província: </td>
<td width="531"><input name="provincia" type="text" id="provincia"></td>
</tr>
<tr>
<td width="163">Pais: </td>
<td width="531"><input name="pais" type="text" id="pais"></td>
</tr>
<td width="163">Email: </td>
<td width="531"><input name="mail" type="text" id="mail" readonly="readonly"></td>
</tr>
<tr>
<td width="163"><input name="update" type="submit" id="update" value="Actualizar datos"></td>
<td><? if(!isset($_POST['update'])){ echo "".$user_data."";?>
<? }else{
echo"".$final_report."";
}?></td>
</tr>
</table>
</form>
</body>
</html>
No me actualiza los datos en la db ni tampoco los lee... así que estaré teniendo un error garrafal... haber si alguien me echa un cable...