PHP Blog Website Development Example Tutorial (1/8)

Source: Internet
Author: User
Tags flock

post.php a PHP program that reads files and displays the contents of the log.
page.html Displays the HTML document for the log article.
STYLE.CSS Tutorial page shows the effect of the CSS code.
add.php Add a blog article PHP program.
config/auth.php username and password configuration file.
Index.php Blog Homepage program.
edit.php Edit the blog article program.
delete.php Delete the blog article program.
archives.php to file a program that displays blog posts.
logout.php exit the login program.

*/
post.php a PHP program that reads files and displays the contents of the log.

The code is as follows Copy Code

<?php
if (!isset ($_get[' entry '))
{
Echo ' request parameter error ';
Exit
}

$post _data = Array ();

$path = substr ($_get[' entry '],0,6); Log storage Directory
$entry = substr ($_get[' entry '],7,9); Log file name
$file _name = ' contents/'. $path. ' /'. $entry. '. TXT ';

if (file_exists ($file _name))
{
$fp = @fopen ($file _name, ' R ');
if ($FP)
{
Flock ($FP, lock_sh);
$result = Fread ($fp, FileSize ($file _name) *100);
}
Flock ($FP, lock_un);
Fclose ($FP);
}

$content _array = explode (' | ', $result);

$post _data[' subject '] = $content _array[0];
$post _data[' date '] = Date (' y-m-d h:i:s ', $content _array[1]);
$post _data[' content '] = $content _array[2];
Print_r ($post _data);
?>

<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<title> a simple blog</title> based on text
<link rel= "stylesheet" type= "Text/css" href= "Style.css"/>
<body>

<div id= "Container" >
<div id= "Header" >
</div>
<div id= "title" >
----I have dream ....
</div>
<div id= "Left" >
<div id= "Blog_entry" >
<div id= "Blog_title" &GT;&LT;? echo $post _data[' subject '];? ></div>
<div id= "Blog_body" >
<div id= "Blog_date" &GT;&LT;? echo $post _data[' Date '];? ></div>
? echo $post _data[' content '];? >
</div><!--blog_body-->
</div><!--blog_entry-->
</div>

<div id= "Right" >
<div id= "sidebar" >
<div id= "Menu_title" > About me </div>
<div id= "Menu_body" >www.111cn.net</div>
</div>
</div>

<div id= "Footer" >
Copyright 2007
</div>
</div>

<body>

page.html Displays the HTML document for the log article.

The code is as follows Copy Code

<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<title>blog</title>
<link rel= "stylesheet" type= "Text/css" href= "Style.css"/>
<body>

<div id= "Container" >
<div id= "Header" >
</div>
<div id= "title" >
----I have a dream ....
</div>
<div id= "Left" >
<div id= "Blog_entry" >
<div id= "Blog_title" > Log article title </div>
<div id= "Blog_body" >
<div id= "Blog_date" >2007-12-01</div>
Log article content
</div>
</div>
</div>

<div id= "Right" >
<div id= "sidebar" >
<div id= "Menu_title" > About me </div>
<div id= "Menu_body" >www.111cn.net</div>
</div>
</div>

<div id= "Footer" >
Copyright 2007
</div>
</div>

<body>

Home 1 2 3 4 5 6 7 8 last

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.