Foros del Web » Programando para Internet » PHP »

juego de registros

Estas en el tema de juego de registros en el foro de PHP en Foros del Web. muy buenas no se como explicar esto exactamente, he creado un juego de registros para mostrar una serie de imágenes de una base de datos ...
  #1 (permalink)  
Antiguo 05/10/2011, 15:59
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
juego de registros

muy buenas no se como explicar esto exactamente, he creado un juego de registros para mostrar una serie de imágenes de una base de datos pero quiero que según el nombre de usuario me muestre unas fotos u otras, como puedo poner el parámetro del nombre de usuario en este link para que me ejecute esto.

el código seria este:

Código PHP:
Ver original
  1. <a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>"><img src="productos/<?php echo $row_listadoproductos['foto_producto']; ?>" width="134" height="91" /></a>

no se si me explico bien, es decir la FOTO_PRODUCTO dependerá del campo TIENDA.
  #2 (permalink)  
Antiguo 05/10/2011, 16:05
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: juego de registros

Has pensado utilizar sesiones checa esto

Saludos
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125
  #3 (permalink)  
Antiguo 05/10/2011, 16:09
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: juego de registros

donde debería ponerla
  #4 (permalink)  
Antiguo 05/10/2011, 16:17
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: juego de registros

Cita:
Iniciado por carolina3 Ver Mensaje
donde debería ponerla
Todo lo debes de relacionar en el inicio de sesion (si es que lo tienes)
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125
  #5 (permalink)  
Antiguo 05/10/2011, 16:29
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: juego de registros

no tiene un inicio de sesión tampoco me interesa debe poder acceder cualquiera directamente, no se le podría indicar de otra manera
  #6 (permalink)  
Antiguo 05/10/2011, 16:51
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: juego de registros

Si no te interesa las sesiones como explicas esto

Cita:
Iniciado por carolina3 Ver Mensaje
he creado un juego de registros para mostrar una serie de imágenes de una base de datos pero quiero que según el nombre de usuario me muestre unas......
haber muestra todo el código que tienes para poder ayudarte mejor
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125
  #7 (permalink)  
Antiguo 05/10/2011, 17:02
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: juego de registros

mira esta seria la pagina index de cada usuario registrado:
Código HTML:
Ver original
  1. <?php require_once('../../Connections/blueberryswebtiendas.php'); ?>
  2. <!--aqui hemos creado el juego de registro y el repetir region de los productos-->
  3. <?php
  4.  
  5. if (!function_exists("GetSQLValueString")) {
  6. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  7. {
  8.  if (PHP_VERSION < 6) {
  9.    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  10.  }
  11.  
  12.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  13.  
  14.  switch ($theType) {
  15.    case "text":
  16.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  17.      break;    
  18.    case "long":
  19.    case "int":
  20.      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  21.      break;
  22.    case "double":
  23.      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  24.      break;
  25.    case "date":
  26.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  27.      break;
  28.    case "defined":
  29.      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  30.      break;
  31.  }
  32.  return $theValue;
  33. }
  34. }
  35.  
  36. $maxRows_listadoproductos = 2;
  37. $pageNum_listadoproductos = 0;
  38. if (isset($_GET['pageNum_listadoproductos'])) {
  39.  $pageNum_listadoproductos = $_GET['pageNum_listadoproductos'];
  40. }
  41. $startRow_listadoproductos = $pageNum_listadoproductos * $maxRows_listadoproductos;
  42.  
  43. mysql_select_db($database_blueberryswebtiendas, $blueberryswebtiendas);
  44. $query_listadoproductos = "SELECT * FROM productos";
  45. $query_limit_listadoproductos = sprintf("%s LIMIT %d, %d", $query_listadoproductos, $startRow_listadoproductos, $maxRows_listadoproductos);
  46. $listadoproductos = mysql_query($query_limit_listadoproductos, $blueberryswebtiendas) or die(mysql_error());
  47. $row_listadoproductos = mysql_fetch_assoc($listadoproductos);
  48.  
  49. if (isset($_GET['totalRows_listadoproductos'])) {
  50.  $totalRows_listadoproductos = $_GET['totalRows_listadoproductos'];
  51. } else {
  52.  $all_listadoproductos = mysql_query($query_listadoproductos);
  53.  $totalRows_listadoproductos = mysql_num_rows($all_listadoproductos);
  54. }
  55. $totalPages_listadoproductos = ceil($totalRows_listadoproductos/$maxRows_listadoproductos)-1;
  56. ?>
  57.  
  58.  
  59.  
  60.  
  61.  
  62. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  63. <html xmlns="http://www.w3.org/1999/xhtml">
  64. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  65. <title>Documento sin t&iacute;tulo</title>
  66. <link href="estiloplantilla.css" rel="stylesheet" type="text/css" />
  67. </head>
  68.  
  69. <div id="contenedor">
  70.   <div id="cabecera">Colocar aquí el contenido para  id "cabecera"</div>
  71.  
  72. <div id="menu">Colocar aquí el contenido para  id "menu"</div>
  73. <div id="contenido">
  74.   <p>Productos de mi tienda:</p>
  75.  
  76.  <!--aqui del do hasta el while repetimos region para que se muestren los productos-->
  77.   <?php do { ?>
  78.     <table width="168" height="173" border="1" align="center">
  79.       <tr>
  80.         <td width="158" align="center"><a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>"><img src="productos/<?php echo $row_listadoproductos['foto_producto']; ?>" width="134" height="91" /></a></td>
  81.         </tr>
  82.       <tr>
  83.         <td height="23" align="center"><?php echo $row_listadoproductos['nombre_producto']; ?></td>
  84.         </tr>
  85.       <tr>
  86.         <td align="center"><?php echo $row_listadoproductos['precio_producto']; ?></td>
  87.         </tr>
  88.     </table>
  89.     <?php } while ($row_listadoproductos = mysql_fetch_assoc($listadoproductos)); ?>
  90. <p>&nbsp;</p>
  91.   <p>paginas</p>
  92.   <p>&nbsp;</p>
  93. </div>
  94. <div id="pie">Colocar aquí el contenido para  id "pie"</div>
  95. </div>
  96. </body>
  97. </html>
  98. <?php
  99. mysql_free_result($listadoproductos);
  100. ?>

