| Current Path : /var/www/html/mmishra/mm/ada/ |
| Current File : /var/www/html/mmishra/mm/ada/webpages.php |
<?php
checkadmin($role);
?>
Edit page content of the site. Familiarity with HTML tags is must to work at this advance level of site administration.<br>
<?php
$id = $_REQUEST['id'];
if (!$id) $id = 'mmishra';
$title = $_POST['title'];
$content_type = $_POST['content_type'];
$access_scope = $_POST['access_scope'];
$content = $_POST['content'];
if ($content) $content = str_replace("\"", "'", $content);
$keywords = $_POST['keywords'];
$submit = $_POST['submit'];
$tbl = 'webpages';
switch ($submit) {
case "SAVE":
if (mysql_num_rows(mysql_query("select * from $tbl where id='$id'"))) {
mysql_query("update $tbl set title='$title',content_type='$content_type',
access_scope='$access_scope',content='$content',keywords='$keywords',dated=now()
where id='$id'");
} else {
mysql_query("insert into $tbl
(id,title,content_type,access_scope,content,keywords,counter,dated)
values('$id','$title','$content_type','$access_scope','$content','$keywords',0,now())");
}
break;
case "DELETE":
mysql_query("delete from $tbl where id='$id'");
break;
}
echo "Select Page
<select name='pageid' onchange=\"document.location.href='$PHP_SELF?conf=$conf&id='+this.value\">
<option value='mmishra'>New</option>";
$q = mysql_query("select * from $tbl order by id");
while ($o = mysql_fetch_object($q)) {
echo "<option value='$o->id'";
if ($o->id == $id) {
echo " selected";
$title = $o->title;
$content_type = $o->content_type;
$access_scope = $o->access_scope;
$content = $o->content;
$keywords = $o->keywords;
}
$star = '';
if ($o->content_type = 'static' && !$o->content) $star = '*';
echo ">$o->title $star</option>";
}
echo "</select> select page title to edit content
<table class='normal'>
<tr><td>Page ID</td>
<td><input type='text' name='id' size='60' value='$id'></td></tr>
<tr><td>Page Title</td>
<td><input type='text' name='title' size='60' value='$title'></td></tr>
<tr><td>Content Type</td>
<td><select name='content_type'>
<option value='static'>Content</option>
<option value='file'";
if ($content_type == 'file') echo ' selected';
echo ">File</option>
<option value='url'";
if ($content_type == 'url') echo ' selected';
echo ">URL</option>
<option value='dynamic'";
if ($content_type == 'dynamic') echo ' selected';
echo ">Dynamic</option>
</select> for dynamic pages type PHP script name in content field</td></tr>
<tr><td>Access Scope</td>
<td><select name='access_scope'>
<option value='public'>Public</option>
<option value='admin'";
if ($access_scope == 'admin') echo ' selected';
echo ">Admin</option></select>Admin pages will be accessible after user authentication</td></tr>
<tr valign='top'><td>Content</td>
<td><textarea name='content' rows='10' cols='70'>$content</textarea></td></tr>
<tr><td>Keywords</td>
<td><input type='text' name='keywords' size='60' value='$keywords'>
<input type='submit' name='submit' value='SAVE' style='width:80px'> ";
if ($id != 'mmishra') echo "<input type='submit' name='submit' value='DELETE' style='width:80px'>";
echo "</td></tr>
</table>";
?>
These pages are stored in the database. To access these pages add menu items.