By creating a MySQL CRUD class you can easily create, read, update and delete entries in any of your projects, regardless of how the database is designed
creates attractive web slideshows from dynamic image files and data. Among the possible uses are:
- Slideshows
- Photo albums & picture books
- Catalogs
- Story books
- Year books
- Portfolios
- Keynotes & business presentations
- Advertisement
- Trivia games
- Polls
code snippet:
<?php
// for example: thispage.php?word=abracadabra
$val = $_GET['word'];
echo "the word is: $val";
?> sample output:
phpFileManager is a complete filesystem management tool on a single file.
Among the features of phpFileManager:
. server info
. directory tree
. copy/move/delete/create/rename/edit/view/chmod files and folders
. tar/zip/bzip/gzip
. multiple uploads
. shell/exec
. works on linux/windows
. php4/php5/apache2 compatible
. english/português support
<?php
$fn = "news.txt";
if (isset($_POST['content']))
{
$content = stripslashes($_POST['content']);
$fp = fopen($fn,"w") or die ("Error opening file in write mode!");
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
}
?>
<center>
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<textarea rows="25" cols="40" name="content"><?php readfile($fn); ?></textarea><br /><br />
<input type="submit" value="Submit">
</form>
</center>
The system will generate a folder structure like the folloing
Year Month Day Newsfile
—————————————————————
2007 -
|- 01 -|
|- 30 -|
|-timestamp.news
|-timestamp.news
|-timestamp.news
|- 31
|- 02
|- 1
|- 2
|- 03
|- etc
Programmed by Christian Haensel, christian@chftp.com, http://www.chftp.com
Exclusively published on weberdev.com
function datefolders() {
// This function checks the existance of the news directory for this day
// and, if necessary, creates the directories for year, month and day.
$checkyear = date("Y");
$checkmonth = date("m");
$checkday = date("d");
// Checking for this year's folder
if(!is_dir("news/".$checkyear)) {
mkdir("news/".$checkyear,0755);
}
// Checking for this month's folder
if(!is_dir("news/".$checkyear."/".$checkmonth)) {
mkdir("news/".$checkyear."/".$checkmonth,0755);
}
// Checking for today's folder
if(!is_dir("news/".$checkyear."/".$checkmonth."/".$checkday)) {
mkdir("news/".$checkyear."/".$checkmonth."/".$checkday,0755);
}
}
function readnews($day,$month,$year,$number) {
$nfile = file("news/".$year."/".$month."/".$day."/".$number);
$i = 1;
$date_ex = explode(".", $number);
$timest = $date_ex[0];
$news_date = date("d.m.Y - H:i", $timest);
foreach($nfile as $nline) {
if($i==1) {
echo '<h1>'.$nline.'</h1>';
} elseif($i==2) {
echo '<h3>'.$nline.'</h3>';
} else {
echo $nline."<br>";
}
$i++;
}
echo '<p><small>Posted '.$news_date.'</small><p>';
echo '--------------------------------------------------------------';
}
function check_news() {
// This function checks for news in the directories. It will take URL-Parameters
// like day, month and year. If thos are not set, it will take the current date
if(eregi("\.", $_GET['day']) || eregi("\.", $_GET['month']) || eregi("\.", $_GET['year'])) {
die("No hacking");
}
if(isset($_GET['year'])) {
$newsyear = $_GET['year'];
} else {
$newsyear = date("Y");
}
if(isset($_GET['month'])) {
$newsmonth = $_GET['month'];
} else {
$newsmonth = date("m");
}
if(isset($_GET['day'])) {
$newsday = $_GET['day'];
} else {
$newsday = date("d");
}
// Check for news in the directory
$news_arr = array();
$newsfolder = @opendir("news/".$newsyear."/".$newsmonth."/".$newsday) or die("No news for this time");
while($news = readdir($newsfolder)) {
if(eregi(".news", $news)) {
array_push($news_arr, $news);
}
}
sort($news_arr);
$news_arr = array_reverse($news_arr);
foreach($news_arr as $news) {
readnews($newsday,$newsmonth,$newsyear,$news);
}
}
function showaddform() {
// Set the access password here
$mypass = "mypassword";
if(!isset($_POST['pass'])) {
echo '
<form name="login" action="#" method="POST";
Login:
<input type="password" name="pass">
<input type="submit" value="Login">
</form>';
die;
}
if(isset($_POST['pass']) && $_POST['pass'] != $mypass) {
echo '
Login failed.<p>
<form name="login" action="#" method="POST";
Login:
<input type="password" name="pass">
<input type="submit" value="Login">
</form>';
die;
} elseif(isset($_POST['pass']) && $_POST['pass'] == $mypass) {
echo '
<div style="padding:5px; border:1px solid #000000;">
<b>Add News</b><p>
<form name="addnews" action="#" method="POST">
<table>
<tr>
<td>Title:</td><td><input type="text" name="title">
</td>
</tr>
<tr>
<td>
Header:</td><td><input type="text" name="header">
</td>
</tr>
<tr>
<td>
Text:</td><td><textarea name="text"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="Submit" value="Add news">
<input type="hidden" name="pass" value="'.$_POST[pass].'">
<input type="hidden" name="action" value="addnews">
</td>
</tr>
</table>
</form>
</div>
';
}
}
function doadd() {
$nowyear = date("Y");
$nowmonth = date("m");
$nowday = date("d");
$ntitle = $_POST['title'];
$nheader = $_POST['header'];
$ntext = $_POST['text'];
$ntimest = time();
$newfile = fopen("news/".$nowyear."/".$nowmonth."/".$nowday."/".$ntimest.".news", "w+");
$newstext = $ntitle."\n".$nheader."\n".$ntext;
fwrite($newfile, $newstext);
fclose($newfile);
echo 'News added';
}
function checkadd() {
if($_GET['add'] == "true") {
showaddform();
}
if($_POST['action'] == "addnews") {
doadd();
}
}
// Do it all
checkadd(); datefolders(); check_news();
?>The Specials Board theme includes .seestyle files for all programming languages that Coda supports out of the box. Not just Ruby, PHP, XHTML, CSS and the others referenced in the demo screencaps, but ASP, Python, Smarty, Action Script, Java and all the others.
SELECT DAY( <TIMESTAMP_FIELD> ) AS DAY,
MONTH( <TIMESTAMP_FIELD> ) AS MONTH,
YEAR( <TIMESTAMP_FIELD> ) AS YEAR,
HOUR( <TIMESTAMP_FIELD> ) AS HOUR
FROM <TABLE>


