Location: PHPKode > projects > ZompLog > admin/page.php
<?php ob_start();

/* Written by Gerben Schmidt, http://scripts.zomp.nl */
include_once("functions.php");
include('config.php');
include("session.php");

include("header.php");


$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }


if(isset($_POST['sortableListsSubmitted'])) {

	$orderArray = SLLists::getOrderArray($_POST['categoriesListOrder'],'categories');
	foreach($orderArray as $item) {
		$query = "UPDATE $table_pages SET pageorder=".$item['order']." WHERE id=".$item['element'];
		$result = mysql_query ($query, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
	}
	header("Location: page.php");
	ob_end_flush();
	 }
	

$user = loadUser($_SESSION['login'],$link,$table_users);

$query = "SELECT * FROM $table_pages ORDER BY pageorder ASC";
$result = mysql_query ($query, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
$numrows = mysql_num_rows($result);
$pages = arrayMaker($result,MYSQL_ASSOC);


?>
<div id="submenu"><a href="newpage.php" class="sub"><?php echo "$lang_newpage"; ?></a>  | <a href="page.php" class="sub"><?php echo "$lang_edit_delete_page"; ?></a></div>


<div id="side">
<div class="title">&nbsp;</div>
<div class="box"><?php
if(!empty($messages)){
	displayErrors($messages);
}

elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
  }

else{
echo "$lang_reorder_pages \"$lang_reorder\".";
}  
  
?>
</div>
<br />
<div class="box">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr valign="top"><td width="22px"><img src="icons/pencil.png" alt="<?php echo "$lang_edit $lang_page"; ?>" title="<?php echo "$lang_edit $lang_page"; ?>" width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_edit $lang_page"; ?></td></tr>
<tr valign="top"><td width="22px"><img src="icons/cross.png" alt="<?php echo "$lang_delete $lang_page"; ?>" title="<?php echo "$lang_delete $lang_page"; ?>" width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_delete $lang_page"; ?></td></tr>
</table>
</div>

</div>


<div id="main">

<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="text">
      <tr>
        <td width="100%"><h1><?php echo "$lang_edit_delete_page"; ?></h1></td>
        </tr>
      <tr>
        <td height="218" valign="top">	 <fieldset id="titlediv">
      <legend><?php echo "$lang_edit_delete_page"; ?></legend>	
 <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="text">
      
              <td><?php
		if(!$numrows){
echo "$lang_no_results";
}	

		  
?></td>
            </tr>
		  <tr>
		  <td>
		  		  

		  <ul id="categories" class="sortableList">
          <?php
foreach($pages as $page){
?>
<li id="item_<?php echo "$page[id]"; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td width="4%"><a href='editor_pages.php?id=<?php echo "$page[id]"; ?>'><img src='icons/pencil.png' border='0' alt="<?php echo "$lang_edit"; ?>" title="<?php echo "$lang_edit"; ?>" ></a></td>
<td width="66%"><?php echo "$page[title]"; ?></td>
<td width="26%">
<?php
$query = "SELECT * FROM $table_pages WHERE id = '$page[id]' AND mainpage = '1'";
$result = mysql_query ($query, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
$numrows = mysql_num_rows($result);
if($numrows){
echo "<strong>$lang_mainpage</strong>";
} ?>
</td>	
<td width="4%"><a href='schredder.php?table=<?php echo "$table_pages"; ?>&id=<?php echo "$page[id]"; ?>' onclick="return verify()"><img src='icons/cross.png' border='0' alt="<?php echo "$lang_delete"; ?>" title="<?php echo "$lang_delete"; ?>"></a></td>
</tr></table></li>



<?php
}
?>
</ul></td>
</tr>
          <tr>
            <td>	  <?php
			if($pages){
$sortableLists->printForm($_SERVER['PHP_SELF'], 'POST', $lang_reorder, 'button');
}
?></td>
          </tr>
        </table>
        </fieldset></td>
      </tr>

    </table>
	
</div>

<?php
$sortableLists->printBottomJS();
?>
<?php include("footer.php"); ?>
Return current item: ZompLog