PHP Code:
else if($action=="viewart")
{
$id = $_GET["id"];
$cid = $_GET["cid"];
$artid = $_GET["artid"];
$cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_readart WHERE id='".$id."'"));
addonline(getuid_sid($sid),"Reading $cinfo[0]","articles.php?action=$action");
$tinfo = mysql_fetch_array(mysql_query("SELECT name, authorid, crdate, id from ibwf_readart WHERE id='".$id."'"));
$tnm = htmlspecialchars($tinfo[0]);
echo "<card id=\"main\" title=\"$tnm\">";
echo "<p align=\"left\">";
echo "<b>$cinfo[0]</b><br/>";
$tmstamp = $tinfo[2];
$tmdt = date("D,dMy-h:i:s a",$tmstamp);
echo "$tmdt<br/>";
$unick = getnick_uid($tinfo[1]);
$usl = "<a href=\"index.php?action=viewuser&sid=$sid&who=$tinfo[1]&browse?\">$unick</a>";
echo "$usl2 Submitted by: $usl<br/>";
$tid = $_GET["artid"];
$go = $_GET["go"];
$uid = getuid_sid($sid);
$num_pages = getnumpages2($artid);
if($page==""||$page<1)$page=1;
if($go!="")$page=getpage_go2($go,$artid);
$posts_per_page = 5;
if($page>$num_pages)$page=$num_pages;
$limit_start = $posts_per_page *($page-1);
$vws = $tinfo[3]+1;
///////from here
if($page==1)
{
$posts_per_page=4;
$ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate FROM ibwf_readart WHERE id='".$id."'"));
$pst2 = parsemsg($ttext[1], $sid);
$unick = getnick_uid($ttext[0]);
if(substr_count($ttext[1],"[br/]")<=1000){
$text = str_replace("[br/]","<br/>",$ttext[1]);
}
echo "$text<br/>";
mysql_query("UPDATE ibwf_readart SET vws='".$vws."' WHERE id='".$id."'");
mysql_query("INSERT INTO ibwf_view2 SET uid='".$uid."', artid='".$artid."', actime='".time()."'");
}
if($page>1)
{
$limit_start--;
}
$sql = "SELECT id, text FROM ibwf_artpost WHERE artid='".$artid."' ORDER BY crdate LIMIT $limit_start, $posts_per_page";
$posts = mysql_query($sql);
while($post = mysql_fetch_array($posts))
{
$unick = getnick_uid($post[2]);
$usl = "<br/><a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]&browse?\">$unick</a>";
$pst = parsemsg($post[1], $sid);
if(substr_count($post[1],"[br/]")<=1000){
$pst = str_replace("[br/]","<br/>",$post[1]);
}
echo "<br/>$hm $pst<br/>";
}
///to here
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"articles.php?action=viewart&page=$ppage&sid=$sid&artid=$artid&cid=$cid&id=$id\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"articles.php?action=viewart&page=$npage&sid=$sid&artid=$artid&cid=$cid&id=$id\">Next»</a>";
}
echo "<br/>Page $page of $num_pages";
if($num_pages>2)
{
$rets = "<br/>Jump to page: <input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"articles.php?browse?\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"cid\" value=\"$cid\"/>";
$rets .= "<postfield name=\"id\" value=\"$id\"/>";
$rets .= "<postfield name=\"artid\" value=\"$artid\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
if(canaddart($uid, $id))
{
echo "<br/><a href=\"articles.php?&action=newart2&sid=$sid&id=$artid&artid=$artid&cid=$cid\">Add more</a>";
}
$tmsg = getpmcount(getuid_sid($sid));
$umsg = getunreadpm(getuid_sid($sid));
if($umsg>0)
{
echo "<br/><a href=\"inbox.php?action=main&sid=$sid&browse?\">New Private msg($umsg/$tmsg)</a>";
}
$countpics = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM iwbf_cwart WHERE artid='".$artid."'"));
echo "<br/><a href=\"articles.php?&action=artcom&sid=$sid&id=$id&artid=$id&cid=$cid\">Comments($countpics[0])</a>";
echo "<br/>";
echo "<a href=\"articles.php?&action=dload&sid=$sid&id=$id&artid=$id\">Download</a>";
echo "<br/>";
echo "<a href=\"articles.php?&action=viewall&sid=$sid&id=$id&artid=$id&cid=$cid\">Fastread</a>";
echo "<br/>";
$cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_articles WHERE id='".$cid."'"));
echo "<a href=\"articles.php?&action=kindat&sid=$sid&cid=$cid\">$cinfo[0]</a>";
echo "<br/>";
$ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate FROM ibwf_readart WHERE id='".$id."'"));
$unick = getnick_uid($ttext[0]);
$unick2 = getnick_uid($post[2]);
echo "<a href=\"articles.php?&action=vall&sid=$sid&who=$ttext[0]&cid=$cid&cid=$cid&id=$artid&artid=$artid\">All articles of $unick</a>";
echo "<br/>----------<br/>";
echo "<a href=\"articles.php?action=articles&sid=$sid&browse?\">";
echo "Articles</a><br/>";
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid&type=send\">";
echo "Main menu</a>";
echo "</p>";
echo "</card>";
}
i mean if the whole article text is 2300 characters then the article cut in 5 pages, of course the 5th page only got 300 characters
hope my English is good LoL
Comment