Your IP : 216.73.216.40


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

<?php
checkadmin($role);
?>
Edit page pagecontent of the site. Familiarity with HTML tags is must to work at this advance level of site administration.<br>
<?php
$rowid = $_REQUEST['rowid'];
$linktext = $_POST['linktext'];
$parentid = $_REQUEST['parentid'];
if (!$parentid) $parentid = 0; //top level link
$pagetitle = $_POST['pagetitle'];
$pageid = $_REQUEST['pageid'];
if (!$pageid) $pageid = str_replace(" ","",strtolower($pagetitle)) . $rowid;
else {
	$rs = mysql_query("select rowid from $tbl where pageid='$pageid'");
	if ($rs) $rowid = mysql_fetch_object($rs)->rowid;
}
$pageaccess = $_POST['pageaccess'];
$pagetype = $_POST['pagetype'];
if (!$pagetype) $pagetype = 'html'; //static webpage
$pagecontent = $_POST['pagecontent'];
if ($pagecontent) $pagecontent = str_replace("\"", "'", $pagecontent);
$keyword = $_POST['keyword'];
$dateexpiry = $_POST['dateexpiry'];
$visibility = $_POST['visibility'];
$submit = $_POST['submit'];

$tbl = 'webpages';

$pagetypes = array('menu','html','php','url','file');
$pageaccesses = array('public','admin');
$visibilities = array('enable','disable');

switch ($submit) {
case "SAVE":
        if (mysql_num_rows(mysql_query("select * from $tbl where rowid=$rowid"))) {
                mysql_query("update $tbl set linktext='$linktext',parentid=$parentid,
		pageid='$pageid',pagetitle='$pagetitle',pagetype='$pagetype',pageaccess='$pageaccess',pagecontent='$pagecontent',
		keyword='$keyword',visibility='$visibility',dateupdation=now(),dateexpiry='$dateexpiry' 
		where rowid=$rowid");
        } else {
                mysql_query("insert into $tbl
		(rowid,linktext,parentid,
		pageid,pagetitle,pagetype,pageaccess,pagecontent,
		keyword,datecreation,dateupdation,dateexpiry,visibility,counter) 
		values(NULL,'$linktext',$parentid,
		'$pageid','$pagetitle','$pagetype','$pageaccess','$pagecontent',
		'$keyword',now(),now(),'$datexpiry','$visibility',1)");
        }
        break;

case "DELETE":
        mysql_query("delete from $tbl where rowid=$rowid");
	$linktext = '';
	$parentid = 0;
	$pagetitle = '';
	$pagetype = '';
	$pageaccess = '';
	$pagecontent = '';
	$keyword = '';
	$visibility = '';
	$dateexpiry = '0000-00-00';
        break;
}
echo "<br>
<table class='normal'>
<tr><td>Webpage</td>
<td><select name='rowid' onchange=\"document.location.href='$PHP_SELF?conf=$conf&rowid='+this.value\">
<option value='0'>New</option>";

$rs = mysql_query("select * from $tbl order by pageid");
while ($o = mysql_fetch_object($rs)) {
        echo "<option value='$o->rowid'";
	if ($o->rowid == $rowid) {
		echo " selected";
		$linktext = $o->linktext;
		$parentid = $o->parentid;
		$pageid = $o->pageid;
		$pagetitle = $o->pagetitle;
        	$pagetype = $o->pagetype;
        	$pageaccess = $o->pageaccess;
                $pagecontent = $o->pagecontent;
                $keyword = $o->keyword;
                $visibility = $o->visibility;
                $dateexpiry = $o->dateexpiry;
        }
	$star = '';
	if ($o->pagetype == 'static' && !$o->pagecontent) $star = '*';
        echo ">$o->pagetitle $star</option>";
}
echo "</select> select page to edit content (* indicates blank page)
</td></tr>
<tr><td>Linktext</td>
<td><input type='text' name='linktext' size='60' value='$linktext'>
</td></tr>

<tr><td>Parent</td>
<td><select name='parentid'>
<option value='0'>Homepage</option>";
$rs = mysql_query("select rowid,pagetitle from $tbl where visibility='enable' and pagetype='menu' order by pagetitle");
while ($o = mysql_fetch_object($rs)) {
        echo "<option value='$o->rowid'";
        if ($parentid == $o->rowid) echo " selected";
        echo ">$o->pagetitle</option>";
}
echo "<option value='999'";
if ($parentid == 999) echo " selected";
echo ">Webmaster</option>
</select></td></tr>

<tr><td>Title</td>
<td><input type='text' name='pagetitle' size='60' value='$pagetitle'>
</td></tr>

<tr><td>Access</td>
<td><select name='pageaccess'>";
foreach ($pageaccesses as $pa) {
	echo "<option value='$pa'";
	if ($pageaccess == $pa) echo ' selected';
	echo ">$pa</option>";
}
echo "</select> Admin pages will be accessible after user authentication
</td></tr>

<tr><td>Type</td>
<td><select name='pagetype'>";
foreach ($pagetypes as $pt) {
        echo "<option value='$pt'";
        if ($pagetype == $pt) echo ' selected';
        echo ">" . strtoupper($pt) . "</option>";
}
echo "</select> Use MENU for group of links, HTML for static, PHP for dynamic content
</td></tr>

<tr valign='top'><td>Content</td>
<td><textarea id='content' name='pagecontent' rows='10' cols='70'>$pagecontent</textarea></td></tr>

<tr><td>Keyword</td>
<td><input type='text' name='keyword' size='60' value='$keyword'>
</td></tr>

<tr><td>Expiry Date</td>
<td><input type='text' name='dateexpiry' size='20' value='$dateexpiry'>
</td></tr>

<tr><td>Visibility</td>
<td><select name='visibility'>";
foreach ($visibilities as $vs) {
        echo "<option value='$vs'";
        if ($visibility == $vs) echo ' selected';
        echo ">$vs</option>";
}
echo "</select> Desabled pages will not be linked on this website
</td></tr>
<tr><td></td>
<td><input type='submit' name='submit' value='SAVE' style='wpageidth:80px'> ";
if ($rowid > 0) echo "<input type='submit' name='submit' value='DELETE' style='wpageidth:80px'>";
echo "</td></tr>
</table>";

?>
These pages are stored in the database and is accessible through click of some link only.