Location: PHPKode > scripts > Zodiacal Sign > zodiacal-sign/class.Zodiac.php
<?
#########################################################
#	GiveMeEnergy Projects								#
#	Engine by []==ThoRĀ®									#
#	Contact:											#
#	hide@address.com								#
#														#
#	See	More Projects WebSite for updates & patches		#
#	http://projects.moreinteractive.net/				#
#														#
#	$Revision: 1.1 $											#
#########################################################

/*
//			id	signs				date start			date end
			1	aquarius1.gif		from 21 Gennaio 	to 18 Febbraio
			2	aries1.gif			from 21 Marzo 		to 20 Aprile
			3	cancer1.gif			from 22 Giugno 		to 22 luglio
			4	cap1.gif			from 22 Dicembre 	to 20 gennaio
			5	gemini1.gif			from 22 Maggio 		to 22 giugno
			6	leo1.gif			from 22 Luglio 		to 21 agosto
			7	libra1.gif			from 24 Settembre 	to 23 ottobre
			8	pisces1.gif			from 19 Febbraio 	to 20 marzo
			9	sag1.gif			from 22 Novembre 	to 22 dicembre
			10	scorpio1.gif		from 24 Ottobre 	to 21 novembre
			11	taurus1.gif			from 21 Aprile 		to 21 Maggio
			12	virgo1.gif			from 24 Agosto 		to 23 settembre

$zodiacSign	= new Zodiac();
$zodiacSign->getSign(date("d"),date("m"));
$theSign	= ($zodiacSign->isOk())	? $zodiacSign->displaySigns() : $zodiacSign->error;

*/

class Zodiac	{

	function getSign($day,$month)	{

		$this->error	= (($day > 31)		|| ($day < 0))		? "not valid day" : "";
		$this->error	= (($month > 12)	|| ($month < 0))	? "not valid month" : "";
		switch ($month)	{
			case 1:
				$this->zodiac	= ($day <=20)	? "cap1.gif" : "aquarius1.gif";
			break;
			case 2:
				$this->error	= ($day > 29)	? "February has less than ".$day." days" : "";
				$this->zodiac	= ($day <=18)	? "aquarius1.gif" : "pisces1.gif";
			break;
			case 3:
				$this->zodiac	= ($day <=20)	? "pisces1.gif" : "aries1.gif";
			break;
			case 4:
				$this->error	= ($day > 30)	? "April has less than ".$day." days" : "";
				$this->zodiac	= ($day <=20)	? "aries1.gif" : "taurus1.gif";
			break;
			case 5:
				$this->zodiac	= ($day <=21)	? "taurus1.gif" : "gemini1.gif";
			break;
			case 6:
				$this->error	= ($day > 30)	? "June has less than ".$day." days" : "";
				$this->zodiac	= ($day <=22)	? "gemini1.gif" : "cancer1.gif";
			break;
			case 7:
				$this->zodiac	= ($day <=22)	? "cancer1.gif" : "leo1.gif";
			break;
			case 8:
				$this->zodiac	= ($day <=21)	? "leo1.gif" : "virgo1.gif";
			break;
			case 9:
				$this->error	= ($day > 30)	? "September has less than ".$day." days" : "";
				$this->zodiac	= ($day <=23)	? "virgo1.gif" : "libra1.gif";
			break;
			case 10:
				$this->zodiac	= ($day <=23)	? "libra1.gif" : "scorpio1.gif";
			break;
			case 11:
				$this->error	= ($day > 30)	? "November has less than ".$day." days" : "";
				$this->zodiac	= ($day <=21)	? "scorpio1.gif" : "sag1.gif";
			break;
			case 12:
				$this->zodiac	= ($day <=222)	? "sag1.gif" : "cap1.gif";
			break;
		}
	}

	function isOk()	{
		if(isset($this->error) && $this->error != "")
			return FALSE;
		else
			return TRUE;
	}

	function error()	{
		if(isset($this->error) && $this->error != "")
			return $this->error;
	}

	function displaySigns()	{
		$this->view	= $this->zodiac;
		return $this->view;
	}
}
?>
Return current item: Zodiacal Sign