All pastes #393054 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-13 08:53 UTC
rendered paste body
<?php
class Fortunes{
		public  $Fortune1Path ='C:\Fortunes\fortunes';
		public  $CurrentFortune;
		public  $AllFortunes;
		public $Count;
public  function __construct()
{
	$this->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 "<h1>$this->CurrentFortune</h1>";
}
}
//$fortune = new Fortunes();
 //print $fortune->CurrentFortune;
?>
<?php
class Fortunes{
		public  $Fortune1Path ='C:\Fortunes\fortunes';
		public  $CurrentFortune;
		public  $AllFortunes;
		public $Count;
public  function __construct()
{
	$this->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 "<h1>$this->CurrentFortune</h1>";
}
}
//$fortune = new Fortunes();
 //print $fortune->CurrentFortune;
?>
//php/ShowFortune.php

<?php
require_once("php/Fortunes.php"); 
if(!$GLOBALS["fortune"]) $GLOBALS["fortune"] = new Fortunes();
 $temp = $GLOBALS["fortune"];
$temp->PrintCurrentFortune(); 
 ?>
//Index.html
<?php require_once("php/Fortunes.php");$GLOBALS["fortune"] = new Fortunes();?>
<html><body bgcolor="Olive">  <h1> Bemcho's Front door</h1>
<p><a href="php/GetInfoAboutConnectedHost.php"><img src = "apache_pb22_ani.gif" ></a></p>
<body> <img src = "php.gif" ></body>
<body>
<?php $temp = $GLOBALS["fortune"];$temp->PrintCurrentFortune();?></body>
<p><A href = "php/showfortune.php"> <img src="mishoSmall.gif" >  
</A> 
<p><A href="php/testmysql.php"><h1>Test MySql</h1></A>
<br>
</body></html>