Foros del Web » Programando para Internet » PHP »

Foto en una Ficha Web.

Estas en el tema de Foto en una Ficha Web. en el foro de PHP en Foros del Web. Hola de nuevo. Como siempre, con dudas y problemas. Tengo una base de datos que almacena datos de usuarios que previamente se registran en mi ...
  #1 (permalink)  
Antiguo 06/01/2008, 19:41
 
Fecha de Ingreso: mayo-2005
Mensajes: 51
Antigüedad: 19 años
Puntos: 0
Foto en una Ficha Web.

Hola de nuevo. Como siempre, con dudas y problemas.

Tengo una base de datos que almacena datos de usuarios que previamente se registran en mi web.

La estructura de mi tabla es la siguiente:

Código PHP:

-- 
-- 
Estructura de tabla para la tabla `usuarios`
-- 

CREATE TABLE `usuarios` (
  `
idint(11NOT NULL auto_increment,
  `
Id_adminvarchar(10) default NULL,
  `
pass_adminvarchar(10NOT NULL default '',
  `
loginvarchar(30) default NULL,
  `
passwordvarchar(30) default NULL,
  `
loginWvarchar(50NOT NULL default '',
  `
passwordWvarchar(50NOT NULL default '',
  `
nombrevarchar(30) default NULL,
  `
apellidosvarchar(30) default NULL,
  `
anonacimientodate default '0000-00-00',
  `
poblaciontext,
  `
direcciontext,
  `
codigopostaltext,
  `
provinciatext,
  `
telefonotext,
  `
faxtext,
  `
emailtext,
  `
webtext,
  `
titulacionacatext,
  `
formacionpostext,
  `
seminariostext,
  `
expeprotext,
  `
otrostext,
  `
presentacionWtext NOT NULL,
  `
titulacionWtext NOT NULL,
  `
publicacionesWtext NOT NULL,
  `
contactaWtext NOT NULL,
  `
NOVEDADEStext NOT NULL,
  
PRIMARY KEY  (`id`)
TYPE=MyISAM AUTO_INCREMENT=22 
  #2 (permalink)  
Antiguo 06/01/2008, 19:44
 
Fecha de Ingreso: mayo-2005
Mensajes: 51
Antigüedad: 19 años
Puntos: 0
Re: Foto en una Ficha Web.

Ahora me gustaría que un usuario podria insertar su foto en la ficha de su web. El problema es que no se como hacer para no tener que empezar desde Cero. Ya que ha sido para mi, muy lavorioso el poder sacar adelante este pequeño Proyecto.
este sería el archivo que el usuario puede rellenar y es aqui donde tendrían que subir su foto a su ficha web:
archivo actualizardatos.php:
Código PHP:
 <?php session_start(); ?>
<?php 
require_once('Connections/----------.php'); ?>
<?php
session_start
();
$MM_authorizedUsers "";
$MM_donotCheckaccess "true";


function 
isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
$isValid False
  if (!empty(
$UserName)) { 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    if (
in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && true) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}
$MM_restrictGoTo "conectar.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(
$QUERY_STRING) && strlen($QUERY_STRING) > 0
  
$MM_referrer .= "?" $QUERY_STRING;
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  
$updateSQL sprintf("UPDATE usuarios SET nombre=%s, apellidos=%s, anonacimiento=%s, poblacion=%s, direccion=%s, codigopostal=%s, provincia=%s, telefono=%s, fax=%s, email=%s, web=%s, titulacionaca=%s, formacionpos=%s, seminarios=%s, expepro=%s, otros=%s WHERE id=%s",
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['apellidos'], "text"),
                       
GetSQLValueString($_POST['anonacimiento'], "date"),
                       
GetSQLValueString($_POST['poblacion'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['codigopostal'], "text"),
                       
GetSQLValueString($_POST['provincia'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"),
                       
GetSQLValueString($_POST['fax'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['web'], "text"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_enfercom_buscar$enfercom_buscar);
  
$Result1 mysql_query($updateSQL$enfercom_buscar) or die(mysql_error());

  
$updateGoTo "zonaprivadaW.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}

$colname_ver_usuariosBas "1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_ver_usuariosBas = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_enfercom_buscar$enfercom_buscar);
$query_ver_usuariosBas sprintf("SELECT * FROM usuarios WHERE loginW = '%s'"$colname_ver_usuariosBas);
$ver_usuariosBas mysql_query($query_ver_usuariosBas$enfercom_buscar) or die(mysql_error());
$row_ver_usuariosBas mysql_fetch_assoc($ver_usuariosBas);
$totalRows_ver_usuariosBas mysql_num_rows($ver_usuariosBas);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
    background-image: url();
}
-->
</style>
<link href="css/estilo_---------.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo1 {color: #FFFFFF}
-->
</style>
</head>
<body>
<br>
<table width="85%" height="129" border="0" align="center" cellpadding="5" cellspacing="5" bgcolor="#FFFFFF" class="punteado">
  <tr>
    <td width="805">      <form method="post" name="form1" action="<?php echo $editFormAction?>">
        <table width="100%" align="center" cellpadding="5" cellspacing="5">
          <tr valign="baseline">
            <td nowrap align="right"><strong>Id:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><?php echo $row_ver_usuariosBas['id']; ?></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Nombre:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input name="nombre" type="text" value="<?php echo $row_ver_usuariosBas['nombre']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Apellidos:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input name="apellidos" type="text" value="<?php echo $row_ver_usuariosBas['apellidos']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>A&ntilde;o de nacimiento:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input name="anonacimiento" type="text" value="<?php echo $row_ver_usuariosBas['anonacimiento']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Poblaci&oacute;n:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input name="poblacion" type="text" value="<?php echo $row_ver_usuariosBas['poblacion']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Direcci&oacute;n:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input name="direccion" type="text" value="<?php echo $row_ver_usuariosBas['direccion']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Codigo postal:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="codigopostal" value="<?php echo $row_ver_usuariosBas['codigopostal']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Provincia:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="provincia" value="<?php echo $row_ver_usuariosBas['provincia']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Tel&eacute;fono:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="telefono" value="<?php echo $row_ver_usuariosBas['telefono']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Fax:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="fax" value="<?php echo $row_ver_usuariosBas['fax']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Email:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="email" value="<?php echo $row_ver_usuariosBas['email']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><strong>Pagina Web:</strong></td>
            <td bgcolor="#FFFFFF" class="texto"><input type="text" name="web" value="<?php echo $row_ver_usuariosBas['web']; ?>" size="50"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right">&nbsp;</td>
            <td bgcolor="#FFFFFF" class="texto"><input name="submit" type="submit" value="Actualizar registro"></td>
          </tr>
        </table>
        <input type="hidden" name="MM_update" value="form1">
        <input type="hidden" name="id" value="<?php echo $row_ver_usuariosBas['id']; ?>">
    </form></td></tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result
($ver_usuariosBas);
?>
  #3 (permalink)  
Antiguo 06/01/2008, 19:47
 
Fecha de Ingreso: mayo-2005
Mensajes: 51
Antigüedad: 19 años
Puntos: 0
Re: Foto en una Ficha Web.

Y este seria el archivo que mostraria la parte de la ficha que tendría que contener la FOTO.:



Código PHP:
<?php require_once('Connections/--------------------.php'); ?>
<?php
$maxRows_PRESENTACION 
10;
$pageNum_PRESENTACION 0;
if (isset(
$_GET['pageNum_PRESENTACION'])) {
  
$pageNum_PRESENTACION $_GET['pageNum_PRESENTACION'];
}
$startRow_PRESENTACION $pageNum_PRESENTACION $maxRows_PRESENTACION;

mysql_select_db($database_enfercom_buscar$enfercom_buscar);
$query_PRESENTACION "SELECT id, presentacionW, titulacionW, publicacionesW, contactaW FROM usuarios";
$query_limit_PRESENTACION sprintf("%s LIMIT %d, %d"$query_PRESENTACION$startRow_PRESENTACION$maxRows_PRESENTACION);
$PRESENTACION mysql_query($query_limit_PRESENTACION$enfercom_buscar) or die(mysql_error());
$row_PRESENTACION mysql_fetch_assoc($PRESENTACION);

if (isset(
$_GET['totalRows_PRESENTACION'])) {
  
$totalRows_PRESENTACION $_GET['totalRows_PRESENTACION'];
} else {
  
$all_PRESENTACION mysql_query($query_PRESENTACION);
  
$totalRows_PRESENTACION mysql_num_rows($all_PRESENTACION);
}
$totalPages_PRESENTACION ceil($totalRows_PRESENTACION/$maxRows_PRESENTACION)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
    background-color: #cad4e0;
}
-->
</style>
<link href="css/estilo_enferdep.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="749" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="763"><img src="imagenes/menu-web1.jpg" width="749" height="124" border="0" usemap="#Map">
      <map name="Map">
        <area shape="rect" coords="204,91,306,118" href="presentacionW.php">
        <area shape="rect" coords="345,90,444,117" href="titulacionW.php">
        <area shape="rect" coords="480,93,592,118" href="publicacionesW.php">
        <area shape="rect" coords="622,91,722,117" href="contactaW.php">
      </map></td>
  </tr>
  <tr>
    <td valign="top" bgcolor="#FFFFFF"><p><img src="imagenes/menu-web3.jpg" width="749" height="4"></p>
      <table width="615" height="164" border="0" align="center" class="punteado">
        <tr>
          <td width="111" height="84" valign="top">aqui iria la foto!!! </td>
          <td width="10" valign="top">&nbsp;</td>
          <td width="472" valign="top"><div align="justify">
            <table width="481" height="131" border="0">
              <?php do { ?>
              <tr>
                <td valign="top"><?php echo nl2br($row_PRESENTACION['presentacionW']); ?></td>
                </tr>
              <?php } while ($row_PRESENTACION mysql_fetch_assoc($PRESENTACION)); ?>
            </table>
          </div></td>
        </tr>
      </table>      
    <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td><img src="imagenes/menu-web2.jpg" width="749" height="74"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result
($PRESENTACION);
?>
  #4 (permalink)  
Antiguo 06/01/2008, 19:50
 
Fecha de Ingreso: mayo-2005
Mensajes: 51
Antigüedad: 19 años
Puntos: 0
Re: Foto en una Ficha Web.

Ahora, el problema es, como puedo insertar un nuevo campo en mi base de datos para poder insertar como os habia dicho, una foto en el formulario del usuario y se pueda mostrar en la ficha final.(Logicamente, sin tener que empezar de cero, simplemente añadiendolo al formulario de edicion de la ficha de la web.

Espero que alguien que pueda ayudarme se aclare con mi duda. 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 16:37.