esta la pagina a través de la que se accede el usuario registrado

Código HTML:
Ver original
  1. <?php require_once('../Connections/blueberryswebtiendas.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4.  session_start();
  5. }
  6.  
  7. $MM_authorizedUsers = "admin,user,premium";
  8. $MM_donotCheckaccess = "false";
  9.  
  10. // *** Restrict Access To Page: Grant or deny access to this page
  11. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  12.  // For security, start by assuming the visitor is NOT authorized.
  13.  $isValid = False;
  14.  
  15.  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  16.  // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  17.  if (!empty($UserName)) {
  18.    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  19.    // Parse the strings into arrays.
  20.    $arrUsers = Explode(",", $strUsers);
  21.    $arrGroups = Explode(",", $strGroups);
  22.    if (in_array($UserName, $arrUsers)) {
  23.      $isValid = true;
  24.    }
  25.    // Or, you may restrict access to only certain users based on their username.
  26.    if (in_array($UserGroup, $arrGroups)) {
  27.      $isValid = true;
  28.    }
  29.    if (($strUsers == "") && false) {
  30.      $isValid = true;
  31.    }
  32.  }
  33.  return $isValid;
  34. }
  35.  
  36. $MM_restrictGoTo = "../../controlclientes/errorentrada.php";
  37. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  38.  $MM_qsChar = "?";
  39.  $MM_referrer = $_SERVER['PHP_SELF'];
  40.  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  41.  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  42.   $MM_referrer .= "?" . $QUERY_STRING;
  43.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  44.   header("Location: ". $MM_restrictGoTo);
  45.   exit;
  46. }
  47. ?>
  48. <?php
  49. if (!function_exists("GetSQLValueString")) {
  50. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  51. {
  52.  if (PHP_VERSION < 6) {
  53.    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  54.  }
  55.  
  56.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  57.  
  58.  switch ($theType) {
  59.    case "text":
  60.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  61.      break;    
  62.    case "long":
  63.    case "int":
  64.      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  65.      break;
  66.    case "double":
  67.      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  68.      break;
  69.    case "date":
  70.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  71.      break;
  72.    case "defined":
  73.      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  74.      break;
  75.  }
  76.  return $theValue;
  77. }
  78. }
  79.  
  80. $colname_tienda = "-1";
  81. if (isset($_GET['MM_Username'])) {
  82.  $colname_tienda = $_GET['MM_Username'];
  83. }
  84. mysql_select_db($database_blueberryswebtiendas, $blueberryswebtiendas);
  85. $query_tienda = sprintf("SELECT * FROM tienda WHERE tienda = %s", GetSQLValueString($colname_tienda, "text"));
  86. $tienda = mysql_query($query_tienda, $blueberryswebtiendas) or die(mysql_error());
  87. $row_tienda = mysql_fetch_assoc($tienda);
  88. $totalRows_tienda = mysql_num_rows($tienda);
  89.  
  90. $colname_listadoproductos = "-1";
  91. if (isset($_GET['tienda'])) {
  92.  $colname_listadoproductos = $_GET['tienda'];
  93. }
  94. mysql_select_db($database_blueberryswebtiendas, $blueberryswebtiendas);
  95. $query_listadoproductos = sprintf("SELECT * FROM productos WHERE tienda = %s", GetSQLValueString($colname_listadoproductos, "text"));
  96. $listadoproductos = mysql_query($query_listadoproductos, $blueberryswebtiendas) or die(mysql_error());
  97. $row_listadoproductos = mysql_fetch_assoc($listadoproductos);
  98. $totalRows_listadoproductos = mysql_num_rows($listadoproductos);
  99. ?>
  100. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  101. <html xmlns="http://www.w3.org/1999/xhtml">
  102. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  103. <title>Documento sin t&iacute;tulo</title>
  104. <link href="estilo1.css" rel="stylesheet" type="text/css" />
  105. <link href="../estilo1.css" rel="stylesheet" type="text/css" />
  106. </head>
  107.  
  108. <div id="contenedor">
  109.   <div id="cabecera">Colocar aquí el contenido para  id "cabecera"</div>
  110.  
  111. <div id="menu">Colocar aquí el contenido para  id "menu"</div>
  112. <div id="contenido">
  113.   <p>Nombre de tu tienda: <?php echo $_SESSION['MM_Username'] ?> </p>
  114.   <p>Vista previa de la tienda <a href="http://www.forosdelweb.com/f18/webtiendas/<?php echo $_SESSION['MM_Username']; ?>/index.php" target="_blank">aqui</a></p>
  115. colocar productos </div>
  116. <div id="pie">Colocar aquí el contenido para  id "pie"</div>
  117. </div>
  118. </body>
  119. </html>
  120. <?php
  121. mysql_free_result($tienda);
  122.  
  123. mysql_free_result($listadoproductos);
  124. ?>

