Viewing file: automatismo_onion.php (2.54 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
echo " ejecutar solo desde consola";
include "/home/wwwroot/frames/conn.php";
$sql="SELECT * FROM papyr225_papyre.libros
WHERE inftp=1 and (libros.ruta_onion is NOT null
or libros.ruta_epub_onion is NOT null
or libros.ruta_mobi_onion is NOT null
)
order by id desc ";
$res=mysql_query($sql,$conn);
echo mysql_error();
while ($row=mysql_fetch_array($res)){
// sacamos los datos t los procesamos por separado. Promero, el fichero fb2
//ruta ruta_epub ruta_mobi
//http://papyrefb2.net/libros/16-257.zip
//http://papyrefb2.net/epub/17-338.epub
//http://papyrefb2.net/mobi/17-338.mobi
echo "RUTAS ACTUALES:".chr(10);
echo $row['ruta'].chr(10).$row['ruta_epub'].chr(10).$row['ruta_mobi'].chr(10);
@ob_flush();
@flush();
@ob_end_flush();
$array_libro=explode("/",$row['ruta']);
$elementos=count($array_libro);
$ruta="/home/wwwroot/".$array_libro[$elementos-2]."/".$array_libro[$elementos-1];
$nombre_fichero=$array_libro[$elementos-1];
echo "libro: {$row['id']} ruta fb2:$ruta".chr(10);
// mysql_query("update papyr225_papyre.libros set ruta_remota='http://37.221.170.215/newlibros2/fb2/$nombre_fichero' where id={$row['id']}",$conn);
mysql_query("update papyr225_papyre.libros set ruta_onion='http://jjzxceujcalrwbvp.tor2web.org/newlibros2/fb2/$nombre_fichero' where id={$row['id']}",$conn);
if ($row['ruta_epub']){
$array_libro=explode("/",$row['ruta_epub']);
$elementos=count($array_libro);
$ruta="/home/wwwroot/".$array_libro[$elementos-2]."/".$array_libro[$elementos-1];
$nombre_fichero=$array_libro[$elementos-1];
echo "libro: {$row['id']} ruta epub:$ruta".chr(10);
// unlink ($ruta);
mysql_query("update papyr225_papyre.libros set ruta_epub_onion='http://jjzxceujcalrwbvp.tor2web.org/newlibros2/epub/$nombre_fichero' where id={$row['id']}",$conn);
echo mysql_error().chr(10);
}
if ($row['ruta_mobi']){
$array_libro=explode("/",$row['ruta_mobi']);
$elementos=count($array_libro);
$ruta="/home/wwwroot/".$array_libro[$elementos-2]."/".$array_libro[$elementos-1];
$nombre_fichero=$array_libro[$elementos-1];
echo "libro: {$row['id']} ruta mobi:$ruta".chr(10);
mysql_query("update papyr225_papyre.libros set ruta_mobi_onion='http://jjzxceujcalrwbvp.tor2web.org/newlibros2/mobi/$nombre_fichero' where id={$row['id']}",$conn);
echo mysql_error().chr(10);
}
}
?>
|