Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/iiita/
Upload File :
Current File : /var/www/html/mmishra/indem/iiita/webpages.php

<?php
checkadmin($role);
$tbl = 'webpages';
$nature_arr = array('static','file','url','dynamic');
?>
Edit content of this website. Familiarity with HTML is must at this advance level of site administration.<br>
<?php
$id = $_REQUEST['id'];
$title = htmlsafe($_POST['title']);
$nature = htmlsafe($_POST['nature']);
$authentication = htmlsafe($_POST['authentication']);
$content = htmlsafe($_POST['content']);
if ($content) $content = str_replace("\"", "'", $content);
$keywords = htmlsafe($_POST['keywords']);
$submit = $_POST['submit'];

switch ($submit) {
case "SAVE":
        if (mysql_num_rows(mysql_query("select * from $tbl where id='$id'"))) {
                mysql_query("update $tbl set title='$title',nature='$nature',
		authentication='$authentication',content='$content',keywords='$keywords',dated=now() where id='$id'");
        } else {
                mysql_query("insert into $tbl(id,title,nature,authentication,content,keywords,dated) 
		values('$id','$title','$nature','$authentication','$content','$keywords',now())");
        }
        break;

case "DELETE":
        mysql_query("delete from $tbl where id='$id'");
        break;
}

$q = mysql_query("select * from $tbl order by id");
while ($o = mysql_fetch_object($q)) {
        $opt .= "<option value='$o->id'";
	if ($o->id == $id) {
		$opt .= " selected";
		$title = $o->title;
        	$nature = $o->nature;
        	$authentication = $o->authentication;
                $content = htmlsafe($o->content);
                $keywords = $o->keywords;
        }
        $opt .= ">$o->title</option>";
}
echo "<table class='normal'>
<tr><td>Page ID</td>
<td><input type='text' name='id' size='50' value='$id'";
if ($id) echo " readonly";
echo "></td></tr>
<tr><td>Page Title</td>
<td><input type='text' name='title' size='50' value='$title'></td></tr>

<tr><td nowrap>Nature</td>
<td><select name='nature'>";
foreach ($nature_arr as $na) {
	echo "<option value='$na'";
	if ($nature == $na) echo " selected";
	echo ">$na</option>";
}
echo "</select></td></tr>

<tr><td nowrap>Authentication ?</td>
<td><input type='checkbox' name='authentication' value='yes'";
if ($authentication == 'yes') echo ' checked';
echo "> Yes</td></tr>
<tr valign='top'><td>Content</td>
<td><textarea name='content' rows='5' cols='50'>$content</textarea></td></tr>
<tr><td>Keywords</td>
<td><input type='text' name='keywords' size='50' value='$keywords'></td></tr>
<tr><td colspan='2' nowrap><input type='submit' name='submit' value='SAVE' style='width:80px'> ";
if ($id) echo "<input type='submit' name='submit' value='DELETE' style='width:80px'>";
echo "Select Page
<select name='pageid' onchange=\"document.location.href='$PHP_SELF?conf=$conf&id='+this.value\">
<option value=''>New page</option>$opt</select></td></tr>
</table>";

?>
Select page from drop down list box to edit content.<br>
These pages are stored in the database. To access these pages add menu items.