Foros del Web » Programando para Internet » PHP »

Llamar pdf desde una carpeta es posible?

Estas en el tema de Llamar pdf desde una carpeta es posible? en el foro de PHP en Foros del Web. Hola chicos, el tema es este y espero me puedan orientar: Un usuario inicia sesion en mi pagina php conectada a mi bd con mysql-phpmyadmin, ...
  #1 (permalink)  
Antiguo 16/10/2010, 11:12
Usuario no validado
 
Fecha de Ingreso: diciembre-2009
Ubicación: Bogotá
Mensajes: 462
Antigüedad: 14 años, 4 meses
Puntos: 18
Llamar pdf desde una carpeta es posible?

Hola chicos, el tema es este y espero me puedan orientar: Un usuario inicia sesion en mi pagina php conectada a mi bd con mysql-phpmyadmin, y cuando entra, quiero que pueda ver varios archivos, son 14 de el en su sesión.
Son archivos en pdf y cuando ingrese no solo quiero que pueda ver el nombre del archivo, sino que se le pueda dar clic para abrirlo y leerlo.

YO puse en la tabla, en el campo de phpmyadmin la ruta del archivo, pero....

Cómo hago el código para que lo muestre?

Este es mi código:

Código PHP:
<?php require_once('Connections/segurodb.php'); ?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "";
$MM_donotCheckaccess "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
// For security, start by assuming the visitor is NOT authorized. 
  
$isValid False

  
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  
if (!empty($UserName)) { 
    
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    
// Or, you may restrict access to only certain users based on their username. 
    
if (in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && true) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "error.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
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

$colname_rc_logueo "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_rc_logueo $_SESSION['MM_Username'];
}
mysql_select_db($database_segurodb$segurodb);
$query_rc_logueo sprintf("SELECT empresa FROM registro WHERE nit = %s"GetSQLValueString($colname_rc_logueo"int"));
$rc_logueo mysql_query($query_rc_logueo$segurodb) or die(mysql_error());
$row_rc_logueo mysql_fetch_assoc($rc_logueo);
$totalRows_rc_logueo mysql_num_rows($rc_logueo);

$colname_rc_prod "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_rc_prod $_SESSION['MM_Username'];
}
mysql_select_db($database_segurodb$segurodb);
$query_rc_prod sprintf("SELECT * FROM productos WHERE idprod = %s"GetSQLValueString($colname_rc_prod"int"));
$rc_prod mysql_query($query_rc_prod$segurodb) or die(mysql_error());
$row_rc_prod mysql_fetch_assoc($rc_prod);
$totalRows_rc_prod mysql_num_rows($rc_prod);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Palmera Junior - Control de Plagas</title><link rel="shortcut icon" href="favicon.ico"  />
<link href="css/palmera.css" rel="stylesheet" type="text/css" />
<script src="js/AC_RunActiveContent.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">

