Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/ada/backup/
Upload File :
Current File : /var/www/html/mmishra/mm/ada/backup/menus.php.bak

<?php
if ($role != "Admin") {
  	echo "<div align=center>You must be a Site Administrator to access this page</div>";
  	exit;
}
echo "<form name='frmStatic' action='$PHP_SELF?conf=$conf' method='post'>";

$item = $_REQUEST['item'];
$action = $_REQUEST['action'];
if (!$action) $action = 'add';

$id = $_REQUEST['id'];
$subid = $_REQUEST['subid'];
$title = $_POST['title'];
$href = $_POST['href'];
if (!$href) $href = 'submenu'; //default value
$zindex = $_POST['zindex'];
$referer = $_REQUEST['referer'];
$submenu = $_POST['submenu'];
$submit = $_POST['submit'];
$dated = date("Y-m-d");

if ($submit == 'SAVE'){
	if ($title == 'DELETE') {
		mysql_query("delete from menu where id=$id");
	} else {
		switch ($action) {
		case 'add':
			if ($submenu == 'yes') {
				$zindex = 1;
                                $referer = $id;
				mysql_query("insert into menu(title,href,zindex,referer,dated) values('$title','$href',$zindex,$referer,'$dated')");
			} else {
				mysql_query("insert into menu(title,href,zindex,referer,dated) select '$title','$href',zindex+1,referer,'$dated' from menu where id=$id");
			}
			break;
		case 'edit':
  			mysql_query("update menu set title='$title',href='$href' where id=$id");
			break;
		case 'page':
  			mysql_query("update menu set title='$title',href='$href' where id=$id");
			break;
		case 'file':
			break;
		}
		if (mysql_num_rows(mysql_query("select * from webpages where id='$href'"))) {
			mysql_query("update webpages set title='$title' where id='$href'");
		} else {
			mysql_query("insert into webpages(id,title,static,private) values('$href','$title','y','n')");
		}
	}
	menu();
	fixed_links();
} else if ($submit == 'UP' && $zindex>1) {
	mysql_query("update menu set zindex=$zindex where zindex=$zindex-1 and referer=$referer");
	mysql_query("update menu set zindex=$zindex-1 where id=$id");
	menu();
	fixed_links();
} else if ($submit == 'DOWN') {
	mysql_query("update menu set zindex=$zindex where zindex=$zindex+1 and referer=$referer");
	mysql_query("update menu set zindex=$zindex+1 where id=$id");
	menu();
	fixed_links();
}

echo "<table width='100%' class='search'>
<tr valign='top'>
<td><b>Menu</b></td><td><select size='10' style='width: 170px' name='id' 
onchange=\"document.location.href='$PHP_SELF?conf=$conf&id='+this.value\">";

$q1 = mysql_query("select * from menu where referer=0 order by zindex");
while ($q = mysql_fetch_object($q1)) {
	$i++;
	echo "<option value='$q->id'";
	if ($id == $q->id) {
		$menu = $q->title;
		$href = $q->href;
		$zindex = $q->zindex;
		$referer = $q->referer;
		echo " selected";
	}
	echo ">&nbsp;&nbsp;$i&nbsp;$q->title</option>";
}
echo "</select></td>
<td><b>Submenu</b></td><td><select size='10' style='width: 170px' name='subid'
onchange=\"document.location.href='$PHP_SELF?conf=$conf&id=$id&subid='+this.value\">";

$q2 = mysql_query("select * from menu where referer>0 and referer=$id order by zindex");
while ($p = mysql_fetch_object($q2)) {
       	$j++;
       	echo "<option value='$p->id'";
       	if ($subid == $p->id) {
               	$submenu = $p->title;
               	$href = $p->href;
               	$zindex = $p->zindex;
               	$referer = $p->referer;
               	echo " selected";
       	}
        echo ">&nbsp;&nbsp;$j&nbsp;$p->title</option>";
}
echo "</select></td>
</tr><tr>
<td>New</td><td><input type='text' name='menu' value='$menu' size='22'></td>
<td>New</td><td><input type='text' name='submenu' value='$submenu' size='22'></td>
</tr><tr>
<th colspan='4'><input type='submit' name='submit' value='UP'>
<input type='submit' name='submit' value='DOWN'></th>
</tr>
</table>
<br><br><b>Action</b><br>";

echo "<input type='radio' name='action' value='add'
onclick=\"document.location.href='$PHP_SELF?conf=$conf&action='+this.value+'&id='+frmStatic.id.value\"";
if ($action == 'add') {
	$title = '';
	$href = '';
	echo " checked";
}
echo ">After selected menu add new menu
( <input type='checkbox' name='submenu' value='yes'";
if ($submenu == 'yes') {
 	$title = '';
	$href = '';
	$referer = $id;
	echo " checked";
}
echo ">first submenu )
<br>
<input type='radio' name='action' value='edit' 
onclick=\"document.location.href='$PHP_SELF?conf=$conf&action='+this.value+'&id='+frmStatic.id.value\"";
if ($action == 'edit') echo " checked";
echo ">Edit selected menu
<br>
<input type='radio' name='action' value='page'
onclick=\"document.location.href='$PHP_SELF?conf=$conf&action='+this.value+'&id='+frmStatic.id.value\"";
if ($action == 'page') echo " checked";
echo ">Link selected menu to stored page
<br>
<input type='radio' name='action' value='file'
onclick=\"document.location.href='$PHP_SELF?conf=$conf&action='+this.value+'&id='+frmStatic.id.value\"";
if ($action == 'file') echo " checked";
echo ">Link selected menu to my file
<br>
<input type='hidden' name='referer' value='$referer'> 
<input type='hidden' name='zindex' value='$zindex'>
<br> 
Title <input type='text' name='title' value='$title' size='30'> (max. 50 characters)
<br>
";

if ($action == 'upload') {
	echo "
	Link to <input type='file' name='file[]' size='40'> (client side stored file)
	";
} else if ($action == 'page') {
	echo "
	Link to <select name='href'>";
	$q1 = mysql_query("select id,title from innerconf order by title");
	while ($q = mysql_fetch_object($q1)) {
        	echo "<option value='$q->id'";
        	if ($href == $q->id) {
                	$title = $q->title;
                	echo " selected";
        	}
        	echo ">$q->title</option>";
	}
echo "</select> (server side stored page)
";

} else {
	echo "
	Link to <input type='text' name='href' value='$href' size='30'> (default is submenu, url may be specified here)
	";
}
?>
<br>
<input type='submit' name='submit' value='SAVE'>
<br><br>
<b>Note</b><br>
To delete menu from site or submenu from a menu, save it with DELETE in title box.
Please remember that deleting Menu will not delete SUBMENU under it.
 Therefore submenus of deleted menus can be used with another menus. 

</form>
<br><br>