pero claro la pagina index debe poder verla todo el mundo por lo tanto las imágenes también por eso no siempre se debe poder acceder a inicio desde la pagina de acccesousuarios me explico bien, jejeje es que me quede hay ya hace días
  #8 (permalink)  
Antiguo 05/10/2011, 17:23
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: juego de registros

Cita:
Iniciado por carolina3 Ver Mensaje
muy buenas no se como explicar esto exactamente, he creado un juego de registros para mostrar una serie de imágenes de una base de datos pero quiero que según el nombre de usuario me muestre unas fotos u otras, como puedo poner el parámetro del nombre de usuario en este link para que me ejecute esto.

el código seria este:

Código PHP:
Ver original
  1. <a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>"><img src="productos/<?php echo $row_listadoproductos['foto_producto']; ?>" width="134" height="91" /></a>

no se si me explico bien, es decir la FOTO_PRODUCTO dependerá del campo TIENDA.

Y de donde quieres relacionar el numbre de usuario si no existe ninguna variable en tu página de index en donde se crea un nombre de usuario o algo por el estilo
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125
  #9 (permalink)  
Antiguo 05/10/2011, 17:31
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: juego de registros

entonces debería crear una variable pasando le como valor el nombre de usuario
  #10 (permalink)  
Antiguo 05/10/2011, 17:50
Avatar de skiper0125  
Fecha de Ingreso: octubre-2010
Ubicación: $this->Mexico('Toluca');
Mensajes: 1.127
Antigüedad: 13 años, 6 meses
Puntos: 511
Respuesta: juego de registros

Cita:
Iniciado por carolina3 Ver Mensaje
entonces debería crear una variable pasando le como valor el nombre de usuario
Efectivamente así es
__________________
Recuerda que estamos aquí para orientarte, y no para hacer tu trabajo.
Si mi aporte fue de ayuda, recuerda que agradecer no cuesta nada +1

Skiper0125

Etiquetas: juego, registro, registros, usuarios
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 18:40.