Gracias a los dos, pero un momento:
$DIR = '/html';
y articuloID le llega por URL?articuloID=9
el directorio html existe y tiene permisos de escritura y sigue dando ese error. Mirar os pongo los dos archivos que uso a ver si veis el que!!
Código PHP:
<?php
$tiempo = 86400;
// directorio donde guardar los ficheros HTML o cachés
$DIR = '/html';
function cache_abrir() {
global $tiempo,$DIR;
if(file_exists($DIR.'/'.$HTTP_GET_VARS['articuloID'].'.html') &&
time()-filemtime($DIR.'/'.$HTTP_GET_VARS['articuloID'].'.html')<$tiempo) {
include($DIR.'/'.$HTTP_GET_VARS['articuloID'].'.html');
exit();
}
ob_start();
}
function cache_guardar() {
global $html;
$html = ob_get_contents();
ob_end_clean();
$file = fopen($DIR.'/'.$HTTP_GET_VARS['articuloID'].'.html','w') or die("Error al intentar crear fichero.");
@fwrite($file,$html) or die ("Imposible escribir en el fichero");
@fclose($file);
}
?>
Código PHP:
<?php require_once('/home/user/conexiones/conectaB.php'); ?>
<?php include('/home/user/public_html/caching/caching.php');?>
<?php
cache_abrir();
ob_start();
$colname_Recordset1 = "0";
if (isset($HTTP_GET_VARS['articuloID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['articuloID'] : addslashes($HTTP_GET_VARS['articuloID']);
}
mysql_select_db($database_libros, $libros);
$query_Recordset1 = sprintf("SELECT * FROM articulos WHERE articulos.articuloID = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $libros) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$html = ob_get_contents();
ob_end_clean();
cache_guardar($html);
echo $html;
?>
Gracias