Finally insert the new data into the database.
<?php
$sql = "INSERT INTO cache (id,username,url,date,title,body) VALUES
('','$company','$cacheurl','$date','$titleb','$contentb')";
$resultc = mysql_query($sql);
?>
Finish up by closing the if expression.
<?php
} #end if cache is empty
?>
If the page is in the cache, then set the $showme and $title variables
based on the returned data.
based on the returned data.
<?php
else {
$showme = $resultb[1];
$title = $resultb[0];
}
?>
Integrate printable content with template
The template content is in the $body variable. We will replace
the tokens in the template with the variables in this script.
the tokens in the template with the variables in this script.
<?php
$body2 = str_replace("!TITLE!", $title, $body);
$body2 = str_replace("!URL!", $url, $body2);
$body2 = str_replace("!COMPANY!", $company, $body2);
$body2 = str_replace("!HTTP_REFERER!", $HTTP_REFERER, $body2);
$body2 = str_replace("!CONTENT!", $showme, $body2);
$body2 = str_replace("!LOGO!", $myrow["logo"], $body2);
$body2 = str_replace("!SITENAME!", $myrow["sitename"], $body2);
?>
Show the result
Print the resulting printer version of the webpage and end the print.php script.
<?php
echo $body;
?>