Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><title>About Us Page</title></head>
- <?php
- $file_name= "loremIpsum.txt";
- $pagetitle = "About Us WebPage ";
- if(file_exists($file_name))
- {
- //open file for writng and place pointer at the end
- $handle = fopen($file_name, 'a+');
- if(!$handle)
- {
- die("couldn't open file <i>$file_name</i>");
- }
- fputs($handle, $pagetitle . "\n" . date("Y/m/d") );
- echo "success writing to file";
- }
- else
- {
- echo "file <i>$file_name</i> doesn't exists";
- }
- fclose($handle);
- ?>
- <body>
- <h1>About Us</h1>
- <a href="home.php">Home Page</a>
- <a href="about.php">About Us</a>
- <a href="contact.php">Contact Us</a>
- <?php
- $lines = 0;
- if ($fh = fopen('loremIpsum.txt', 'r')) {
- while (!feof($fh)) {
- if (fgets($fh)) {
- $lines++;
- }
- }
- }
- echo $lines; // line count
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment