View file wap/rwrss.php

File size: 10.8Kb
<?php
include("inc/func.inc.php");
include("inc/lastRSS.inc.php");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
  if(!db()){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getdberror();
  echo "</body>";
  echo "</html>";
  exit();
  }

  $show = $_GET["show"];
  $hits = $_GET["hits"];
  $page = $_GET["page"];
  $who = $_GET["who"];
  $uid = getuid_hits($hits);
  $uip = getip();
  $ubr = $_SERVER['HTTP_USER_AGENT'];
  cleardata();
  addvisitor();

  if(isipbanned($uip,$ubr)){
  if(!isshield(getuid_hits($hits))){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getipbanned($uip, $ubr);
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if(($show != "") && ($show != "terms")){
  $uid = getuid_hits($hits);
  if((islogged($hits)==false)||($uid==0)){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getsesexplog();
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if((isbanned($uid))&&($uid != '0')){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getbanned($uid);
  echo "</body>";
  echo "</html>";
  exit();
  }

$rssid = $_GET["rssid"];
$type = $_GET["type"];
$fid = $_GET["fid"];

if($show=="showfrss")
{
    addonline(getuid_hits($hits),"RSS News","");
            echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
  ///echo "<card=\"main\" title=\"RSS News\">";
  echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Rss Generator</b>";
  echo "<div class=\"box_sub\" align=\"left\">";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='1'"));
  echo "&#8226; <a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=1\">Berita Harian($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='2'"));
  echo "&#8226; <a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=2\">Malaysia Kini($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='3'"));
  echo "&#8226; <a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=3\">The Star($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='4'"));
  echo "&#8226; <a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=4\">World Sport($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='5'"));
  echo "&#8226; <a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=5\">Other News($noi[0])</a>";
    echo "</div>";
  echo "<a href=\"index.php?show=main&amp;hits=$hits\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a></div>";
include("wapv.php");
  echo "</body>";
}
else if($show=="showfrss2")
{
    addonline(getuid_hits($hits),"News List","");
            echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
  ///echo "<card=\"main\" title=\"News List\">";
  echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>News List</b>";
  echo "<div class=\"box_sub\" align=\"left\">";
    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rss WHERE type='".$type."'"));
    $num_items = $noi[0]; //changable
    $items_per_page= 6;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql

        $sql = "SELECT id, title, dscr, imgsrc, pubdate FROM mx_rss WHERE type='".$type."' ORDER BY id LIMIT $limit_start, $items_per_page";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
      if(trim($item[3]!=""))
      {
        $img = "<img src=\"$item[3]\" alt=\"*\"/>";
      }else{
        $img="<img src=\"images/feed.gif\" alt=\"*\"/>";
      }
        $lnk = "$img<a href=\"rwrss.php?show=readrss&amp;hits=$hits&amp;rssid=$item[0]&amp;type=$type\">".htmlspecialchars($item[1])."</a><br/>";
        $feedsc = htmlspecialchars($item[2]);
        echo $lnk;
    }
    }
    echo "<center>";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"rwrss.php?show=$show&amp;page=$ppage&amp;hits=$hits&amp;type=$type\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"rwrss.php?show=$show&amp;page=$npage&amp;hits=$hits&amp;type=$type\">Next&#187;</a>";
    }
    echo "<br/>Page $page of $num_pages<br/>";
    if($num_pages>2)
    {
        $rets = "<form action=\"rwrss.php\" method=\"get\">";
      $rets .= "Page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<input type=\"hidden\" name=\"show\" value=\"$show\"/>";
        $rets .= "<input type=\"hidden\" name=\"type\" value=\"$type\"/>";
        $rets .= "<input type=\"hidden\" name=\"hits\" value=\"$hits\"/>";
        $rets .= "<input type=\"submit\" value=\"[GO]\"/></form>";
        echo $rets;
    }
    echo "</center></div>";
  echo "<a href=\"index.php?show=main&amp;hits=$hits\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a></div>";
include("wapv.php");
  echo "</body>";
}

