WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Another script to display news from files in a directory. This version does not use the UNIX ls command and works also on Windows NT. Files will be sorted in descending order by modification date. You may include html links in the text file.
Categories : HTML, Filesystem, PHP Update Picture
Benjamin Stocker
Date : Jan 17th 1999
Grade : 2 of 5 (graded 4 times)
Viewed : 11431
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Benjamin Stocker
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

// Another script do display news from files in a directory.
// This version does not use the UNIX ls command and works also on Windows NT.
// Files will be sorted in descending order by modification date
// 7.9.1998 Benjamin Stocker, n&s Informationssysteme, 4900 Langenthal, Swiss
// email: BenjaminS@n-s.ch


<html>
<head>
<title>News</title>
</head>
<body bfcolor="#ffffff">
<h1>News</h1>
<div align="center">
<table border="0" cellspacing="5" cellpadding="10" width="90%" bgcolor="#e0e0e0">

<?php

function createurl($text) {
// Insert URL into text
// Use the following syntax: ${http://mysite.ch}
// Or: ${http://mysite.ch|My homepage in Swiss}
$s = $text;
$a=strstr($s, '${');
if ($a) {
$b=strstr($a, '}');
if ($b) {
$la=strlen($a); $ls=strlen($s);
$s=substr($s,0,$ls-$la);
$a=substr($a,2);
$lb=strlen($b); $la=strlen($a);
$a=substr($a,0,$la-$lb); $b=substr($b,1);
$ta=strstr($a, "|");
if ($ta) {
$la=strlen($a); $lt=strlen($ta);
$linktext=substr($a,$la-$lt+1);
$a=substr($a,0,$la-$lt);
} else {
$linktext=$a;
}
$s=$s. "<a href=\"".$a. "\">".$linktext. "</a>".$b;
}
}
return($s);
}

// change this to the directory of your news files
// they should be plain ASCII text files with extension ".txt"
$newspath = "c:\\apache\\htdocs\\news\\";

// Declare array to hold filenames
$newsfile = array();

// Create handle to search directory $newspath for files
$hd = dir($newspath);

// Get all files and store them in array
while( $filename = $hd->read() ) {
$s=strtolower($filename);
if (strstr($s, ".txt")) {
// Determine last modification date
$lastchanged=filemtime($newspath.$filename);
$newsfile[$filename] = $lastchanged;
}
}

// Sort files in descending order
arsort($newsfile);
// Output files to browser
for(reset($newsfile); $key = key($newsfile); next($newsfile)) {
$fa = file($newspath.$key);
$n=count($fa);
print "<tr><td>\n";
print "<b>".date( "d.m.Y - H:i:s",$newsfile[$key]). "</b><br>\n";
for ($i=0; $i<$n; $i=$i+1) {
$s=chop($fa[$i]);
$s=htmlspecialchars($s);
$s=createurl($s);
print $s. "<br>\n";
}
print "</td></tr>";
}

$hd->close();

?>

</table>
</div>
</body>
</html>



Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Take multiple text files and do simple formatting on them and add them to a webpage
Categories : HTML, Filesystem, PHP
color codes for positive and negative numbers
Categories : PHP, MySQL, Databases, HTML
Parses HTTP_USER_AGENT so that you can customize your site to different browsers
Categories : HTML, PHP, Complete Programs
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
FormWizard reads a mysql table and generates automatically a html formular in a html-table
Categories : PHP, MySQL, HTML
Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form
Categories : HTML, PHP, Strings
The toll booth
Categories : PHP, Java Script, Filesystem
php jump urls...the best way
Categories : PHP, URLs, Filesystem
Simple way to replace a variable value in a .conf (.ini) file using a webbrowser - the first stage of a complete universal configuration editor
Categories : PHP, Regexps, Code Editors, Filesystem
Display list of files within current and subdirectories (recursively) showing each file as an anchored link and each directory as a category header.
Categories : Filesystem, Directories, Arrays, PHP
File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection.
Categories : Complete Programs, Content Management, Filesystem, PHP
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions