| Current Path : /var/www/html/mmishra/mm/bmb/ |
| Current File : /var/www/html/mmishra/mm/bmb/websites.php |
<?php
checkadmin($role);
?>
Create/update website on this delivery platform.
Familiarity with HTML tags is must for web authoring.
Website can be put online/offline by setting status attribute. <br><br>
<?php
$rowid = $_REQUEST['rowid'];
$webid = $_SESSION['webid'];
$title = $_POST['title'];
//if (isset($_POST["userfile"])) upload();
$logo = "images/$webid/logo.jpg";
$author = $_POST['author'];
$contact = htmlsafe($_POST['contact']);
$description = htmlsafe($_POST['description']);
$keywords = $_POST['keywords'];
if (!$keywords) $keywords = $title . ',' . $author;
//$footer = quotemeta($_POST['footer']);
$footer = htmlsafe($_POST['footer']);
$status = $_POST['status'];
$submit = $_POST['submit'];
$tbl = 'websites';
$statuss = array('online','offline');
switch ($submit) {
case "SAVE":
if (mysql_num_rows(mysql_query("select * from $tbl where rowid=$rowid"))) {
mysql_query("update $tbl set webid='$webid',title='$title',logo='$logo',
author='$author',contact='$contact',description='$description',keywords='$keywords',footer='$footer',
status='$status',dateupdation=now() where rowid=$rowid");
//mysql_query("update webpages set webid='".$_POST["webid"]."' where webid='$webid'");
//mysql_query("update webusers set webid='".$_POST["webid"]."' where webid='$webid'");
//mysql_query("update metadata set webid='".$_POST["webid"]."' where webid='$webid'");
//mysql_query("update accesslogs set webid='".$_POST["webid"]."' where webid='$webid'");
//$_SESSION["webid"] = $_POST["webid"];
} else {
$agPath = absolutePath($webid,'gallery');
$adPath = absolutePath($webid,'documents');
$aiPath = absolutePath($webid,'images');
shell_exec("mkdir $agPath $adPath $aiPath $webid");
mysql_query("insert into $tbl
(webid,title,logo,author,contact,description,keywords,footer,
datecreation,dateupdation,dateaccess,status,counter)
values('$webid','$title','$logo','$author','$contact','$description','$keywords','$footer',
now(),now(),now(),'online',1)");
}
break;
case "DELETE":
mysql_query("delete from $tbl where rowid=$rowid");
$rowid = 0;
break;
}
$rs = mysql_query("select * from $tbl where webid='$webid'");
while ($o = mysql_fetch_object($rs)) {
$rowid = $o->rowid;
$title = $o->title;
$logo = $o->logo;
$author = $o->author;
$contact = htmlunsafe($o->contact);
$description = htmlunsafe($o->description);
$keywords = $o->keywords;
$footer = htmlunsafe($o->footer);
$status = $o->status;
}
echo "<table>
<tr><td>WebID</td><td><input type='hidden' name='rowid' value='$rowid'>
<input type='text' name='webid' size='60' value='$webid' readonly>
ID to be used to access this website</td></tr>
<tr><td>Title</td><td>
<input type='text' name='title' size='60' value='$title'>
Appears at title bar of browser, and in banner of website</td></tr>
<tr><td>Logo</td><td>
<input type='text' name='logo' size='60' value='$logo'>
Appears at homepage of this website</td></tr>
<tr><td>Author</td><td>
<input type='text' name='author' size='60' value='$author'>
Appears at homepage of this website</td></tr>
<tr valign='top'><td>Contact</td><td>
<textarea name='contact' style='width: 100%'>$contact</textarea>
Appears at homepage of this website</td></tr>
<tr valign='top'><td>Description</td><td>
<textarea name='description' style='width: 100%'>$description</textarea>
Useful for search engines</td></tr>
<tr valign='top'><td>Keywords</td><td>
<input type='text' name='keywords' size='60' value='$keywords'>
Useful for content indexing for better search</td></tr>
<tr valign='top'><td>Footer</td><td>
<textarea name='footer' style='width: 100%'>$footer</textarea>
Appears at bottom of each webpage</td></tr>
<tr><td>Status</td><td>
<select name='status' style='width: 200px'>";
foreach ($statuss as $st) {
echo "<option value='$st'";
if ($status == $st) echo ' selected';
echo ">$st</option>";
}
echo "</select> Offline site will not be accessible
</td></tr>
<tr><td></td><td>
<input type='submit' name='submit' value='SAVE' style='width: 80px'> ";
if ($rowid > 0) echo "<input type='submit' name='submit' value='DELETE' style='width: 80px'>";
echo "</td></tr>
</table>";
?>