Location: PHPKode > projects > PHP Manual Creator > adm/page_edit.php
<?php
require_once("../includes/config.php");
require_once("../includes/functions/func.global.php");
require_once("../includes/functions/loggincheck.php");
require_once("class.menu.php");

// Connect to database
db_connect($config);

IF(isset($_POST['Submit']))
{
	foreach ($_POST['id'] as $value) 
	{
		mysql_query("UPDATE `".$config['db']['pre']."pages` SET `page_title` = '" . addslashes($_POST['title'][$value]). "',`manual_id` = '" . addslashes($_POST['manual'][$value]). "',`page_body` = '" . addslashes($_POST['page_body'][$value]). "',`parent_id` = '" . addslashes($_POST['parent_id'][$value]). "' WHERE `page_id` =".$value." LIMIT 1 ;");
	}
	
	header("Location: page_view.php");
	exit;
}

$obj = new Menu();
$nav = $obj->get_js_menu(0,$config);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PHP Manual Creator Admin - Edit Pages</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="images/style.css">
<script language='JavaScript' src='scripts/innovaeditor.js'></script>
<SCRIPT LANGUAGE="JavaScript" SRC="menu/JSCookMenu.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<script language="JavaScript"><!--
function checkBox(theBox){
  var aBox = theBox.form["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
  }
  if(theBox.name=="selall"){
    for(i=0;i<aBox.length;i++){
      aBox[i].checked = selAll;
    }
    selAll = !selAll;
  }
  //theBox.form.selall.checked = selAll;
}
function init(){
  var theForm = document.f1;
  var aBox = theForm["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
    aBox[i].onclick = function(){checkBox(this)};
  }
  //theForm.selall.checked = selAll;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function pickpage(page,title,id)
{
	document.getElementById('parent_id['+id+']').value = page;
	document.getElementById('parent_title['+id+']').value = title;
}
//--></script>
</head>
<body>
<!--Start top-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" height="42" align="left" background="images/bg_top.gif"><a href="index.php"><img src="images/logo.gif" width="207" height="17" hspace="10" border="0"></a></td>
  </tr>
  <tr>
    <td><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<!--End top-->
<!--Start topmenu-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#F0F0F0" height="25" style="padding-left:20px;" id="menu"><SCRIPT language="JavaScript" type="text/javascript">
			var myMenu =
				
			// Start the menu
[
<?php echo $nav; ?>
];				

			// Output the menu
			cmDraw ('menu', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
			</SCRIPT></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<br>

<!--End topmenu-->
<!--Start heading page-->
<table width="850" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td class="heading"><img src="images/icons/icon_editrule.gif" width="21" height="22" alt="" align="absmiddle" hspace="5">Edit Pages</td>
</tr>
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
</table>
<!--End heading page-->
<!--Start form-->
<br>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC;">
<tr>
<td align="center" bgcolor="#F6F6F6" style="padding:15px;">
  <form action="" method="post" name="f1" id="f1">
<?
$count = 0;
$sql = "SELECT page_id,page_title,manual_id,page_body,parent_id FROM ".$config['db']['pre']."pages ";

foreach ($_POST['list'] as $value) 
{
	IF($count == 0)
	{
		$sql.= "WHERE page_id='" . $value . "'";
	}
	ELSE
	{
		$sql.= " OR page_id='" . $value . "'";
	}
	
	$count++;
} 
$sql.= " LIMIT " . count($_POST['list']);

$query_result = mysql_query($sql);
while ($info = @mysql_fetch_array($query_result))
{
	if($info['parent_id'])
	{
		$partitle = mysql_fetch_row(mysql_query("SELECT page_title FROM ".$config['db']['pre']."pages WHERE page_id='".addslashes($info['parent_id'])."' LIMIT 1"));
		$parent_title = $partitle[0];
	}
	else
	{
		$parent_title = 'None';
	}
?>
<table width="70%" cellpadding="0" cellspacing="2" border="0">
  <tr>
    <td width="35%"><strong>Page ID</strong></td>
    <td>:
        <input name="id[<? echo $info['page_id']; ?>]" type="Text" class="textbox" style="width:316px" value="<? echo $info['page_id']; ?>" disabled>
        <input name="id[<? echo $info['page_id']; ?>]" type="hidden" value="<? echo $info['page_id']; ?>"></td>
  </tr>
  <tr>
    <td width="35%"><strong>Page Title</strong></td>
    <td>:
        <input name="title[<? echo $info['page_id']; ?>]" type="Text" class="textbox" style="width:316px" value="<?=stripslashes($info['page_title']);?>"></td>
  </tr>
  <tr>
	<td><strong>Page Parent: </strong></td>
	<td>:
		<input type="hidden" name="parent_id[<? echo $info['page_id']; ?>]" id="parent_id[<? echo $info['page_id']; ?>]" value="<?=$info['parent_id'];?>"><input name="parent_title[<? echo $info['page_id']; ?>]" type="Text" class="textbox" id="parent_title[<? echo $info['page_id']; ?>]" style="width:40%" value="<?=$parent_title;?>" disabled> <a href="#" onClick="MM_openBrWindow('parent_page.php?id=<? echo $info['page_id']; ?>','parentpage','width=400,height=400')">Choose Parent</a></td>
  </tr>
   <tr>
    <td width="35%"><strong>Manual</strong></td>
    <td>:
	<select name="manual[<? echo $info['page_id']; ?>]" class="textbox" style="width:60%">
<?
$sql2 = "SELECT manual_id,manual_title FROM ".$config['db']['pre']."manuals ORDER BY manual_title";
$query_result2 = mysql_query($sql2);
while ($info2 = @mysql_fetch_array($query_result2))
{
if($info2['manual_id'] == $info['manual_id'])
{
?>
<option value="<?=$info2['manual_id'];?>" selected><?=stripslashes($info2['manual_title']);?></option>
<?
}
else
{
?>
<option value="<?=$info2['manual_id'];?>"><?=stripslashes($info2['manual_title']);?></option>
<?
}
}
?>
				</select></td>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><strong>Page Content: </strong></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2"><textarea name="page_body[<? echo $info['page_id']; ?>]" rows="10" id="page_body[<? echo $info['page_id']; ?>]" style="width:100%;height:200px;"><?=stripslashes($info['page_body']);?></textarea>
	<script>
		var oEdit<? echo $info['page_id']; ?> = new InnovaEditor("oEdit<? echo $info['page_id']; ?>");
		oEdit<? echo $info['page_id']; ?>.REPLACE("page_body[<? echo $info['page_id']; ?>]");
	</script>
			</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
  </tr>
</table>
<br><br>
<?
}
?>
<br>
<br>
<table width="70%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="35%">&nbsp;</td>
    <td>&nbsp;
      <input name="Submit" type="submit" class="button" value="Submit">
&nbsp;
<input name="Reset" type="reset" class="button" value="Reset"></td>
  </tr>
</table>
<br>
  </form>
</td>
</tr>
</table>
<!--End form-->
<br><br>
<!--Start bottom-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td style="padding:15px;" align="center">
<span class="copyright">Copyright &copy; 2007 <a href="http://www.kubelabs.com/phpmanualcreator.php" class="copyright" target="_blank">Kubelabs.com</a> All Rights Reserved.</span></td>
</tr>
</table>
<!--End bottom-->
</body>
</html>
Return current item: PHP Manual Creator