Ver Mensaje Individual
  #7 (permalink)  
Antiguo 05/10/2011, 17:02
carolina3
 
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