CurrentFortune = "Default Fortune";
$this->AllFortunes = array();
$this->LoadFortunes();
$this->Count = count($this->AllFortunes);
$this->Randomize();
}
public function LoadFortunes()
{
$readedFortunes = file_get_contents($this->Fortune1Path);
$this->AllFortunes = split("%\n",$readedFortunes);
}
public function Randomize()
{
$this->CurrentFortune = $this->AllFortunes[rand(0,$this->Count-1)];
}
public function PrintCurrentFortune()
{
$this->Randomize();
echo "
$this->CurrentFortune
";
}
}
//$fortune = new Fortunes();
//print $fortune->CurrentFortune;
?>
CurrentFortune = "Default Fortune";
$this->AllFortunes = array();
$this->LoadFortunes();
$this->Count = count($this->AllFortunes);
$this->Randomize();
}
public function LoadFortunes()
{
$readedFortunes = file_get_contents($this->Fortune1Path);
$this->AllFortunes = split("%\n",$readedFortunes);
}
public function Randomize()
{
$this->CurrentFortune = $this->AllFortunes[rand(0,$this->Count-1)];
}
public function PrintCurrentFortune()
{
$this->Randomize();
echo "$this->CurrentFortune
";
}
}
//$fortune = new Fortunes();
//print $fortune->CurrentFortune;
?>
//php/ShowFortune.php
PrintCurrentFortune();
?>
//Index.html
Bemcho's Front door

PrintCurrentFortune();?>
Test MySql