Forum Moderators: coopster
<?php
session_start();
$slogin_noauthpage = 0;
$slogin_pagetitle = "Edit Page";
include_once("slogin_lib.inc.php");
include_once("header.inc.php");
include_once("database.php");
if (isset($_REQUEST['id']))
{$idnumber = $_REQUEST['id'];}
else {die ("Could not retreive neccesary data");}
if (isset($_REQUEST['page']))
{$pagename = $_REQUEST['page'];}
else {die ("Could not retreive neccesary data");}
mysql_connect($dbhost,$dbuser,$dbpass) or die ("Couldn't connect to database");
mysql_select_db($dbname) or die ("Couldn't select database");
$query = "SELECT * FROM content WHERE ID='$idnumber' AND Page='$pagename'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo "<table width=\"90%\" border=\"0\" cellpadding=\"4\" align=\"center\" class=\"onder\">\n";
echo "<tr>\n";
echo "<td align=\"center\"><font class=\"uppertext\" size=\"-2\"><b>EDITING PAGE \"{$row['Page']}\" WITH ID \"{$row['ID']}\".</font></b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#838383\">\n";
echo "<form method=\"POST\" action=\"editPageUpdate.php\">\n";
echo "<center>Page Name:<br><input cols=\"45\" type=\"text\" value=\"{$row['Page']}\" name=\"Page\"></center><br>\n";
echo "<center>Link Name:<br><input cols=\"45\" type=\"text\" value=\"{$row['Link']}\" name=\"Link\"></center><br>\n";
echo "<center>Page Content:<br><textarea value=\"{$row['Content']}\" name=\"Content\" rows=\"15\" cols=\"90\"></textarea></center>\n";
echo " <center><input type=\"reset\"> <input type=\"submit\" name=\"submit\" value=\"Submit\"></form>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table><BR>\n\n";
echo "<center>To edit the author or category of a page, click on Edit above.</center>\n\n";
?>
PS: I did use strip_tags() for the comment boxes to only allow <b>, <i> and <u>. But does this remove all the HTML and PHP etc (With other words, can someone insert and run malicious code even when strip_tags() is applied)?