else if($show=="readrss")
{
    addonline(getuid_hits($hits),"Read News","");
            echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
  ///echo "<card=\"main\" title=\"Read News\">";
  echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Read News</b>";
  echo "<div class=\"box_sub\" align=\"left\">";
    $rssinfo = mysql_fetch_array(mysql_query("SELECT lupdate, link FROM mx_rss WHERE id='".$rssid."'"));

    $updt = time() - 3600;
    if($rssinfo[0]<$updt)
    {
        ///code to refresh info
        $rss = new lastRSS;
        $rss->cache_dir = './rsscache';
        $rss->cache_time = 3600;
        $rss->date_format = 'd m y - H:i';
        $rss->stripHTML = true;
        $rssurl = $rssinfo[1];
        if ($rs = $rss->get($rssurl))
        {
          $title = $rs["title"];
          $pgurl = $rs["link"];
          $srcd = $rs["description"];
          $pubdate = $rs["lastBuildDate"];
          
            mysql_query("UPDATE mx_rss SET lupdate='".time()."', title='".$title."', pgurl='".$pgurl."', srcd='".$srcd."', pubdate='".$pubdate."' WHERE id='".$rssid."'");
            mysql_query("DELETE FROM mx_rssdata WHERE rssid='".$rssid."'");
            $rssitems = $rs["items"];
            for($i=0;$i<count($rssitems);$i++)
            {
              $rssitem = $rssitems[$i];
              mysql_query("INSERT INTO mx_rssdata SET rssid='".$rssid."', title='".mysql_real_escape_string($rssitem["title"])."', link='".$rssitem["link"]."', text='".mysql_real_escape_string($rssitem["description"])."', pubdate='".$rssitem["pubDate"]."'");
            }
        }
        else {
            $errt = "Error: Connection error..";
            mysql_query("INSERT INTO mx_rssdata SET rssid='".$rssid."', title='ERROR!', link='', text='".mysql_real_escape_string($errt)."', pubdate='".time()."'");
        }
    }
    $rssinfo = mysql_fetch_array(mysql_query("SELECT pgurl, title, srcd, imgsrc FROM mx_rss WHERE id='".$rssid."'"));
    echo "<b>$rssinfo[1]</b><br/><small>";
    echo $rssinfo[2];
    echo "</small></p>";
    
    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_rssdata WHERE rssid='".$rssid."'"));
    $num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql

        $sql = "SELECT id, title,  text, pubdate FROM mx_rssdata WHERE rssid='".$rssid."' ORDER BY id LIMIT $limit_start, $items_per_page";


    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        $lnk = "<img src=\"images/feed.gif\" alt=\"*\"/><b>".$item[1]."</b><br/>";
        $feedsc = $item[2];
        echo $lnk;
        echo $feedsc;
        echo "<br/>Publish Date: $item[3]<br/><br/>";
    }
    }
    echo "<center>";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"rwrss.php?show=$show&amp;page=$ppage&amp;hits=$hits&amp;rssid=$rssid&amp;type=$type\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"rwrss.php?show=$show&amp;page=$npage&amp;hits=$hits&amp;rssid=$rssid&amp;type=$type\">Next&#187;</a>";
    }
    echo "<br/>Page $page of $num_pages<br/>";
    if($num_pages>2)
    {
        $rets = "<form action=\"rwrss.php\" method=\"get\">";
      $rets .= "Page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<input type=\"hidden\" name=\"show\" value=\"$show\"/>";
        $rets .= "<input type=\"hidden\" name=\"rssid\" value=\"$rssid\"/>";
        $rets .= "<input type=\"hidden\" name=\"type\" value=\"$type\"/>";
        $rets .= "<input type=\"hidden\" name=\"hits\" value=\"$hits\"/>";
        $rets .= "<input type=\"submit\" value=\"[GO]\"/></form>";
        echo $rets;
    }
    echo "</center></div>";
    echo "<a href=\"rwrss.php?show=showfrss2&amp;hits=$hits&amp;type=$type\">News List</a><br/>";    
    echo "<a href=\"rwrss.php?show=showfrss&amp;hits=$hits\">Rss News</a><br/>";
    echo "<a href=\"index.php?show=main&amp;hits=$hits\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a></div>";
include("wapv.php");
  echo "</body>";
}
else{
       echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
   echo getpagerror();
   echo "</body>";
}
?>

</html>