All pastes #384471 Raw Edit

index.php

public php v1 · immutable
·published 2007-03-07 02:22 UTC
rendered paste body
<?phpinclude('connect.php');include('header.php');include('logincheck.php');include('include.php');//If search is turned on, show searchbarif($search_on == 1){echo("<p><form method=\"POST\" action=\"index.php\"><input type=\"text\" name=\"search\" size=\"100\"><input type=\"submit\" value=\"Search\" name=\"submit\"></form></p>");}//######################If URL contains article id then....if(isset($_GET['article'])){//Get all values$id = $_GET['article']; //article id$query = mysql_query("SELECT * FROM `guides` WHERE `id` = $id");//Find article Id in databse$row = mysql_fetch_array($query);$title = $row["title"];//Article title$body = $row["body"];//Article body$desc = $row["desc"];//Article description$keywords = $row["keywords"];//Article keywords$link = $row["link"];//Article link$user = $row["user"];//Article author$cat = $row["cat"];//Article category$rcount = $row["rcount"];// number of votes cast$rtotal = $row["rtotal"];//Total ratingif($rcount == "0"){//If no votes cast	$rating =  $art_novotes;}else{//If votes cast	$rating = $rtotal / $rcount; //Divide	$rating = round($rating,1); //Round to 1 digit after decimal}$views = $row["views"];//Total views//If category heirarchy is onif($category_nav_on == 1){echo("<div class=\"category\">				<a href=\"$domain/index.php\">$type</a> &gt; <a href=\"$domain/index.php?cat=$cat\">$cat</a>			</div>");}//Print out main bodyecho $art_body;//Voting feature if onif($voting_on == 1){echo $art_vote;}//Update total viewsmysql_query("UPDATE `guides` SET `views` = `views` + 1 WHERE `id` = '$id'");//#############################Show all articles in this category}elseif(isset($_GET['cat'])){	//Retreive category title	$category = $_GET['cat'];	//Find all guides in this category	$query = mysql_query("SELECT * FROM `guides` WHERE `validated` = 1 AND `cat` = '$category'");		//Category heirarchy	if($category_nav_on){		echo ("<p><div class=\"alt1\">				<a href=\"$domain/index.php\">$type</a> &gt; <a href=\"$domain/index.php?cat=$cat\">$cat</a>			</div></p>");	}//Start the tableecho $cat_init_table;	while ($row = mysql_fetch_array($query)) {//Check if alternate colors onif($list_alt_colors == 1){	$cc+=1;	if($cc % 2 == 0 ){		$col = "alt1";	}else{		$col = "alt2";	}}else{	$col = "alt1";}	//Get all values	$id = $row["id"];	$title = $row["title"];	$body = $row["body"];	$desc = $row["desc"];	$keywords = $row["keywords"];	$link = $row["link"];	$user = $row["user"];	$cat = $row["cat"];	$rcount = $row["rcount"];	$rtotal = $row["rtotal"];	$views = $row["views"];		//List all guides that fit under this category	echo $cat_art_list;	}	//close table	echo ("</table>");//#################################Search feature}elseif(isset($_POST['search'])){//Read in keyword(s) searched$word = $_POST['search'];//Find in db - if it fits more than 50% of total guides, then doesnt show anything$query = mysql_query("SELECT *FROM guidesWHERE MATCH (`body` , `desc` , `keywords`)AGAINST ('$word')");//If turned on, show category heirarchyif($category_nav_on == 1){	echo "<p><div class=\"alt1\">				<a href=\"$domain/index.php\">$type</a> &gt; Search			</div></p>";}//Create table beginningecho $sea_init_table;		while ($row = mysql_fetch_array($query)) {	//Check if alternate colors onif($list_alt_colors == 1){	$cc+=1;	if($cc % 2 == 0 ){		$col = "alt1";	}else{		$col = "alt2";	}}else{	$col = "alt1";}	//Read in all data	$id = $row["id"];	$title = $row["title"];	$body = $row["body"];	$desc = $row["desc"];	$keywords = $row["keywords"];	$link = $row["link"];	$user = $row["user"];	$cat = $row["cat"];	$rcount = $row["rcount"];	$rtotal = $row["rtotal"];	$views = $row["views"];		//List all articles that match 	echo $sea_art_list;		}	echo ("</table>");//##############################No article id set - showing list of guides}elseif(!isset($_GET['article'])){echo "testing";	$query = mysql_query("SELECT * FROM `guides` WHERE `validated` = 1");//If turned on - show category heirarchyif($category_nav_on == 1){	echo "<p><div class=\"alt1\">				<a href=\"$domain/index.php\">$type</a>			</div></p>";}//Begin the table	echo $ini_main_table;				while ($row = mysql_fetch_array($query)) {//Check if alternate colors onif($list_alt_colors == 1){	$cc+=1;	if($cc % 2 == 0 ){		$col = "alt1";	}else{		$col = "alt2";	}}else{	$col = "alt1";}	//Read in all values	$id = $row["id"];	$title = $row['title'];	$body = $row["body"];	$desc = $row["desc"];	$keywords = $row["keywords"];	$link = $row["link"];	$user = $row["user"];	$cat = $row["cat"];	$rcount = $row["rcount"];	$rtotal = $row["rtotal"];	$views = $row["views"];		//Print out main tableprint $main_table;		}//Close tableecho ("</table>");}include('footer.php');?>