Foros del Web » Programando para Internet » PHP »

ayuda con codigo php

Estas en el tema de ayuda con codigo php en el foro de PHP en Foros del Web. saludos foro tengo una consulta que hacerles, bueno tengo un pequeño sistema de noticias en php, todo funciona bien, solo que me piden hacer esto, ...
  #1 (permalink)  
Antiguo 27/07/2008, 16:19
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Pregunta ayuda con codigo php

saludos foro tengo una consulta que hacerles, bueno tengo un pequeño sistema de noticias en php, todo funciona bien, solo que me piden hacer esto, las noticias van acompañadas de un pdf que se ve cuando alguien hace clic en el titulo de la noticia se habre en otra ventana y ahi se ve el pdf, los cuales se guardan en una carpeta pdf_soporte, ya he programado un php para subir los pdf desde la pc, pero no logro indicarle al php que cuando hagan clic en el titulo se habra el pdf que le corresponde, mi idea es usar los id de las noticias pero hasta hay llego, mi pregunta es como puedo hacer eso, gracias por la ayuda que me den
  #2 (permalink)  
Antiguo 27/07/2008, 17:14
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

mm, con una base de datos ó con archivos,
si es con base de datos, crea una tabla llamada noticia, dos campos, uno con el titulo de la noticia y la direccion de la noticia. cuando den un click, haces la consulta para ver cual archivo es el que vas a abrir y lo despliegas.

con archivos, generas por cada linea una cadena con el titulo de la noticia y otra cadena con la direccion del archivo, dejando un espacio en medio de las dos, los espacios del titulo y del archivo, los puedes sustituir por guiones.

cualquier duda, comenta.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #3 (permalink)  
Antiguo 27/07/2008, 17:45
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

uso una base de datos llamada ig que tiene una tabla llamada soporte, bueno aca les pongo mi base de datos para que la vean:

Código:
# phpMyAdmin MySQL-Dump
# version 2.2.5
# http://phpwizard.net/phpMyAdmin/
# http://phpmyadmin.sourceforge.net/ (download page)
#
# servidor: localhost
# Tiempo de Generacion: 27-08-2007 a les 11:34:41
# Version del Servidor: 3.23.47
# Version del PHP: 4.1.1
# Base De Datos : `ig`
# --------------------------------------------------------

#
# Estructura de tabla para tabla `soporte`
#