</script>
</head>
<body>
<div align="center">
  <table width="835" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <!--TABLA PRINCIPAL-->
    <!--FIN TABLA PRINCIPAL-->
    <tr>
      <td width="835" height="328" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <!--TABLA SECUNDARIA PARA BANNER-->
        <tr>
          <td width="835" height="328" valign="top"><!--CELDA SECUNDARIA PARA BANNER--></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="18"></td>
    </tr>
    <tr>
      <td height="252" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <!--TABLA MENU-->
        <tr>
          <td width="835" height="32" align="right" valign="middle" class="campos">Bienvenido, Sres. <?php echo $row_rc_logueo['empresa']; ?>. </td>
          </tr>
        <tr>
          <td height="32" align="center" valign="middle" bgcolor="#FFFFFF" class="titulos_contenido">Has ingresado.            
            <!--CELDA MENU--></td>
          </tr>
        <tr>
          <td height="50" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <!--DWLayoutTable-->
            <tr>
              <td width="835" height="50" valign="top">&nbsp;
                <table border="1">
                  <tr>
                    <td>idprod</td>
                    <td>A1</td>
                    <td>A2</td>
                    <td>A3</td>
                    <td>A4</td>
                    <td>A5</td>
                    <td>A6</td>
                    <td>A7</td>
                    <td>A8</td>
                    <td>A9</td>
                    <td>A10</td>
                    <td>A11</td>
                    <td>A12</td>
                    <td>A13</td>
                    <td>A14</td>
                  </tr>
                  <?php do { ?>
                    <tr>
                      <td><?php echo $row_rc_prod['idprod']; ?></td>
                      <td><?php echo $row_rc_prod['A1']; ?></td>
                      <td><?php echo $row_rc_prod['A2']; ?></td>
                      <td><?php echo $row_rc_prod['A3']; ?></td>
                      <td><?php echo $row_rc_prod['A4']; ?></td>
                      <td><?php echo $row_rc_prod['A5']; ?></td>
                      <td><?php echo $row_rc_prod['A6']; ?></td>
                      <td><?php echo $row_rc_prod['A7']; ?></td>
                      <td><?php echo $row_rc_prod['A8']; ?></td>
                      <td><?php echo $row_rc_prod['A9']; ?></td>
                      <td><?php echo $row_rc_prod['A10']; ?></td>
                      <td><?php echo $row_rc_prod['A11']; ?></td>
                      <td><?php echo $row_rc_prod['A12']; ?></td>
                      <td><?php echo $row_rc_prod['A13']; ?></td>
                      <td><?php echo $row_rc_prod['A14']; ?></td>
                    </tr>
                    <?php } while ($row_rc_prod mysql_fetch_assoc($rc_prod)); ?>
                </table></td>
            </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td height="138"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
        
      </table></td>
    </tr>
    
    <tr>
      <td height="37" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <!--TABLA BARRA-->
        <tr>
          </td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="49" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <!--TABLA FIRMAS-->
        <tr>
          <td width="835" height="49" align="center" valign="middle" class="texto_firma"><!--TERMINA CELDA FIRMAS-->
            <p>&copy;2010 Palmera Junior - Todos los Derechos Reservados.</p>            
            <p><a href="home.html">Inicio</a> | <a href="empresa.html">Nosotros</a> | <a href="servicios.html">Servicios</a> | <a href="mecanismos.html">Mecanismos</a> | <a href="notas.html">Notas</a> | <a href="franquicias.html">Franquicias</a> | <a href="certificaciones.html">Certificaciones</a> | <a href="contactenos.html" target="_blank">Contáctenos</a> | <a href="http://mail.palmerajunior.com" target="_blank">Correo Corporativo</a></a></p>
            <p class="formulario2">Este sitio din&aacute;mico est&aacute; administrado por &copy; Copyright 2010 <a href="http://www.isawebs.net" target="_blank">isawebs.net</a></p></td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php
mysql_free_result
($rc_logueo);

mysql_free_result($rc_prod);
?>
Nota: En el navegador aparece la ruta de donde tengo el archivo porque obviamente, es lo que esta escrito en el campo de la tabla.

Agradezco su orientación.
  #2 (permalink)  
Antiguo 16/10/2010, 11:30
Avatar de CazaresLuis  
Fecha de Ingreso: septiembre-2010
Ubicación: Distrito Federal
Mensajes: 67
Antigüedad: 13 años, 6 meses
Puntos: 2
Información Respuesta: Llamar pdf desde una carpeta es posible?

Tienes prácticamente todo hecho, solo tienes que hacer algo asi para mostrar tus archivos

Código HTML:
<a href="<?php echo $rutaArchivo ?>" target="_blank" title="Mostrar Archivo">Nombre del Archivo</> 
Espero te sirva

Saludos
  #3 (permalink)  
Antiguo 16/10/2010, 11:35
Usuario no validado
 
Fecha de Ingreso: diciembre-2009
Ubicación: Bogotá
Mensajes: 462
Antigüedad: 14 años, 4 meses
Puntos: 18
Respuesta: Llamar pdf desde una carpeta es posible?

Va un primer intento y no funcionó, voy a seguir...tu lo probaste?
  #4 (permalink)  
Antiguo 16/10/2010, 11:39
Usuario no validado
 
Fecha de Ingreso: diciembre-2009
Ubicación: Bogotá
Mensajes: 462
Antigüedad: 14 años, 4 meses
Puntos: 18
Respuesta: Llamar pdf desde una carpeta es posible?

Listo, lo logré así:

Código PHP:
<td><a href="<?php echo $row_rc_prod['A1']; ?>" target="_blank" title="Mostrar Archivo">a1.pdf</></td>
Mi hermano, quedas en mi corazón.
Me ha resultado casi imposible esto.

Si necesitas algo, desde que te pueda ayudar, con gusto.

Juan Fernando. webmasterARROBAisawebsPUNTOnet.

Etiquetas: llamar, pdf, posible, carpetas
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 23:16.