Jump to content

williamh26

Members
  • Posts

    32
  • Joined

  • Last visited

Posts posted by williamh26

  1. thank you very much it works....

    <?php
    include('core/inc/init.inc.php');
       if(isset($_GET['file_id'])) {  
         $file_id=(int)$_GET['file_id'];    
         $file=mysql_query("SELECT file_name, file_expiry FROM files WHERE file_id=$file_id");    
         if(mysql_num_rows($file)!=1){   
           echo'Invalid file Id';
         }else{
           $row=mysql_fetch_assoc($file);
           if ($row['file_expiry']<time()){
               
              echo'This file has expired'; 
           }else{
               
                  $path= file_get_contents('core/files/'.$row['file_name']); 
                  header("Content-Disposition:attachment;filename=\"$row{['file_name']}\"");
                  header('Content-type: application/force-download');
                  header('Content-Length:'.strlen($path));
                  header('Content-type: application/octetstream');
                  echo $path;
           }
         }
    }
    ?>
    

    I   will continue with this project....thnak you

  2. Thank you.... fixed... but now this is the error I have

     

    C:\Users\folder1\AppData\Local\Temp\AADMn2IX.jpg.part could not be saved, because the source file could not be read.

    Try again later, or contact the server administrator.

     

     

    The image failed to saved and download it.

     

    thank you

  3. Hi Guys I trying to download files and I have this error message, hopelly you guys can help me please

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 14

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 15

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 16

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 17

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 18

     

     

    This is the code I use to force the download

    <?php
    include('core/inc/init.inc.php');
       if(isset($_GET['file_id'])) {  
         $file_id=(int)$_GET['file_id'];    
         $file=mysql_query("SELECT file_name, file_expiry FROM files WHERE file_id=$file_id");    
         if(mysql_num_rows($file)!=1){   
           echo'Invalid file Id';
         }else{
           $row=mysql_fetch_assoc($file);
           if ($row['file_expiry']<time()){
              echo'This file has expired'; 
           }else{
                  $path="core/files/{$row['$file_name']}";
                  header('Content-Type:application/octet-stream');
                  header('Content-Description:File Transfer');
                  header('Content-Transfer-Encoding:binary');
                  header("Content-Disposition:attachment;filename=\"{$row['file_name']}\"");
                  header('Content-Length:'.filesize($path));
                  readfile($path);
           }
         }
    }
    ?>
    

    Thank you for your help.....

  4. Hi guy I am trying to get the pagination right. this is my code

    <?php
    echo"<img src='images/banner/ribbon.jpg' align='center' width='500' height='100' alt=''/>";
    $categoria_id = $_GET['cat'];
     $query = "Select count(categoria_id) from categoria where categoria_id = $categoria_id";
     $result = mysql_query($query);
     $row = mysql_fetch_array($result);
     if (mysql_num_rows($result) > 0) {
    
     $per_page = 7;
    
     $pages_query = mysql_query("SELECT COUNT(nombre) from productos WHERE categoria_id=$categoria_id");
     $pages = ceil (mysql_result($pages_query, 0)/$per_page) ;
    
     $page = (isset($_GET['page'])) ? (int)$_GET['page']: 1;
    
     $start = ($page - 1) * $per_page;
    
    
    $sql = mysql_query("SELECT * from productos WHERE categoria_id=$categoria_id LIMIT $start, $per_page");
    
    while($row = mysql_fetch_array($sql)){
     $nombre = $row['nombre'];
     $descripcion = $row['descripcion'];
     $precio = $row['precio'];
     $imagen = $row['imagen'];
    echo"<ul class=leaders>";
    echo"<li><span><a href='images/platos/$imagen.jpg' rel='prettyPhoto[gallery4]' title='$nombre $descripcion' width='489' height='720'><img src='images/platos/$imagen.jpg' rel='prettyPhoto[gallery3]' align='left' width='105' height='90' alt=''/><strong>  $nombre</strong></a></span>";
    echo"<span>$ $precio</span></li>";
    echo"</ul>";
    }
    if($pages >=1 && $page <= $pages) {
    for ($x =1; $x<=$pages; $x++) {
     echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ': '<a href="?page='.$x.'">'.$x.'</a> ';
    }
    
    }
    }
    ?>
    

     

    post-132281-0-86005700-1352249142_thumb.jpg

     

    the problem is that when I click for example page number two in the pagination it shows me the index page... How I FIXT IT...

    OH something else... how i erase the <li> dots?? I am trying with css but with not results.

    THANKS IN ADVANCED

  5. yes

    it looks fine... maybe some modification in the sql query.?

     

    Source code:

     

    <?php
    
    			 $capitulo_id = intval ($_GET['cat']);
    			 $libro_id = intval ($_GET['libro_id']);
    
    			 $query="SELECT * from rv1960 where capitulo_id = $capitulo_id and libro_id= $libro_id";
    			 $result=mysql_query($query);
    			 while($row=mysql_fetch_array($result,MYSQL_ASSOC))
    			 {
    
    					 $libro_id =$row['libro_id'];
    					 $versiculo =$row['versiculo'];
    					 $texto =$row['texto'];
    					 echo "<h3>$versiculo -- $texto</h3><br>";
    					 echo"<p>";
    			 }
    ?>
    

  6. in the link perhaps shoud i put the id field

    like this:

    <a href=\"index.php?content=escritura&cat=$id=id&$capitulo_id&libro_id=$libro_id\">
    

     

    and the code will get

    <?php
    
    			  $capitulo_id = intval ($_GET['cat']);
    			  $libro_id = intval ($_GET['libro_id']);
    			  $id = intval ($_GET['id']);
    
    			 $query="SELECT  * from rv1960 where capitulo_id = $capitulo_id and libro_id= $libro_id and id=$id";
    			 $result=mysql_query($query);
    			 while($row=mysql_fetch_array($result,MYSQL_ASSOC))
    			 {
    				    $id =$row['id'];
    					 $libro_id =$row['libro_id'];
    					 $versiculo =$row['versiculo'];
    					 $texto =$row['texto'];
    					 echo "<h3>$versiculo -- $texto</h3><br>";
    					 echo"<p>";
    			 }
    ?>
    

     

    But i dont know in the select query if it is rigth to put two "and"

     

    i try it.. and i got this result:

     

    Undefined variable: id in C:\wamp\www\Iglesia viviente\includes\capitulo.inc.php

  7. nice it works.... this is the code

     

    <a href=\"index.php?content=escritura&cat=$capitulo_id&libro_id=$libro_id\">Capitulo</a>

     

    then escritura.inc.php

     

    <?php
    
    			  $capitulo_id = intval ($_GET['cat']);
    			  $libro_id = intval ($_GET['libro_id']);
    
    			 $query="SELECT  * from rv1960 where capitulo_id = $capitulo_id and libro_id= $libro_id ";
    			 $result=mysql_query($query);
    			 while($row=mysql_fetch_array($result,MYSQL_ASSOC))
    			 {
    					 $libro_id =$row['libro_id'];
    					 $versiculo =$row['versiculo'];
    					 $texto =$row['texto'];
    					 echo "<h3>$versiculo -- $texto</h3><br>";
    					 echo"<p>";
    			 }
    ?>
    

     

    So, Now it gets all the texto and vesiculo but only from Genesis and not the rest.... what i have to do?? thank you again you the best

  8. Sorry hear that... like I said i am not an expert..... sorry waste your time, i just wanna learn from my mistakes . any ways this is what i think you asked me to do, please just tell me if i am wrong
    I have to retrieve the value of  id_libro, capitulo, versiculo and texto from rv1960 table via Get Method
    <a href=\"index.php?content=texto&cat=$capitulo_id&libro_id=$libro_id\">Capitulo</a>
    $cat = $_GET['cat]';
    $capitulo_id = $_GET['capitulo_id'];
    $id_libro = $_GET['id_libro'];
    Its that rigt???
    

  9. dd.jpg

    i have --> escritura and cat

    so if u understant correctly i used the get method

    $escritura =$_GET['escritura'];

    $cat = $_GET['cat'];

     

    so

    <?php
    
    			  $capitulo =$_GET['libro_id'];
    			  $id_libro = $_GET['cat'];
    			 $query="SELECT  texto,versiculo,capitulo from rv1960
    		    where id_libro =$id_libro and capitulo = $capitulo";
    			 $result=mysql_query($query);
    			 while($row=mysql_fetch_array($result,MYSQL_ASSOC))
    			 {
    
    					 $versiculo =$row['versiculo'];
    
    					 $texto =$row['texto'];
    
    					 echo "<h3>$versiculo -- $texto</h3><br>";
    					 echo"<p>";
    			 }
    ?>
    
    

  10. this is my database structure..

     

    table: biblia table:libros table:capitulos table:rv1960

    testamento_id libro_id capitulo_id id

    nombre testamento_id libro_id id_libro

    nombre capitulo capitulo

    versiculo

    texto

  11. hi, sorry but i am new a this..... this is what you trying to tell me??

    <?php
    
    	   $capitulo =$_GET['id_libro'];
    	  $id_libro = $_GET['cat'];
    	 $query="SELECT  id_libro,texto,versiculo, capitulo from rv1960
        where id_libro =$id_libro
        and capitulo = $capitulo";
    	 $result=mysql_query($query);
    	 while($row=mysql_fetch_array($result,MYSQL_ASSOC))
    	 {
    		 $id_libro =$row['id_libro'];
    		 $versiculo =$row['versiculo'];
    		 $capitulo =$row['capitulo'];
    		 $texto =$row['texto'];
    
    		 echo "<h3>$versiculo -- $texto</h3><br>";
    		 echo"<p>";
    	 }
    ?>
    

     

     

    i hve an error: undefine id_libro

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.