CREATE TABLE soporte (
  id int(11) NOT NULL auto_increment,
  titulo varchar(150) NOT NULL default '',
  comentario text NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;

#
# Volcar la base de datos para la tabla `soporte`
#

INSERT INTO soporte VALUES (1, 'Lanzamos nuestros nuevos productos', Avisamos a nuestros clientes la llegada de sus nuevos productos marca Extech.\r\n<br>\r\n<br>\r\nAsi es.\r\n');
INSERT INTO soporte VALUES (2, 'Deltha OHM', 'La compañia delta...');
mi idea era usar el id de esta manera: si el id de la noticia es 1, le decia a la persona que iba a subir el pdf mediante un mensaje que el pdf tambien se llamara 1.pdf y asi se iba a subir a mi carpeta pdf_soporte que esta en mi servidor; y asi sucesivamente con el resto de noticias y pdfs que se pongan, mi pregunta es como puedo hacer eso?
  #4 (permalink)  
Antiguo 27/07/2008, 18:07
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

mmm, deja que los usuarios suban sus archivos, pero renombralos una vez que los tengas, puedes hacerle una consulta count a tu tabla, para ver cual es el consecutivo y con ese número renombras el archivo.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #5 (permalink)  
Antiguo 27/07/2008, 18:17
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

Hola norpool1, puedes ponerme un ejemplo de lo que dices teniendo en cuenta la informacion que he posteado hasta el momento? gracias por la ayuda...
  #6 (permalink)  
Antiguo 27/07/2008, 18:40
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

ok,
por ejemplo, yo subo el archivo "mundo de noticias" y es el primero.
entonces en la base de datos, insertas este y el numero 1

ahora, para la ruta, en el link
echo "<a href='/pdf_soporte/$nombre'.pdf>";

esto es en tu archivo que quieres mostrar, donde nombre es el dato que obtienes de la base de datos al hacer la consulta.

Ahora en el upload de los archivos:

primero obviamente se cargan los datos del archivo mediante un form..

luego lo envias a un archivo php, que es donde se procesa el pdf, antes de finalizar el script, haces una consulta a tu tabla, con "select count(*) as total from soporte" para obtener el total de articulos.

Como el nombre del archivo lo tienes en una variable, sabemos cual es el que vamos a renombrar, así que aplicamos lo siguiente:


rename("/pdf_soporte/$nombre_del_archivo", "/pdf_soporte/$total"."pdf");

espero me hayas entendido,, lo haría funcionar, pero no tengo instalado por el momento ni apache ni php, te he contestado en base a experiencia.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #7 (permalink)  
Antiguo 27/07/2008, 19:19
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

aver bueno este es mi archivo php que uso para mostrar mi informacion, bueno para programar esto uso el ultradev 4
ig_nuevos_productos.php
Código PHP:
<?php
 
 
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

 
  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php

  
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php


  
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php
   $Repeat1__numRows 
= -1;
   
$Repeat1__index0;
   
$rs_numRows $rs_numRows $Repeat1__numRows;
?><?php
  
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  
  // set the record count
  
$rs_total $rs->RecordCount();
  
  
// set the number of rows displayed on this page
  
if ($rs_numRows 0) {            // if repeat region set to all records
    
$rs_numRows $rs_total;
  } else if (
$rs_numRows == 0) {    // if no repeat regions
    
$rs_numRows 1;
  }
  
  
// set the first and last displayed record
  
$rs_first 1;
  
$rs_last  $rs_first $rs_numRows 1;
  
  
// if we have the correct record count, check the other stats
  
if ($rs_total != -1) {
    
$rs_numRows min($rs_numRows$rs_total);
    
$rs_first  min($rs_first$rs_total);
    
$rs_last  min($rs_last$rs_total);
  }
  
?><?php $MM_paramName ""?><?php
// *** Move To Record and Go To Record: declare variables

$MM_rs      = &$rs;
$MM_rsCount   $rs_total;
$MM_size      $rs_numRows;
$MM_uniqueCol "id";
$MM_paramName "id";
$MM_offset 0;
$MM_atTotal false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?><?php
// *** Move To Specific Record: handle detail parameter

if ($MM_paramIsDefined && $MM_rsCount != 0) {

  
// get the value of the parameter
  
$param = $$MM_paramName;

  
// find the record with the unique column value equal to the parameter value
  
for ($MM_offset=0; !$MM_rs->EOF$MM_offset++) {
    if (
$MM_rs->Fields($MM_uniqueCol) == $param) break;
    
$MM_rs->MoveNext();
  }

  
// if not found, set the number of records and reset the cursor
  
if ($MM_rs->EOF) {
    if (
$MM_rsCount 0$MM_rsCount $MM_offset;
    if (
$MM_size || $MM_size $MM_rsCount$MM_size $MM_rsCount;
    
$MM_offset 0;

    
// reset the cursor to the beginning
    
$MM_rs->MoveFirst();
  }
}
?><?php
// *** Move To Record: if we dont know the record count, check the display range

if ($MM_rsCount == -1) {

  
// walk to the end of the display range for this page
  
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size || $i $MM_offset $MM_size); $i++) {
    
$MM_rs->MoveNext();
  }

  
// if we walked off the end of the recordset, set MM_rsCount and MM_size
  
if ($MM_rs->EOF) {
    
$MM_rsCount $i;
    if (
$MM_size || $MM_size $MM_rsCount$MM_size $MM_rsCount;
  }

  
// if we walked off the end, set the offset based on page size
  
if ($MM_rs->EOF && !$MM_paramIsDefined) {
    if ((
$MM_rsCount $MM_size) != 0) {  // last page not a full repeat region
      
$MM_offset $MM_rsCount - ($MM_rsCount $MM_size);
    } else {
      
$MM_offset $MM_rsCount $MM_size;
    }
  }

  
// reset the cursor to the beginning
  
$MM_rs->MoveFirst();

  
// move the cursor to the selected record
  
for ($i=0; !$MM_rs->EOF && $i $MM_offset$i++) {
    
$MM_rs->MoveNext();
  }
}
?><?php
// *** Move To Record: update recordset stats

// set the first and last displayed record
$rs_first $MM_offset 1;
$rs_last  $MM_offset $MM_size;
if (
$MM_rsCount != -1) {
  
$rs_first $rs_first<$MM_rsCount?$rs_first:$MM_rsCount;
  
$rs_last  $rs_last<$MM_rsCount?$rs_last:$MM_rsCount;
}

// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -&& $MM_offset $MM_size >= $MM_rsCount);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="estilo_noticias.css" type="text/css">
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <th colspan="3" valign="top" scope="col"> 
      <?include("superior.htm")?>
    </th>
  </tr>
  <tr> 
    <td width="140" valign="top" bgcolor="#FFDF9D"> 
      <?include("izquierda.htm")?>
    </td>
    <td width="480" valign="top" bgcolor="#FFFFFF"> 
      <table width="460" border="0" align="center" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="texto_titulo" colspan="2"> 
            <table border="0" cellpadding="0" cellspacing="0" width="436">
              <!-- fwtable fwsrc="titulo.png" fwbase="titulo.jpg" fwstyle="Dreamweaver" fwdocid = "694147630" fwnested="0" -->
              <tr> 
                <td><img src="img/spacer.gif" width="2" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="396" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="38" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="1" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td colspan="3"><img name="titulo_r1_c1" src="img/titulo_r1_c1.jpg" width="436" height="3" border="0" id="titulo_r1_c1" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="3" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td rowspan="2"><img name="titulo_r2_c1" src="img/titulo_r2_c1.jpg" width="2" height="27" border="0" id="titulo_r2_c1" alt="" /></td>
                <td background="img/titulo_r2_c2.jpg"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="396" height="25">
                    <param name="movie" value="flash/ig_nuevos_productos.swf">
                    <param name="quality" value="high">
                    <param name="wmode" value="transparent">
                    <embed src="flash/ig_nuevos_productos.swf" width="396" height="25" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent">
                    </embed> 
                  </object></td>
                <td rowspan="2"><img name="titulo_r2_c3" src="img/titulo_r2_c3.jpg" width="38" height="27" border="0" id="titulo_r2_c3" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="25" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td><img name="titulo_r3_c2" src="img/titulo_r3_c2.jpg" width="396" height="2" border="0" id="titulo_r3_c2" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="2" border="0" alt="" /></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td class="texto_titulo">&nbsp;</td>
          <td class="texto_titulo" valign="top">&nbsp; </td>
        </tr>
        <tr> 
          <td colspan="2"> 
            <?php while (($Repeat1__numRows-- != 0) && (!$rs->EOF)) 
   { 
?>
            <table width="460" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="120"><img src="fotos_soporte/<?php echo $rs->Fields("id")?>.jpg" width="100" height="100"></td>
                <td valign="top" width="340"><a href="pdf_soporte/<?php echo $rs-Fields("id")?>.pdf"><?php echo $rs->Fields("titulo")?></a><br />

                  <span class="texto_comentario"> 
                  <?php echo $rs->Fields("comentario")?>
                  </span></td>
              </tr>
              <tr> 
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td colspan="2"> 
                  <hr>
                </td>
              </tr>
            </table>
            <?php
  $Repeat1__index
++;
  
$rs->MoveNext();
}
?>
          </td>
        </tr>
      </table>
      <p align="center">&nbsp;</p>
      <p align="right"><a href="javascript:window.history.back()"><span class="texto_comentario">&gt;&gt; 
        Regresar</span></a><br>
      </p>
    </td>
    <td width="140" valign="top" bgcolor="#FFDF9D"> 
      <?include("derecha.htm")?>
    </td>
  </tr>
  <tr> 
    <td colspan="3" valign="top" bgcolor="#FFFFFF"> 
      <?include("base.htm")?>
    </td>
  </tr>
</table>
</body>
</html>
<?php
  $rs
->Close();
?>
<?php
  $rs
->Close();
?>
<?php
  $rs
->Close();
?>
  #8 (permalink)  
Antiguo 27/07/2008, 19:20
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

y el archivo para subir mis pdf es este:

subir_pdf.php
Código PHP:
<!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>::: Subir PDF  ::</title>
<link rel="stylesheet" href="estilo_deportes.css" type="text/css">
<link rel="stylesheet" href="estilo_noticias.css" type="text/css">
</head>

<body bgcolor="#FFFFFF">
<p class="texto_titulo">Subir Archivos PDF::</p>
<ol>
  <li><span class="texto_titulo">Nota:</span><br>
    <span class="texto_comentario">para subir pdf tener en cuenta el numero 
    de IP noticia, ejemplo: si e IPnoticia es 1, el PDF debe llamarse 1.pdf</span></li>
</ol>
<p>
  <?php
if ($enviar) {
move_uploaded_file($archivo,"pdf_soporte/$archivo_name");
$url "pdf_soporte/".$archivo_name;
chmod($url,0777);
echo 
"PDF subido exitosamente"
}
else {
?>
</p>
<Form method="post" action="subir_pdf.php" enctype="multipart/form-data"> 
  <input type="file" name="archivo">
  <br>
  <input name="enviar" type="submit">
  <?php
}
?>

</body>
</html>
segun tu ejemplo, tengo que modificar en la parte donde esta el hipervinculo:
pdf_soporte/<?php echo $rs-Fields("id")?>.pdf
  #9 (permalink)  
Antiguo 27/07/2008, 19:35
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

vas a renombrar tu archivo, después de que dice "subido exitosamente".
ya que hasta ese momento lo tienes listo en tus uplodas. antes te mandará error.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #10 (permalink)  
Antiguo 27/07/2008, 19:36
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

y la modificación del id, está correcto.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #11 (permalink)  
Antiguo 28/07/2008, 13:13
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

aver disculpa la ignorancia norpool1 lo he colocado de esta manera:

ig_nuevos_productos.php
Código PHP:
<?php


  
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php


  
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php


  
//    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  
require("./adodb/adodb.inc.php");
  require(
"./Connections/cnSoporte.php");
?><?php
   $rs
=$cnSoporte->Execute("SELECT * FROM soporte") or DIE($cnSoporte->ErrorMsg());
   
$rs_numRows=0;
   
$rs__totalRows=$rs->RecordCount();
?><?php
   $Repeat1__numRows 
= -1;
   
$Repeat1__index0;
   
$rs_numRows $rs_numRows $Repeat1__numRows;
?><?php
  
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  
  // set the record count
  
$rs_total $rs->RecordCount();
  
  
// set the number of rows displayed on this page
  
if ($rs_numRows 0) {            // if repeat region set to all records
    
$rs_numRows $rs_total;
  } else if (
$rs_numRows == 0) {    // if no repeat regions
    
$rs_numRows 1;
  }
  
  
// set the first and last displayed record
  
$rs_first 1;
  
$rs_last  $rs_first $rs_numRows 1;
  
  
// if we have the correct record count, check the other stats
  
if ($rs_total != -1) {
    
$rs_numRows min($rs_numRows$rs_total);
    
$rs_first  min($rs_first$rs_total);
    
$rs_last  min($rs_last$rs_total);
  }
  
?><?php $MM_paramName ""?><?php
// *** Move To Record and Go To Record: declare variables

$MM_rs      = &$rs;
$MM_rsCount   $rs_total;
$MM_size      $rs_numRows;
$MM_uniqueCol "id";
$MM_paramName "id";
$MM_offset 0;
$MM_atTotal false;
$MM_paramIsDefined = ($MM_paramName != "" && isset($$MM_paramName));
?><?php
// *** Move To Specific Record: handle detail parameter

if ($MM_paramIsDefined && $MM_rsCount != 0) {

  
// get the value of the parameter
  
$param = $$MM_paramName;

  
// find the record with the unique column value equal to the parameter value
  
for ($MM_offset=0; !$MM_rs->EOF$MM_offset++) {
    if (
$MM_rs->Fields($MM_uniqueCol) == $param) break;
    
$MM_rs->MoveNext();
  }

  
// if not found, set the number of records and reset the cursor
  
if ($MM_rs->EOF) {
    if (
$MM_rsCount 0$MM_rsCount $MM_offset;
    if (
$MM_size || $MM_size $MM_rsCount$MM_size $MM_rsCount;
    
$MM_offset 0;

    
// reset the cursor to the beginning
    
$MM_rs->MoveFirst();
  }
}
?><?php
// *** Move To Record: if we dont know the record count, check the display range

if ($MM_rsCount == -1) {

  
// walk to the end of the display range for this page
  
for ($i=$MM_offset; !$MM_rs->EOF && ($MM_size || $i $MM_offset $MM_size); $i++) {
    
$MM_rs->MoveNext();
  }

  
// if we walked off the end of the recordset, set MM_rsCount and MM_size
  
if ($MM_rs->EOF) {
    
$MM_rsCount $i;
    if (
$MM_size || $MM_size $MM_rsCount$MM_size $MM_rsCount;
  }

  
// if we walked off the end, set the offset based on page size
  
if ($MM_rs->EOF && !$MM_paramIsDefined) {
    if ((
$MM_rsCount $MM_size) != 0) {  // last page not a full repeat region
      
$MM_offset $MM_rsCount - ($MM_rsCount $MM_size);
    } else {
      
$MM_offset $MM_rsCount $MM_size;
    }
  }

  
// reset the cursor to the beginning
  
$MM_rs->MoveFirst();

  
// move the cursor to the selected record
  
for ($i=0; !$MM_rs->EOF && $i $MM_offset$i++) {
    
$MM_rs->MoveNext();
  }
}
?><?php
// *** Move To Record: update recordset stats

// set the first and last displayed record
$rs_first $MM_offset 1;
$rs_last  $MM_offset $MM_size;
if (
$MM_rsCount != -1) {
  
$rs_first $rs_first<$MM_rsCount?$rs_first:$MM_rsCount;
  
$rs_last  $rs_last<$MM_rsCount?$rs_last:$MM_rsCount;
}

// set the boolean used by hide region to check if we are on the last record
$MM_atTotal = ($MM_rsCount != -&& $MM_offset $MM_size >= $MM_rsCount);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="estilo_noticias.css" type="text/css">
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <th colspan="3" valign="top" scope="col"> 
      <?include("superior.htm")?>
    </th>
  </tr>
  <tr> 
    <td width="140" valign="top" bgcolor="#FFDF9D"> 
      <?include("izquierda.htm")?>
    </td>
    <td width="480" valign="top" bgcolor="#FFFFFF"> 
      <table width="460" border="0" align="center" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="texto_titulo" colspan="2"> 
            <table border="0" cellpadding="0" cellspacing="0" width="436">
              <!-- fwtable fwsrc="titulo.png" fwbase="titulo.jpg" fwstyle="Dreamweaver" fwdocid = "694147630" fwnested="0" -->
              <tr> 
                <td><img src="img/spacer.gif" width="2" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="396" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="38" height="1" border="0" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="1" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td colspan="3"><img name="titulo_r1_c1" src="img/titulo_r1_c1.jpg" width="436" height="3" border="0" id="titulo_r1_c1" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="3" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td rowspan="2"><img name="titulo_r2_c1" src="img/titulo_r2_c1.jpg" width="2" height="27" border="0" id="titulo_r2_c1" alt="" /></td>
                <td background="img/titulo_r2_c2.jpg"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="396" height="25">
                    <param name="movie" value="flash/ig_nuevos_productos.swf">
                    <param name="quality" value="high">
                    <param name="wmode" value="transparent">
                    <embed src="flash/ig_nuevos_productos.swf" width="396" height="25" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent">
                    </embed> 
                  </object></td>
                <td rowspan="2"><img name="titulo_r2_c3" src="img/titulo_r2_c3.jpg" width="38" height="27" border="0" id="titulo_r2_c3" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="25" border="0" alt="" /></td>
              </tr>
              <tr> 
                <td><img name="titulo_r3_c2" src="img/titulo_r3_c2.jpg" width="396" height="2" border="0" id="titulo_r3_c2" alt="" /></td>
                <td><img src="img/spacer.gif" width="1" height="2" border="0" alt="" /></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td class="texto_titulo">&nbsp;</td>
          <td class="texto_titulo" valign="top">&nbsp; </td>
        </tr>
        <tr> 
          <td colspan="2"> 
            <?php while (($Repeat1__numRows-- != 0) && (!$rs->EOF)) 
   { 
?>
            <table width="460" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="120"><img src="fotos_soporte/<?php echo $rs->Fields("id")?>.jpg" width="100" height="100"></td>
                <td valign="top" width="340"><a href="echo ahref=/pdf_soporte/$nombre.pdf;"> 
                  <?php echo $rs->Fields("titulo")?>
                  </a><br />

                  <span class="texto_comentario"> 
                  <?php echo $rs->Fields("comentario")?>
                  </span></td>
              </tr>
              <tr> 
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td colspan="2"> 
                  <hr>
                </td>
              </tr>
            </table>
            <?php
  $Repeat1__index
++;
  
$rs->MoveNext();
}
?>
          </td>
        </tr>
      </table>
      <p align="center">&nbsp;</p>
      <p align="right"><a href="javascript:window.history.back()"><span class="texto_comentario">&gt;&gt; 
        Regresar</span></a><br>
      </p>
    </td>
    <td width="140" valign="top" bgcolor="#FFDF9D"> 
      <?include("derecha.htm")?>
    </td>
  </tr>
  <tr> 
    <td colspan="3" valign="top" bgcolor="#FFFFFF"> 
      <?include("base.htm")?>
    </td>
  </tr>
</table>
</body>
</html>
<?php
  $rs
->Close();
?>
<?php
  $rs
->Close();
?>
<?php
  $rs
->Close();
?>
  #12 (permalink)  
Antiguo 28/07/2008, 13:30
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

y en el subir le hice esto:


pdf_subir.php
Código PHP:
<!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>::: Subir PDF  ::</title>
<link rel="stylesheet" href="estilo_deportes.css" type="text/css">
<link rel="stylesheet" href="estilo_noticias.css" type="text/css">
</head>

<body bgcolor="#FFFFFF">
<p class="texto_titulo">Subir Archivos PDF::</p>
<ol>
  <li><span class="texto_titulo">Nota:</span><br>
    <span class="texto_comentario">para subir pdf tener en cuenta el numero 
    de IP noticia, ejemplo: si e IPnoticia es 1, el PDF debe llamarse 1.pdf</span></li>
</ol>
<p>
  <?php
  select count
(*) as total from soporte
if ($enviar) {
move_uploaded_file($archivo,"pdf_soporte/$archivo_name");
$url "pdf_soporte/".$archivo_name;
chmod($url,0777);
echo 
"PDF subido exitosamente";

rename("/pdf_soporte/$nombre_del_archivo""/pdf_soporte/$total"."pdf"); 
}
else {
?>
</p>
<Form method="post" action="subir_pdf.php" enctype="multipart/form-data"> 
  <input type="file" name="archivo">
  <br>
  <input name="enviar" type="submit">
  <?php
}
?>

</body>
</html>

Última edición por dannysoft; 30/07/2008 a las 07:48
  #13 (permalink)  
Antiguo 30/07/2008, 07:48
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

he cometido algun error?
  #14 (permalink)  
Antiguo 30/07/2008, 10:43
 
Fecha de Ingreso: junio-2006
Ubicación: Jáltipan Veracruz, México
Mensajes: 150
Antigüedad: 17 años, 10 meses
Puntos: 1
Respuesta: ayuda con codigo php

primeramente en la primer página de ingreso en las siguientes líneas,

<td width="120"><img src="fotos_soporte/<?php echo $rs->Fields("id")?>.jpg" width="100" height="100"></td>
<td valign="top" width="340"><a href="echo ahref=/pdf_soporte/$nombre.pdf;">
<?php echo $rs->Fields("titulo")?>

las cambiaremos por:

<td width="120"><img src="fotos_soporte/<?php echo $rs->Fields("id")?>.jpg" width="100" height="100"></td>
<td valign="top" width="340"><a href="/pdf_soporte/<?php echo $rs->Fields("id")?>.pdf;">
<?php echo $rs->Fields("titulo")?>




ahora en la siguiente en la de subir, la línea:

select count(*) as total from soporte

no solo la vas a poner así, sino que vas a hacer una consulta con esa instrucción para obtengas el total de registros y veas cual es el consecutivo, por lo que veo usas dreamweber y es orientado a objetos, en especial no me gusta dreamweber, me gusta más el código limpio y propio, pero bueno eso es otra cosa,

una vez que hagas esa consulta, obtendrás un total de registros, lo guardas en una variable que se llame $nombre.

cuando la obtengas esa variable, renombras tu archivo.

en la línea que dice:

rename("/pdf_soporte/$nombre_del_archivo", "/pdf_soporte/$total"."pdf");

la vas a cambiar de acuerdo a la variable obtenida por:

rename("/pdf_soporte/$archivo_name", "/pdf_soporte/$nombre"."pdf");



espero me hayas entendido, cualquier duda, comenta.
__________________
" La vida es un programa que no hemos logrado depurar."
"El programar tu vida es como si le metieras más errores a tu futuro, el proceso es ahora"
  #15 (permalink)  
Antiguo 04/08/2008, 08:25
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: ayuda con codigo php

gracias por la ayuda amigo tenias razon, al fin pude hacer esa vaina, mil gracias una vez mas Norpool1
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:32.