Help

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
I am sure some quickly written script like this is more secure than chris z's too

PHP:
<?php

if (isset($_GET[p]) && file_exists($_GET[p].".php"))
{

    $allowedpages = array("idx", "band");

    if (in_array($_GET[p],$allowedpages))
    {

        include($_GET[p].".php");

    }
    else
    {

        die("Hacking attempt");

    }

}
else
{

    include("idx.php");

}

?>

All you have to do is add the page name to the array, and it'll work, if it's not in the array then it won't.
 

CascadesAdmin

New Member
Messages
87
Reaction score
0
Points
0
so would this be the right way to use it?

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta http-equiv="Content-Style-Type" content="text/css" />
	<title>Cascades Band</title>
	<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
<?php

if (isset($_GET[p]) && file_exists($_GET[p].".php"))
{

    $allowedpages = array("idx", "band", "shows", "contact", "extras");

    if (in_array($_GET[p],$allowedpages))
    {

        include($_GET[p].".php");

    }
    else
    {

        die("Hacking attempt");

    }

}
else
{

    include("index.php");

}

?>
</head>
<body>
<div id="wrapper">
	<ul id="nav">
		<li><a href="http://www.cascades.exofire.net/index.php?a=idx">Home</a></li>
		<li><a href="http://www.cascades.exofire.net/index.php?a=band">Band</a></li>
		<li><a href="http://www.cascades.exofire.net/index.php?a=shows">Shows</a></li>
		<li><a href="http://www.cascades.exofire.net/index.php?a=contact">Contact</a></li>
		<li><a href="http://www.cascades.exofire.net/index.php?a=extras">Extras</a></li>
	</ul>
	<h1><a href="/"><img src="images/logo1.gif" width="118" height="25" alt="Cascades Band" /></a></h1>
<center><script type="text/javascript" src="http://x10hosting.com/adserve.js?Cascades"></script></center>	
<div id="body">
		<div id="bodyi">
			<div id="bodyj">
				<div id="sidebar">
					<div class="content">
						<h2>Info</h2>
						<p>This site is currently under construction.</p>











						<p class="readmore"><a href="http://www.freewebsitetemplates.com">Read More</a></p>
					</div>
					<div class="divider"></div>
					<div class="content">
						<h2><a href=http://news.cascades.exofire.net/show_news.php>Latest News &amp; Updates</a></h2>



						<p class="readmore"><a href="http://news.cascades.exofire.net/rss.php">Read More</a></p>
					</div>
				</div>
				<div id="content">
					<img src="images/construction2.jpg" width="346" height="234" alt="Under Construction" />
					<div class="content">
						<h2>Latest Album</h2>
						<p>No Albums Yet, Site under Construction.</p>
						<p class="readmore"><a href="http://www.freewebsitetemplates.com">Read More</a></p>
						<div class="divider"></div>
						<h2>Hit List</h2>
						<table summary="track downloads" border="0" cellspacing="0">
						<tr>
							<th width="55%">Tracks</th>
							<th>Album</th>
							<th class="hidden">Dowload links</th>
						</tr>
						<tr>
							<td>None</td>
							<td>None</td>
							<td class="download"><a href="http://www.freewebsitetemplates.com">Download</a></td>
						</tr>
						<tr>
							<td>None</td>
							<td>None</td>
							<td class="download"><a href="http://www.freewebsitetemplates.com">Download</a></td>
						</tr>
						<tr>
							<td>None</td>
							<td>None</td>
							<td class="download"><a href="http://www.freewebsitetemplates.com">Download</a></td>
						</tr>
						<tr>
							<td>None</td>
							<td>None</td>
							<td class="download"><a href="http://www.freewebsitetemplates.com">Download</a></td>
						</tr>
						</table>
						<p class="readmore"><a href="http://www.freewebsitetemplates.com">More Tracks</a></p>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
	</div>
	<p id="power">Powered by <a href="http://www.freewebsitetemplates.com">Free Website Templates</a></p>
</div>
</body>
</html>
 

t2t2t

New Member
Messages
690
Reaction score
0
Points
0
if you want to print text between <head> and </head>, then yes, but probably no.
 
Top