All pastes #183342 Raw Edit

liztar

public php v1 · immutable
#183342 ·published 2006-09-26 20:39 UTC
rendered paste body
<?php // ----------------------------------------------------------------------------------------------------------------------------------------////																					   // Made		 : 2006/25/09															   //																					   // FILENAME  : function_class.php														   // COPYRIGHT : © 2006, Christian Strand Young										   // WWW       : http://www.strandyoung.com/											   // GENERATOR : StrandYoung-CMS	(SYNC)													   //																					   //      This program is not free software, but a part of StrandYoung-CMS. A script 		   //	which is included with the pages build by Christian Strand Young. If you 		   //	make changes to this script in any way, Chrisian Strand Young has no   			   //	responsibility. When you buy this script, it's only you that have access to		   //	it. This script is protected by the copyright law, which says that what you have   //	made by your self is protected by it. If you give this script to others, it's	   //	considered as breaking the law.													   //																					   //	SITE 	:	Kennel Antheartica												   //	DATE	:	September 2006														   //	©	 	:	2006, Kennel Antheartica, NORWAY         						   //	MADE BY	:	Christian Strand Young, christian@strandyoung.com, www.strandyoung.com //	GEN		:	StrandYoung-CMS (SYNC)														   // 																					   		// --------------------------------------------------------------------------------------------------------------------------------------------//// INCLUDES, REQUIRES AND OBJECTS //include './includes/db.php';// END //class functions {	var $list_size = 10;	var $id;		function functions() 	{		$this->id = (int)$_GET['id'];	}			function setListSize( $size )	{		if ( is_numeric( $size ) ) 			$this->list_size = $size;	}		function getMenu() 	{			$query 		= "SELECT id,url,text FROM menu ORDER BY 'id' ASC";		$result 	= mysql_query ($query);					while ($row = mysql_fetch_assoc($result)) {				$id 		= $row['id'];			$url		= $row['url'];			$text		= $row['text'];			echo "<li><a href=\"" . $url . "\">" . $text . "</a></li>\n"; 			}	}		function getPage() 	{			if(is_numeric($this->id))		{				if($this->id == "2")		{			$this->getNews();		}		if($this->id == "5")		{			$this->getResults();		}		if($this->id == "6")		{			$this->getSingleResult();		}		if($this->id == "7")		{			$this->getGallery();		}		if($this->id == "8")		{			$this->getGuestbook();		}		if($this->id == "9")		{			$this->getContact();		}else{			$query 		= "SELECT * FROM pages WHERE id = ".$this->id;		$result 	= mysql_query($query);				while ($row = mysql_fetch_assoc ($result)) {						$id = $row['id'];			$title = $row['title'];			$text = $row['text'];						echo "<h2>$title</h2>\n";			echo $text;					}//endwhile	}	}//endnumeric	}//endfunction		function getSidebar()	{			$query 		= "SELECT * FROM sidebar";		$result 	= mysql_query($query);				$row = mysql_fetch_assoc($result); 						$title = $row['title'];			$text = $row['text'];						echo "<h2>$title</h2>\n";			echo $text;	}		function getContact()	{		echo '			<h2>Contact us</h2><br />		<form action="./kontakt.php" method="post">		Name:<br /> <input type="text" name="name" /><br /><br />		E-mail:<br /> <input name="email" type="text" /><br /><br />		Message: <br /><textarea name="mess"></textarea><br /><br />		<input type="submit" value="Send" name="submit">		</form>				';		}		function getNews()	{		$query 		= "SELECT id, title, text, DATE_FORMAT(date, '%d/%m %Y') as date FROM news ORDER by id";	$result 	= mysql_query($query);				while ($row = mysql_fetch_assoc ($result)) {						$id = $row['id'];			$title = $row['title'];			$date = $row['date'];			$text = $row['text'];						echo "<div class=\"newsbox\">\n";			echo "<div class=\"newsheader\"><h2>$title</h2></div><p style=\"color:#578;\">$date</p>\n";			echo "<div class=\"newstext\">$text</div>\n";			echo "</div>\n";	}	}		function getResults()	{	 	$query 		= "SELECT id, title, result, date FROM results ORDER by id";	$result 	= mysql_query($query);		echo "<h2>Results</h2><ul>";			while ($row = mysql_fetch_assoc ($result)) {						$id = $row['id'];			$title = $row['title'];			$date = $row['date'];						echo "<li><a href=\"index.php?id=6&amp;result=$id\">$title - $date</a></li>\n";		}		echo "</ul>";		}		function getSingleResult()	{			$resultid = $_GET['result'];		$query 		= "SELECT * FROM results WHERE id=$resultid";		$result 	= mysql_query($query);				while ($row = mysql_fetch_assoc ($result)) {						$title = $row['title'];			$date = $row['date'];			$text = $row['result'];						echo "<h2>$title</h2>\n";			echo $text;					}	}		function getgallery()	{			//INSERT		}		############# CAPTCHA					function createCaptcha()				{				  $_SESSION["captcha"] = "";				  for ($i = 0; $i < 5; $i++) {				    $_SESSION["captcha"] .= chr(rand(65, 90));				  }				}				function ensureCaptcha()				{				  if (!isset($_SESSION["captcha"])) {				    createCaptcha();				  }				}			function getGuestbook()	{	ensureCaptcha();    $invalidCaptcha = false;		echo '<h2>Guestbook</h2><div class="gb">';		$query = "SELECT * FROM guestbook ORDER by id ASC";	while ( $row = mysql_fecth_assoc($query)) {		$id 	= $row['id'];	$name 	= $row['name'];	$date	= $row['date'];	$email	= $row['email'];	$url	= $row['url'];	$text	= $row['text'];		echo '<div class="guestbook">';	echo '<div class="gbheader">'.$name.'<br />'.$date.'</div>';	echo '<div class="gcontent">'.$url.'<br />'.$email.'<br />'.$text.'</div>';	echo '</div>';		}	echo '</div>';		if( isset($_POST["submit"])) {		 if (strtoupper($_POST["captcha"]) != $_SESSION["captcha"]) {        $invalidCaptcha = true;        createCaptcha();      } else {			$name = $_POST['name'];		$url  = $_POST['url'];		$email = $_POST['email'];		$text = $_POST['text'];				$query  = "INSERT INTO guestbook(name, date, url, text) VALUES ('$name','','$url','$email','$text');";		if( mysql_query($query))		{			echo "Your query was saved!";		}		}	 if ($invalidCaptcha) { ?>		<hr />		<p>		<b>The verification code was invalid!</b>		</p>	<?php } }  ?>					<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">	Name:<br /><input type="text" name="name"><br />	Email:<br /><input type="text" name="email"><br />	Homepage:<br /><input type="text" value="http://" name="url"><br />	Message:<br />	<textarea name="text">	</textarea><br />		<label for="captcha">	Verification code (five letters) :</label> 	<img src="captcha.php" alt="" style="vertical-align: bottom;" /><input type="text" name="captcha" id="captcha" size="5" /><br />	<input type="submit" name="submit" value="Send">	</form>			<?php	}//endfunction		function visitors()	{	$query	= "SELECT count FROM visitors LIMIT 1";	$result = mysql_query($query);	$row = mysql_fetch_assoc($result);	$count = $row['count'];	echo "<p style=\"color:#79a;\"<br />Besøkende: $count</p>";	}}//end class	?>