<?php
session_start();
/*
* class name : RSSParser
* developed by : Md. Shahadat Hossain Khan Razon
* version : 1.00
* date : Jan 26, 2006
* dependency : none
* homepage : http://razon.phpxperts.com
* email : razonklnbd@yahoo.com
* developed for: http://www.suchona.com
*/
class RSSParser{
var $struct=array(); // holds final structure
var $curptr; // current branch on $struct
var $parents=array(); // parent branches of current branch
var $xmlintialized;
var $xmlitems;
function RSSParser($url=NULL, $xmldata=NULL) {
$this->xmlintialized=false;
$this->curptr =& $this->struct; // set ref to base
$xmlparser=xml_parser_create();
xml_set_object($xmlparser, $this);
xml_set_element_handler($xmlparser, 'tag_open', 'tag_close');
xml_set_character_data_handler($xmlparser, 'cdata');
$anymethod=false;
if(isset($url)){
$anymethod=true;
$fp=fopen($url, 'r');
while($data=fread($fp, 4096))
xml_parse($xmlparser, $data, feof($fp)) || die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xmlparser)), xml_get_current_line_number($xmlparser)));
fclose($fp);
}
if(isset($xmldata)){
$anymethod=true;
xml_parse($xmlparser, $xmldata) || die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xmlparser)), xml_get_current_line_number($xmlparser)));
}
if(false==$xmldata) die('RSSParser Class Error: Please pass valid url or valid xmldata!');
xml_parser_free($xmlparser);
$this->xmlintialized=true;
}
function tag_open($parser, $tag, $attr){
$i=count($this->curptr['children']);
$j=count($this->parents);
$this->curptr['children'][$i]=array(); // add new child element
$this->parents[$j] =& $this->curptr; // store current position as parent
$this->curptr =& $this->curptr['children'][$i]; // submerge to newly created child element
$this->curptr['name']=$tag;
if(count($attr)>0) $this->curptr['attr']=$attr;
}
function tag_close($parser, $tag) {
$i=count($this->parents);
if($i>0) $this->curptr =& $this->parents[$i-1]; // return to parent element
unset($this->parents[$i-1]); // clear from list of parents
}
function cdata($parser, $data){
$data=trim($data);
if(!empty($data)) $this->curptr['value'].=$data;
}
function manupulateXMLitems(){
if(false==$this->xmlintialized) die('RSSParser Class Error: Data Not Initialized...');
$rtrn=false;
$myrss=$this->struct['children'][0];
$mychannel=$myrss['children'][0];
$mychanneldata=$mychannel['children'];
$itemctr=-1;
if(isset($this->xmlitems) || is_array($this->xmlitems)) unset($this->xmlitems);
foreach($mychanneldata as $mydata){
if(strtolower($mydata['name'])=='item'){
$itemctr++;
foreach($mydata['children'] as $myval) $this->xmlitems[$itemctr][$myval['name']]=$myval['value'];
}
}
if(isset($this->xmlitems) && is_array($this->xmlitems)) $rtrn=true;
return $rtrn;
}
}
/*
// Example and usage...
# 1 ---------
$myparser = new RSSParser('today.xml');
$myrss=$myparser->struct['children'][0];
$mychannel=$myrss['children'][0];
$mychanneldata=$mychannel['children'];
foreach($mychanneldata as $mydata){
if(strtolower($mydata['name'])=='item'){
foreach($mydata['children'] as $myval){
if(strtolower($myval['name'])=='link') echo($myval['value'].'<br>');
}
}
}
# 2 ---------
$myparser = new RSSParser(NULL, $xmldata);
$ismanupulated=$myparser->manupulateXMLitems(); // you need to call this function for one time onlt...
if(true==$ismanupulated) echo('<pre>'.print_r($myparser->xmlitems, true).'</pre>');
# debug -------------
echo "<pre>";
print_r($myparser->struct);
echo "</pre>";
*/
include_once 'remote.fetch.cls.php';
if(!isset($_SESSION['shkhan_blog']) || $_SESSION['shkhan_blog']['lut']+60*5 < time()){
$_SESSION['shkhan_blog']['blog_title']='The Fact of Real Shit';
$http=new RemoteDataFetcher();
## $rss_data=getUrl('http://www.burtprocess.com/logos/index.php', 'text', false);
###public function get($url, $p_fetch_header_only=false, $p_seek_html_head=false, $p_timeout=-1){
$rss_data=$http->get('http://shkhan.wordpress.com/feed/');
if(true===$rss_data['status']){
$strpos=strpos($rss_data['data'], '<');
$data=substr($rss_data['data'], $strpos);
$strpos=strrpos($data, '>');
$data=substr($data, 0, $strpos+1);
## echo 'data: '.$data; exit();
$myparser = new RSSParser(NULL, $data);
$myrss=$myparser->struct['children'][0];
$mychannel=$myrss['children'][0];
$_SESSION['shkhan_blog']['myblogs']=$mychannel['children'];
foreach($_SESSION['shkhan_blog']['myblogs'] as $mydata){
if(strtolower($mydata['name'])=='title'){ $_SESSION['shkhan_blog']['blog_title']=$mydata['value']; break; }
}
}
$_SESSION['shkhan_blog']['lut']=time();
}
$blog_title=$_SESSION['shkhan_blog']['blog_title'];
$myblogs=$_SESSION['shkhan_blog']['myblogs'];
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="google-site-verification" content="khhUoWgeD46ScfHIx0rP9Od_T6zwIwqi6SzRXqrRXCA" />
<link rel="SHORTCUT ICON" href="http://www.shkhan.tk/favicon.ico" />
<link rel="icon" href="http://career.shkhan.tk/favicon.ico" />
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><title>the Mad Center</title>
<meta name="title" content="the Mad Center" />
<meta name="description" content="Welcome to personal website of Md. Shahadat Hossain Khan. Razon is his nick name. But he prefer to use his name as Shahadat. Shahadat born 1981 at Khulna. Completed BSc in ECE recently. Shahadat do job as Web Developer at Square InformatiX Ltd." />
<META NAME="Author" CONTENT="Md. Shahadat Hossain Khan Razon">
<META NAME="Webmaster" CONTENT="Md. Shahadat Hossain Khan Razon <razonklnbd@hotmail.com>">
<META name="robots" content="all,index,follow" />
<META name="revisit after" content="15 days" />
<meta name="Classification" content="global,all" />
<META NAME="rating" CONTENT="General">
<META NAME="coverage" CONTENT="Worldwide">
<link rel="image_src" href="http://www.shkhan.tk/images/thumb4fb.jpg" />
<link rel="image_src" href="http://www.shkhan.tk/images/razon_najneen_errin_tuni.jpg" />
<script type="text/javascript" language="javascript">
var areYouReallySure = false;
var internalLink = false;
function areYouSure() {
if (!areYouReallySure && !internalLink) {
areYouReallySure = true;
location.href="index.php"
return "*****************************************************\n\nSorry! \n\nThis is just a test to convey some message before leave any website... Don't take it otherwise just ignore this message and click on 'Leave this Page'\n\nThanks, Shahadat Hossain Khan\n\n*****************************************************";
}
}
////////window.onbeforeunload = areYouSure;
</script>
<style type="text/css" media="screen"><!--
body
{
color: white;
background-color: #003;
margin: 0px
}
#horizon
{
color: white;
background-color: #0ff;
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
visibility: visible;
display: block
}
#content
{
font-family: Verdana, Geneva, Arial, sans-serif;
background-color: #fff;
margin-left: -300px;
position: absolute;
top: -200px;
left: 50%;
width: 580px;
height: 380px;
visibility: visible;
background-image: url('images/bg_box_top.jpg');
background-repeat: repeat-x;
background-position: top;
color: #000000;
text-align: justify;
padding: 10px;
overflow: hidden;
font-size: 10px;
}
#content h2{
background-color: #3B5998;
background-image: url('images/wordpress-logo_bg.jpg');
background-position: right;
background-repeat: no-repeat;
margin: 0px;
padding: 0px;
color: #FFFFFF;
height: 26px;
padding-top: 3px;
padding-left: 10px;
cursor: default;
}
.bodytext
{
font-size: 14px
}
.headline
{
font-weight: bold;
font-size: 24px
}
#footer
{
clear: both;
font-size: 11px;
font-family: Verdana, Geneva, Arial, sans-serif;
text-align: center;
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
/* height: 20px;*/
visibility: visible;
display: block;
padding-bottom: 10px;
}
a:link, a:visited
{
color: #06f;
text-decoration: none
}
a:hover
{
color: red;
text-decoration: none
}
.captions
{
color: white;
font-size: 10px;
line-height: 14px;
font-family: Verdana, Geneva, Arial, sans-serif;
text-align: left
}
#caption1
{
padding-left: 6px;
border-left: 1px dashed #66c;
position: absolute;
top: -80px;
left: -200px;
width: 250px;
height: 80px;
visibility: visible;
display: block
}
#caption2
{
padding-left: 6px;
border-left: 1px dashed #66c;
position: absolute;
top: 92px;
left: 125px;
width: 250px;
height: auto;
visibility: visible;
display: block
}
--></style></head><body>
<div id="horizon">
<div id="content">
<div style="position: relative;">
<img src="images/razon_najneen_errin_tuni.jpg" border="0" width="100" height="86" hspace="5" align="left" /><span class="headline">the Mad Center</span><br />
<strong>Office Address:</strong> Square Center, 48 # Mohakhali C/A (11th Fl.), Dhaka<br />
<strong>Dhaka Home:</strong> 100/2-Kha # South Badda (1st Floor), Dhaka<br />
<strong>Khulna Home:</strong> 3 # Hazi Imsail Cross Road - 2, Khulna - 9100<br />
<strong>Website:</strong> http://shkhan.wordpress.com/<br />
</div>
<hr />
<div style="clear: both; position: relative; height: 247px;">
<div style="float: left; width: 450px; height: 247px; overflow: hidden; overflow-x: hidden; overflow-y: auto;">
<h2><?=$blog_title?></h2>
<div>
<?php
if(isset($myblogs) && is_array($myblogs) && count($myblogs)>0){
foreach($myblogs as $mydata){
if(strtolower($mydata['name'])=='item'){
unset($item_title, $item_description, $item_link);
foreach($mydata['children'] as $myval){
if(strtolower($myval['name'])=='title') $item_title=$myval['value'];
if(strtolower($myval['name'])=='description') $item_description=$myval['value'];
if(strtolower($myval['name'])=='link') $item_link=$myval['value'];
}
echo $item_sap.'<a href="'.$item_link.'" style="text-decoration: none; font-weight: bold">'.$item_title.'</a><br />'.$item_description;
$item_sap='<hr />';
}
}
}else echo '<h3 style="color: #f00;">Currently blog data unavailable. Please visit <br /><a href="http://shkhan.wordpress.com/" style="font-size: 24px;">shkhan.wordpress.com</a><br />You can mail to <a href="mailto:razonklnbd@hotmail.com">Shahadat</a> on this issue</h3>';
?></div>
</div>
<div style="float: right; width: 120px;">
<!-- Facebook Badge START --><!--a href="http://www.facebook.com/razonklnbd" title="Shahadat Hossain Khan Razon" target="_TOP" style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;">Shahadat Hossain Khan Razon</a><br/--><a href="http://www.facebook.com/razonklnbd" title="Shahadat Hossain Khan Razon" target="_TOP"><img src="http://badge.facebook.com/badge/704907500.2109.1194787173.png" width="120" height="247" style="border: 0px;" /></a><!--br/><a href="http://www.facebook.com/facebook-widgets/" title="Make your own badge!" target="_TOP" style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;">Create Your Badge</a--><!-- Facebook Badge END -->
<!-- Facebook Badge START --><!--a href="http://www.facebook.com/razonklnbd" title="Shahadat Hossain Khan Razon" target="_TOP" style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;">Shahadat Hossain Khan Razon</a><span style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; line-height: 16px; font-variant: normal; font-style: normal; font-weight: normal; color: #555555; text-decoration: none;"> | </span><a href="http://www.facebook.com/facebook-widgets/" title="Make your own badge!" target="_TOP" style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;">Create Your Badge</a><br/><a href="http://www.facebook.com/razonklnbd" title="Shahadat Hossain Khan Razon" target="_TOP"><img src="http://badge.facebook.com/badge/704907500.2109.1194787173.png" width="379" height="84" style="border: 0px;" /></a--><!-- Facebook Badge END -->
</div>
</div>
<div style="clear: both; position: relative; margin-top: 5px;">
<a href="http://picasaweb.google.com/razonklnbd" target="_blank"><img src="images/picasa-logo_razonklnbd.jpg" border="0" /></a>
<a href="http://bd.linkedin.com/pub/shahadat-hossain-khan/21/724/6a3" target="_blank"><img src="images/linkedin_logo.jpg" border="0" /></a>
<a href="http://twitter.com/razonklnbd" target="_blank"><img src="images/twitter_follow_me.jpg" border="0" /></a>
<a href="http://profiles.yahoo.com/razonklnbd" target="_blank"><img src="images/yahoo_razonklnbd.jpg" border="0" /></a>
<a href="http://www.phpclasses.org/browse/author/228889.html" target="_blank"><img src="images/phpclasses_logo.jpg" border="0" /></a>
</div>
<!--This is a test
<span class="headline">DEAD CENTRE</span>-->
<!--div class="bodytext">
<div id="caption1" class="captions">Md. Shahadat Hossain Khan Razon is the Web Developer of Square InformatiX Ltd.</div>
This text is<br />
<br />
and stays there!
<div id="caption2" class="captions">This site is hosted at Square Group Webserver. This site is used for test purpose only. This is not his official site. He works at Square Center, 48# Mohakhali C/A, Dhaka, Bangladesh</div>
</div-->
</div>
</div>
<div id="footer">
<div align="center"><div style="position: relative; border: 1px solid #FFFFFF; margin-bottom: 10px; width: 468px; height: 60px; padding: 5px; background-color: #000000;"><span style="position: absolute; left: 0px; top: 0px; color: #FFFFFF; font-weight: bold;">Advertisement:</span><a href="http://my.dot.tk/cgi-bin/amb/landing.dottk?nr=327442::1101690::1::16" target="_new"><img src="http://images.dot.tk/content/images/4001.gif" border="0" width="468" height="60" /></a></div></div>
<a href="http://shkhan.wordpress.com/">© All right reserved by Md. Shahadat Hossain Khan</a>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17785177-1']);
_gaq.push(['_setDomainName', '.shkhan.tk']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body></html>
|