টপিকঃ ডায়নামিক ওয়েব সাইট ও সোর্স কোড
<?php
/****************************************/
/* Author : Sohel Rana */
/* Email : sohel6bd@yahoo.com */
/* Website : www.sohelrana.net */
/* Licence : GPL */
/* Issue Date : 28-01-2013 */
/****************************************/
$fullname = ''; // Your full name
$address = ''; // Your address here, <br> to enter
$username = ''; // Username
$password = ''; // Password
$data = 'data.txt'; // Text file name
//-------------------------------------------- Admin login panel
if (isset($_GET['admin'])) {
if ($username && $password) {
if(($_SERVER['PHP_AUTH_USER'] !== $username) || ( $_SERVER['PHP_AUTH_PW'] !== $password)){
header('WWW-Authenticate: Basic realm=Protected area');
header('HTTP/1.0 401 Unauthorized');
echo "<meta http-equiv='refresh' content='0; url=./' />";
exit;
}
}
}
//-------------------------------------------- Save text to file
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$fp = fopen( "$data" , "w" );
$text = stripslashes($_POST['text']);
fwrite($fp, $text);
fclose($fp);
}
//-------------------------------------------- Read text from file
if (file_exists($data)) {
$text = implode('', file($data));
$body = implode('<br />', file($data));
$body = str_replace(" ", " ", $body);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title><?php echo $fullname; ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
/* By Sohel */
body {
background: #555;
}
#page {
width: 610px;
background: #FFFFFF;
padding: 10px 30px;
margin: 30px auto;
border: 1px solid #ccc;
box-shadow: 0px 0px 15px #000000;
}
#header {
border-bottom: 1px solid #007CB9;
height: 110px;
}
#header img {
margin-right: 12px;
}
#header h2 {
color: #0077B0;
}
#header p {
font-size: 12px;
color: #006595;
}
#body {
color: #4E4E4E;
font-size: 14px;
margin: 25px 0px;
}
#body h1 {
font-size: 20px;
color: #006699;
font-weight: normal;
width: 400px;
border-bottom: solid 2px #006699
}
#body li {
line-height: 10px;
margin-left: 20px;
}
#footer {
color: #999;
font-size: 9px;
text-align: right;
padding-top: 30px;
}
</style>
</head>
<body>
<div id="page">
<div id="header">
<img src="photo.jpg" width="96" height="96" align="left" border="1" />
<h2><?php echo $fullname; ?></h2><p><?php echo $address; ?></p>
</div>
<div id="body">
<?php if (isset($_GET['admin'])) { ?>
<!-- Admin panel -->
<form name="text" action="" method="POST">
<label>Body text:</label>
<textarea name="text" rows="10" cols="73"><?php echo $text; ?></textarea>
<p><input type="submit" name="save" value="Save Change" /></p>
</form>
<p><b>Note:</b>
<b><b>Bold</b></b>,
<u><u>Underline</u></u>,
<i><i>Italic</i></i>,
<p>Paragraph</p>,
<h1>Heading</h1>
</p>
<?php }else{
echo $body; // print body text
} ?>
</div>
<div id="footer"><!-- Don't remove copyright notice -->Designed & Developed by <a href="http://SohelRana.Net">Sohel</a></div>
</div>
</body>
</html>