Viewing file: bajar_libros_semana.php (2.33 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php require "../frames/class.ftp.php"; include "../frames/conn.php";
if (!$_REQUEST['fecha_inicial']){ ?> <table border=1> <form action="<? echo $_SERVER['PHP_SELF'];?>" method="post"> <tr><td>YYYY-MM-DD <input type="text" name="fecha_inicial"></tr> <tr><td>YYYY-MM-DD <input type="text" name="fecha_final"></tr> <tr><td><input type="submit" value="Submit!"></tr> </table> </form> <? }else{
$ftp_server = "62.193.202.9"; // add server name $ftp_user_name = "gp571133"; // add user name $ftp_user_pass = "j41ondtj"; // add password $dst_dir = "web/extras/fb2/"; // add destination directory ( www/upload/ )
$counter=0; $limite=1000;
$sql="select id from libros where fecha_subida >='". $_POST['fecha_inicial'] ."' and fecha_subida <='". $_POST['fecha_final'] ."' order by id asc"; $res=mysql_query($sql,$conn); /******** sacamos el primer ID y el ultimo $countid=0; while ($ref=mysql_fetch_array($res)){ if ($countid==0){ $idinicial=$ref['id']; $countid++; } $idfinal=$ref['id']; } *///////////// $ftp = new ftp($ftp_server,$ftp_user_name,$ftp_user_pass,$dst_dir); $sqlletras="select * from letras"; // where letra > 'S'"; $resletras=mysql_query($sqlletras,$conn); echo mysql_error(); $counter++; mkdir(trim($_POST['fecha_inicial'])."----".trim($_POST['fecha_final']),0777); while ($rowletras=mysql_fetch_array($resletras)){ // mkdir("./{$rowletras['letra']}", 0777); $sql="select REPLACE(ruta, 'http://www.cocido-maragato.com/extras/fb2/', '') as titulo, id from libros where autor like '{$rowletras['letra']}%' and fecha_subida >='". $_POST['fecha_inicial'] ."' and fecha_subida <='". $_POST['fecha_final'] ."'"; echo $sql."<br>"; flush(); // die(); $res=mysql_query($sql,$conn); while($row9=mysql_fetch_array($res)){ //class constructor $archivo_remoto=$row9['titulo']; $archivo_local="./".trim($_POST['fecha_inicial'])."----".trim($_POST['fecha_final'])."/{$archivo_remoto}"; echo $counter."<br>"; echo $archivo_remoto."<br>"; echo $archivo_local."<br>"; $counter++; $ftp->getfile($archivo_local,$archivo_remoto); } } $ftp->disconnect(); }
?>
|