Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/air/
Upload File :
Current File : /var/www/html/mmishra/mm/air/websites.php.bak

<?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 (URL)<br><input type='hidden' name='rowid' value='$rowid'>
<input type='text' name='webid' size='60' value='$webid' readonly>
</td></tr>

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

<tr><td>Logo<br>
<input type='text' name='logo' size='60' value='$logo'>
</td></tr>

<tr><td>Author<br>
<input type='text' name='author' size='60' value='$author'>
</td></tr>

<tr valign='top'><td>Contact<br>
<textarea name='contact' style='width: 100%'>$contact</textarea>
</td></tr>

<tr valign='top'><td>Description<br>
<textarea name='description' style='width: 100%'>$description</textarea>
</td></tr>

<tr valign='top'><td>Keywords<br>
<input type='text' name='keywords' size='60' value='$keywords'>
</td></tr>

<tr valign='top'><td>Footer<br>
<textarea name='footer' style='width: 100%'>$footer</textarea>
</td></tr>

<tr><td>Status<br>
<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><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>";

?>