home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 March
/
PCWorld_2001-03_cd.bin
/
KOMUNIK
/
progweb
/
progweb.exe
/
phpnuke
/
html
/
sections.php
< prev
next >
Wrap
PHP Script
|
2000-12-05
|
4KB
|
132 lines
<?PHP
######################################################################
# PHP-NUKE: Web Portal System
# ===========================
#
# Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
# http://phpnuke.org
#
# This modules is to have special sections for articles, reviews, etc.
#
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
######################################################################
if(!isset($mainfile)) { include("mainfile.php"); }
function listsections() {
include ('header.php');
$result = mysql_query("select secid, secname, image from sections order by secname");
echo "
<center>
<table width=100% border=0 cellspacing=1 cellpadding=0 bgcolor=000000><tr><td>
<table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td>
<center>
".translate("Welcome to the Special Sections at")." $sitename.<br><br>
".translate("Here you can find some cool articles not presents in the Home.")."
<br><br>
<table border=0>";
$count = 0;
while (list($secid, $secname, $image) = mysql_fetch_row($result)) {
if ($count==2) {
echo "<tr>";
$count = 0;
}
echo "<td><a href=sections.php?op=listarticles&secid=$secid><img src=images/sections/$image border=0 Alt=\"$secname\"></a>";
$count++;
if ($count==2) {
echo "</tr>";
}
echo "</td>";
}
mysql_free_result($result);
echo "</table></center></td></tr></table></td></tr></table>";
include ('footer.php');
}
function listarticles($secid) {
include ('header.php');
$result = mysql_query("select secname from sections where secid=$secid");
list($secname) = mysql_fetch_row($result);
mysql_free_result($result);
$result = mysql_query("select artid, secid, title, content, counter from seccont where secid=$secid");
echo "<center>
<table width=100% border=0 cellspacing=1 cellpadding=0 bgcolor=000000><tr><td>
<table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td>";
$result2 = mysql_query("select image from sections where secid=$secid");
list($image) = mysql_fetch_row($result2);
echo "<center><img src=images/sections/$image border=0><br><br>
<font size=3>
".translate("This is Section")." <b>$secname</b>.<br>".translate("Following are the articles published under this section.")."
<br><br>
<table border=0>";
while (list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result)) {
echo "
<tr><td align=left><font size=2>
<li><a href=sections.php?op=viewarticle&artid=$artid>$title</a> (".translate("read:")." $counter ".translate("times").")
</td></tr>
";
}
echo "</table>
<br><br><br>
[ <a href=sections.php>".translate("Return to Sections Index")."</a> ]
</center>
</td></tr></table></td></tr></table>";
mysql_free_result($result);
include ('footer.php');
}
function viewarticle($artid) {
include("header.php");
mysql_query("update seccont set counter=counter+1 where artid='$artid'");
$result = mysql_query("select artid, secid, title, content, counter from seccont where artid=$artid");
list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result);
$result2 = mysql_query("select secid, secname from sections where secid=$secid");
list($secid, $secname) = mysql_fetch_row($result2);
$words = sizeof(explode(" ", $content));
echo "<center>
<table border=0 cellpadding=1 cellspacing=1 width=100% bgcolor=000000><tr><td>
<table border=0 cellpadding=8 cellspacing=1 width=100% bgcolor=FFFFFF>
<tr><td align=left><font size=3>
<b>$title</b><br>
<font size=2>
($words ".translate("total words in this text)")."<br>
(".translate("read:")." $counter ".translate("times").")<br><br>
<br><br>
$content
</td></tr>
<tr><td align=center>
[ <a href=sections.php?op=listarticles&secid=$secid>".translate("Back to")." $secname</a> |
<a href=sections.php>".translate("Sections Index")."</a> ]
</td></tr>
</table></td></tr></table></center>";
mysql_free_result($result);
mysql_free_result($result2);
include ('footer.php');
}
switch($op) {
case "viewarticle":
viewarticle($artid);
break;
case "listarticles":
listarticles($secid);
break;
default:
listsections();
break;
}
?>