soulburn
Oct 29th 2007, 11:13 am
I switched hosting, so i went from php4 to php5. The newsystem used was an opensource from 2006 and i know its not the best coding. I have no time to rewrite the whole news system (with an admin part), so im trying to find ways to alter just enough to have it up and running, till 2008. Im trying to change the if statements but i don't get the fullnews to show (news.php?go=fullnews&newsid=xxx) What am i missing?
thanks
S.
<? include "header.php";
################### NEWS CATEGORY ###################
//if($go=="list") {
if($_GET['go']=="list") {
$sql="SELECT id FROM news_publish";
$result=mysql_query($sql);
$totalrecord = mysql_num_rows($result);
$pagesize = 6; // set how many record you want to display per page
$Prev_Page = $pageid-1;
$Next_Page = $pageid+1;
$totalpage = (int) ($totalrecord / $pagesize);
if (($totalrecord % $pagesize) != 0) {
$totalpage += 1;
}
if (isset($pageid)) {
$start = $pagesize * ($pageid - 1);
}
else {
$pageid = 1;
$start = 0;
}
?>
<!-- begin center -->
<TD valign="top" style="PADDING-RIGHT: 15px; PADDING-LEFT: 15px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px">
<table width="100%" border="0" cellpadding="2" cellspacing="2" align="center">
<?
// Retrive data from db
$sql="SELECT * FROM news_publish WHERE category='Articles' ORDER BY id DESC LIMIT $start, $pagesize";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
echo "
<tr>
<td>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$rows[id]\">$rows[title]</a></div>
<div class=\"newsdate\">$rows[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$row[id]\"><img src=\"$urlpath/newsgfx/$rows[photo]\" alt=\"\" border=\"0\" width=\"100\" align=\"left\" vspace=\"5\" hspace=\"5\"></a>";
} else {
}
echo "
$rows[intro]
<br />
</td>
</tr>";
}
?>
</table>
<?php
if($Next_Page==1){
$Next_Page=$Next_Page+1;
}
if($Prev_Page >0)
echo " <a href='$PHP_SELF?pageid=$Prev_Page'>PREVIOUS</a> ";
for ($i=1; $i<=$totalpage; $i++) {
if ($i == $pageid) {
echo "<B>".$i . "</B> ";
}
else {
echo "[<a href=$PHP_SELF?pageid=$i>$i</a>] ";
}
}
if($pageid!=$totalpage){
echo " <a href ='$PHP_SELF?pageid=$Next_Page'>NEXT</a> ";
}
mysql_close();
?>
</TD>
</TR>
</TABLE>
<!-- end center -->
<?
}
################### FULLNEWS ###################
//if($go=="fullnews") {
if($_GET['go']=="fullnews") {
$queryfull = "SELECT * FROM news_publish WHERE id='$newsid'";
$qryfull = @mysql_query($queryfull,$connect) or die ("Wrong Query");
$rowfull = mysql_fetch_array ($qryfull);
$catfull = $rowfull[category];
$isishort = nl2br($rowfull[intro]);
$isifull = nl2br($rowfull[full]);
?>
<!-- begin center -->
<TD valign="top" style="PADDING-RIGHT: 15px; PADDING-LEFT: 15px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px">
<table width="95%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
echo "
<tr>
<td> <div class=\"newstitle\">$rowfull[title]</div>
<div class=\"newsdate\">$rowfull[ldate]</div>
</td>
<td><div align=\"right\">
<a href=\"#\" onClick=\"MM_openBrWindow('print.php?go=fullnews&id=$rowfull[id]','addimage','scrollbars=yes,resizable=yes,width=800,height=550')\"><img src=\"$urlpath/images/print.gif\" border=\"0\" alt=\"Print View\" title=\"Print View\"></a>";
if ($allow_click==1){
$c=$rowfull[click];
$c++;
$d=$c;
@mysql_query("update news_publish set click='$d' where id=$newsid");
echo " $d views";
}
echo "
</div>
</td>
</tr>
</table></td>
</tr>
<tr>
<td>";
if ($rowfull[pq]==1) {
echo "<img src=\"$urlpath/newsgfx/$rowfull[photo]\" alt=\"\" border=\"0\"><br />";
} else {
}
echo "
$isishort<br /><br />
$isifull
<br />
</td>
</tr>";
}
?>
</table>
</TD>
</TR>
</TABLE>
<!-- end center -->
<? include "footer.php"; ?>
thanks
S.
<? include "header.php";
################### NEWS CATEGORY ###################
//if($go=="list") {
if($_GET['go']=="list") {
$sql="SELECT id FROM news_publish";
$result=mysql_query($sql);
$totalrecord = mysql_num_rows($result);
$pagesize = 6; // set how many record you want to display per page
$Prev_Page = $pageid-1;
$Next_Page = $pageid+1;
$totalpage = (int) ($totalrecord / $pagesize);
if (($totalrecord % $pagesize) != 0) {
$totalpage += 1;
}
if (isset($pageid)) {
$start = $pagesize * ($pageid - 1);
}
else {
$pageid = 1;
$start = 0;
}
?>
<!-- begin center -->
<TD valign="top" style="PADDING-RIGHT: 15px; PADDING-LEFT: 15px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px">
<table width="100%" border="0" cellpadding="2" cellspacing="2" align="center">
<?
// Retrive data from db
$sql="SELECT * FROM news_publish WHERE category='Articles' ORDER BY id DESC LIMIT $start, $pagesize";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
echo "
<tr>
<td>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$rows[id]\">$rows[title]</a></div>
<div class=\"newsdate\">$rows[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$row[id]\"><img src=\"$urlpath/newsgfx/$rows[photo]\" alt=\"\" border=\"0\" width=\"100\" align=\"left\" vspace=\"5\" hspace=\"5\"></a>";
} else {
}
echo "
$rows[intro]
<br />
</td>
</tr>";
}
?>
</table>
<?php
if($Next_Page==1){
$Next_Page=$Next_Page+1;
}
if($Prev_Page >0)
echo " <a href='$PHP_SELF?pageid=$Prev_Page'>PREVIOUS</a> ";
for ($i=1; $i<=$totalpage; $i++) {
if ($i == $pageid) {
echo "<B>".$i . "</B> ";
}
else {
echo "[<a href=$PHP_SELF?pageid=$i>$i</a>] ";
}
}
if($pageid!=$totalpage){
echo " <a href ='$PHP_SELF?pageid=$Next_Page'>NEXT</a> ";
}
mysql_close();
?>
</TD>
</TR>
</TABLE>
<!-- end center -->
<?
}
################### FULLNEWS ###################
//if($go=="fullnews") {
if($_GET['go']=="fullnews") {
$queryfull = "SELECT * FROM news_publish WHERE id='$newsid'";
$qryfull = @mysql_query($queryfull,$connect) or die ("Wrong Query");
$rowfull = mysql_fetch_array ($qryfull);
$catfull = $rowfull[category];
$isishort = nl2br($rowfull[intro]);
$isifull = nl2br($rowfull[full]);
?>
<!-- begin center -->
<TD valign="top" style="PADDING-RIGHT: 15px; PADDING-LEFT: 15px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px">
<table width="95%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
echo "
<tr>
<td> <div class=\"newstitle\">$rowfull[title]</div>
<div class=\"newsdate\">$rowfull[ldate]</div>
</td>
<td><div align=\"right\">
<a href=\"#\" onClick=\"MM_openBrWindow('print.php?go=fullnews&id=$rowfull[id]','addimage','scrollbars=yes,resizable=yes,width=800,height=550')\"><img src=\"$urlpath/images/print.gif\" border=\"0\" alt=\"Print View\" title=\"Print View\"></a>";
if ($allow_click==1){
$c=$rowfull[click];
$c++;
$d=$c;
@mysql_query("update news_publish set click='$d' where id=$newsid");
echo " $d views";
}
echo "
</div>
</td>
</tr>
</table></td>
</tr>
<tr>
<td>";
if ($rowfull[pq]==1) {
echo "<img src=\"$urlpath/newsgfx/$rowfull[photo]\" alt=\"\" border=\"0\"><br />";
} else {
}
echo "
$isishort<br /><br />
$isifull
<br />
</td>
</tr>";
}
?>
</table>
</TD>
</TR>
</TABLE>
<!-- end center -->
<? include "footer.php"; ?>