/*
news donkey v1.0 d8b db d88888b db d8b db .d8888.
by oscar rylin [oscar@mgon.com] 888o 88 88' 88 i8i 88 88' yp
88v8o 88 88ooooo 88 i8i 88 `8bo.
88 v8o88 88~~~~~ y8 i8i 88 `y8b.
88 v888 88. `8b d8'8b d8' db 8d
vp v8p y88888p `8b8' `8d8' `8888y'
d8888b. .d88b. d8b db db dd d88888b db db
88 `8d .8p y8. 888o 88 88 ,8p' 88' `8b d8'
88 88 88 88 88v8o 88 88,8p 88ooooo `8bd8'
88 88 88 88 88 v8o88 88`8b 88~~~~~ 88
88 .8d `8b d8' 88 v888 88 `88. 88. 88
y8888d' `y88p' vp v8p yp yd y88888p yp
this script was made by oscar rylin (oscar@mgon.com) while learning php w/
mysql connections.
what the script does:
* provides an easy way to read news from a mysql database
* prints it out in a nice html format which is customizable
* provides a secure interface (user/password validation through a mysql db)
* updating news, deleting and adding users and lots of other stuff
*/
include dbconn.php; // this is http://zend.com/codex.php?id=35&single=1
include settings.php; // the settings file
?>
newsm0nger1.0
print $header; ?>
$db = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
$result = mysql_query(select count(id) as total from news,$db);
$row = mysql_fetch_array($result);
mysql_close($db);
if ($row[total] > 5) {
$pcount = 0;
print archive ?;
print main ;
while ($pcount ++$pcount;
print $pcount ;
}
}
$tmpdl = 0;
$sql = new cdbmysql($dbhost, $dbuser, $dbpass, $dbname);
if ($start) {
$sql -> query (select * from news where id } else {
$sql -> query (select * from news order by id desc);
}
while (($sql -> readrow()) && ($tmpdl
$id = ($sql -> rowdata[id]);
$date = ($sql -> rowdata[date]);
$poster = ($sql -> rowdata[user]);
$header = ($sql -> rowdata[header]);
$news = ($sql -> rowdata[news]);
$news = nl2br($news);
$udb = new cdbmysql($dbhost, $dbuser, $dbpass, $dbname);
$udb -> query (select * from users where user=\$poster\);
while ($udb -> readrow()) {
$email = ($udb -> rowdata[email]);
}
$udb -> close();
$format =
$date - $header
$news
-- $poster
;
print $format;
++$tmpdl;
}
//$sql -> close();
?>
print $footer; ?>