Questo è il file Novitas.php
Codice PHP:
<?php
class Novitas implements iNovitas
{
public $eol = "£";
protected static $tablerows = 1;
protected static $tablecolumn = 1;
public function readNews ()
{
$fpnov = fopen ("news","r");
$byte = "";
while ($byte != $this->eol )
{
$byte = fread ($fpnov, 1);
if ($byte != "£")
echo "$byte";
}
fclose ($fpnov);
}
public function extractRenderNews ()
{
include ("regex.php");
$fpnov = fopen ("news","r");
$nov = array ();
$ref = array ();
$hflag = true;
$byte = '';
$tfnov = "";
while ($byte != $this->eol)
{
$byte = fread ($fpnov,1);
if ($byte != $this->eol)
$tfnov .= $byte;
}
preg_match_all ($novregex, $tfnov, $nov);
preg_match_all ($refregex, $tfnov, $ref);
foreach ($nov[0] as $c=>$vl)
{
echo "<a href=\"/";
echo $ref[0][$c];
echo "\">";
echo "$vl";
echo "</a> <br />";
}
}
public function saveNews ($conts)
{
$fpnov = fopen ("news","w");
fwrite ($fpnov, $conts, strlen ($conts));
fwrite ($fpnov, "£", 1);
}
public function selectQuote ()
{
include ("regex.php");
$fpquot = fopen ("quote","r");
$quoteline = array ();
$quote = array ();
$date = array ();
$tfquot = fread ($fpquot,filesize ("quote"));
preg_match_all ($lineregex,$tfquot,$quoteline);
foreach ($quoteline[0] as $arr)
{
preg_match ($quoteregex,$arr,$quote);
preg_match ($quotedtregex,$arr,$date);
if ($date[0] == date ("d/m/Y"))
{
echo $quote[0];
break;
}
}
}
public function selectImage ()
{
include ("regex.php");
$fpimg = fopen ("dimages","r");
$imageline = array ();
$image = array ();
$description = array ();
$date = array ();
$tfimg = fread ($fpimg,filesize ("dimages"));
preg_match_all ($lineregex,$tfimg,$imageline);
foreach ($imageline[0] as $arr)
{
preg_match ($imagerefregex,$arr,$image);
preg_match ($imagedscrregex,$arr,$description);
preg_match ($quotedtregex,$arr,$date);
if ($date[0] == date ("d/m/Y"))
{
// echo '<a href="',$image[0],'" rel="lightbox" title="',$description[0],'"><img src="',$image[0],'" width="216" alt="" /></a>',$description[0];
break;
}
}
}
}
class Database_Novitas extends Novitas implements iDatabase_Novitas
{
function __construct ($rows, $columns)
{
self::$tablerows = $rows;
self::$tablecolumns = $columns;
}
public function tabNews ()
{
/* Si ringrazia l'implementazione di questa funzione */
return 0;
}
}
?>
Per ragioni di sicurezza è meglio che non posto il file Log_In.php, ma la riga in cui viene settato il cookie è questa:
setcookie ("user",$username);
Dove $username contiene la stringa(ho verificato ed è corretta).