search
Homephp教程php手册新闻发布系统 (例子) 一 news


/*
  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 = "












";
   print "$format";
   ++$tmpDL;
  }
//$sql -> Close();
?>
    

   $date       -        $header

  $news
  

  -- $poster


    
     
   
新闻发布系统 (例子) 一 news 新闻发布系统 (例子) 一 news

  

   print $footer; ?>



Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft