All pastes #318254 Raw Edit

Something

public php v1 · immutable
#318254 ·published 2007-01-16 09:34 UTC
rendered paste body
<?php  require_once("inc/db/mysql.php");  $conn = mysql_connect($hostname,$username,$password);          mysql_select_db($database);  if((basename(strtolower($_SERVER['HTTP_REFERER'])) != "service_categories.php") && 		 (basename(strtolower($_SERVER['HTTP_REFERER'])) != "service_category_delete.php")) {				echo "this page cannot be accessed directly.<br>".basename($_SERVER['HTTP_REFERER']); exit;	} else {		//echo ''.print_r($_POST).''; exit;		 if(!(($_POST['submit'] && $_POST['delOpt']) || ($_POST['verified'] && $_POST['category']))) {?>				<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"								"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">				<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">				<head>					<meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1" />					<title>content</title>					<link rel="stylesheet" type="text/css" href="inc/css/default.css" />					<link rel="stylesheet" type="text/css" href="inc/css/services.css" />					<script type="text/javascript">						function home()						{							parent.frames[1].location="content.html";						}						function service_categories()						{							parent.frames[1].location="service_categories.php";						}					</script>				</head>				<body>				<div id="topbar">					<div id="header">						<ul>							<li><p><a href="#" id="title" onclick="home(); return false;">Admin Home</a> / <a href="#" id="title" onclick="repository_description(); return false;">Service Categories</a> / Error</p></li>						</ul>					</div>				</div>					<div id="main_content_container">						<h3>Textfield is blank</h3>					</div>				</body>				</html><?	} else if($_POST['delOpt'] && $_POST['submit']){					$delid = mysql_real_escape_string($_POST['delOpt']);						if($delid!="no") {								$query = "select service_types.id as id, service_types.category_name as category, count(services.id) as service_count from service_types join services on services.category_id = service_types.id where service_types.id='".$delid."' group by service_types.id";  				$result = mysql_query($query) or die(mysql_error());							if(mysql_num_rows($result)!=0)				{					$row = mysql_fetch_assoc($result);					$services = true;				} else {					$services = false;				}								if($services) {								?>				<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"								"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">				<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">				<head>					<meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1" />					<title>content</title>					<link rel="stylesheet" type="text/css" href="inc/css/default.css" />					<link rel="stylesheet" type="text/css" href="inc/css/category_delete_warning.css" />					<script type="text/javascript">						function home()						{							parent.frames[1].location="content.html";						}						function service_categories()						{							parent.frames[1].location="service_categories.php";						}					</script>				</head>				<body>				<div id="topbar">					<div id="header">						<ul>							<li><p><a href="#" id="title" onclick="home(); return false;">Admin Home</a> / <a href="#" id="title" onclick="service_categories(); return false;">Service Categories</a> / Delete Category (Warning)</p></li>						</ul>					</div>				</div>				<div id="main_content_container">											<div id="warning_container">						<div class="title"><p>Please confirm that you wish to delete this category</p></div>						<div class="warning_content">							<h1>WARNING:</h1>							<p>The category &quot;<span class="black"><?=$row['category'];?></span>&quot; has <span class="black"><?=$row['service_count'];?></span> services associated with it.</p>							<p>If you choose to continue, the associated services will be deleted.</p>							<div class="warning_bottom">								<h2>ARE YOU SURE YOU WISH TO DELETE THIS CATEGORY?</h2>								<div class="buttons">									<p class="cancel">										<form action="javascript://" onsubmit="service_categories(); return false;">											<input type="submit" value="" class="cancel">										</form>									</p>									<p class="continue">										<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">											<input type="submit" value="" class="continue" />											<input type="hidden" name="category" value="<?=$row['id'];?>" />											<input type="hidden" name="verified" value="true" />										</form>									</p>								</div>							</div>						</div>					</div>				</div>				</body>				</html>						<?					exit;				} else {					$query = "delete from service_types where id=".$delid;								$result = mysql_query($query) or die(mysql_error());									}			}			header("location: service_categories.php");			?>				<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"								"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">				<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">				<head>					<meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1" />					<title>content</title>					<link rel="stylesheet" type="text/css" href="inc/css/default.css" />					<link rel="stylesheet" type="text/css" href="inc/css/what_i_do.css" />					<script type="text/javascript">						function home()						{							parent.frames[1].location="content.html";						}						function service_categories()						{							parent.frames[1].location="service_categories.php";						}					</script>				</head>				<body>				<div id="topbar">					<div id="header">						<ul>							<li><p><a href="#" id="title" onclick="home(); return false;">Admin Home</a> / <a href="#" id="title" onclick="service_categories(); return false;">Service Categories</a> / Deleted Category</p></li>						</ul>					</div>				</div>				<div id="main_content_container">					Updated. Redirecting back...				</div>				</body>				</html><?	} else if($_POST['category'] && $_POST['verified']=="true") {		$query = "delete from services where category_id = ".$_POST['category'];		$result = mysql_query($query) or die(mysql_error());		if(mysql_affected_rows($result)!=0){			$q = "delete from service_types where id = ".$_POST['category'];			$r = mysql_query($query) or die(mysql_error());			if(mysql_affected_rows($r)!=0){				header("location: service_categories.php");			}		}	?>				<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"								"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">				<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">				<head>					<meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1" />					<title>content</title>					<link rel="stylesheet" type="text/css" href="inc/css/default.css" />					<link rel="stylesheet" type="text/css" href="inc/css/what_i_do.css" />					<script type="text/javascript">						function home()						{							parent.frames[1].location="content.html";						}						function service_categories()						{							parent.frames[1].location="service_categories.php";						}					</script>				</head>				<body>				<div id="topbar">					<div id="header">						<ul>							<li><p><a href="#" id="title" onclick="home(); return false;">Admin Home</a> / <a href="#" id="title" onclick="service_categories(); return false;">Service Categories</a> / Deleted Category</p></li>						</ul>					</div>				</div>				<div id="main_content_container">					Updated. Redirecting back...				</div>				</body>				</html>	<?	}}?>