? * NewsDonkeyv1.0d8bdbd88888bdbd8bdb. d8888.byOscarRylin [oscar@mgon.com] comment '8bo. 88V8o8888 ~~~~~ Y8I8I88 'y8b. 88V88888. '8bd88bd8db8dvpv8py88888p '8b8 '8d8' 8888Yd8888b .. d88b. d8bdbdb /*
News Donkey v1.0 d8b db d88888b db d8b db. d8888.
By Oscar Rylin [oscar@mgon.com] 888o 88 '88 I8I 88 88 'YP
88V8o 88 ooooo 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 dD d88888b db
88 '8d. 8 P Y8. 888o 88, 8P '88' 8b d8'
88 88 88 88V8o 88 88,8 P 88 ooooo '8bd8'
88 88 88 88 V8o88 88 '8b 88 ~~~~~ 88
88. 8D '8b d8' 88 V888 '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 a http://zend.com/codex.php? Id = 35 & single = 1
Include "settings. php"; // The settings file
?>
NewsM0nger1.0
Archive
$ 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"? ";Print "Main ";While ($ pCount <($ row [Total]/5)-1 ){+ + $ PCount;Print "$ pCount ";}}$ TmpDL = 0;$ SQL = new CDBMySQL ($ dbHost, $ dbUser, $ dbPass, $ dbName );If ($ start ){$ SQL-> Query ("SELECT * FROM news WHERE id <". ($ row [Total]-$ start). "ORDER BY id DESC ");} Else {$ SQL-> Query ("SELECT * FROM news ORDER BY id DESC ");} While ($ SQL-> ReadRow () & ($ tmpDL <$ newsDL )){ $ 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 ();?>