Friday, September 10, 2010 10:38:30Login · Register
 

    Challenge Activity
09:22:09 - l0gan_l135
     - Completed real [2]
07:42:10 - l0gan_l135
     - Completed real [3]
05:55:17 - aspen_23
     - Completed recon [1]
02:27:21 - GemaRastem
     - Completed basic [2]
02:26:21 - GemaRastem
     - Completed basic [1]
02:21:00 - GemaRastem
     - Completed recon [3]
01:55:39 - GemaRastem
     - Completed recon [2]
01:43:45 - GemaRastem
     - Completed recon [1]
01:31:59 - veerendragautam2009
     - Completed decrypt [3]
01:26:45 - veerendragautam2009
     - Completed decrypt [2]
01:25:16 - veerendragautam2009
     - Completed decrypt [1]
12:31:00 - veerendragautam2009
     - Completed basic [1]
12:26:04 - veerendragautam2009
     - Completed recon [6]
11:13:29 - veerendragautam2009
     - Completed recon [3]
10:59:23 - veerendragautam2009
     - Completed recon [1]
09:30:05 - sirEgghead
     - Completed real [4]
 

    Scoreboard Top 20
UserPoints
Abhineet4795   
auditorsec4795   
ne0114795   
Null Set4795   
blandyuk4780   
bluechill4750   
Teddy4730   
TurboBorland4475   
Qwexotic4460   
tiiger11114205   
preet4180   
LiquidFusi0n4175   
OnlyHuman4125   
samthg4110   
satishek3900   
pilchdragon3660   
Override3655   
chronic123640   
sirEgghead3625   
dash803590   
 

    Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
 

    Users Online
· Guests Online: 7

· Members Online: 1
dudexxl

· Members on IRC: 10
Xires, TurboBorland, ryan1918, Polynomial, louve, LK, IFailStuff, epoch_qwert, connection, bubatime

· Bots Online: 1
GoogleBot

· Total Members: 1,491
· Newest Member: elostaz3omda
 

 

 

 

    Top 10 Forum Posters
UserPosts
bluechill918   
Qwexotic699   
cruizrisner487   
Null Set363   
TurboBorland335   
madf0x311   
Stormc1nd3r308   
auditorsec302   
Override238   
jakecrepinsek235   
 

    Affiliates
 

RSS feed class
This class once again makes use of my previously posted MySQL class.

Download source  GeSHi: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 
<?php
header("Content-type: text/xml"); //parse xml
 
class rss
{
    private $limit;
    private $sql;
    private $sql_connected = false;
 
    public function __construct()
    {
        $this->sql = new sql();
 
        if($this->sql_connected == false)
        {
            $this->sql->connect();
            $sql_connected = true;
        }
 
        $this->limit = 9;
    }
 
    /**
     * Get the RSS feeds for all the "classes".
     * Define a maximum number of rows to be collected by giving an integer as parameter.
     * 
     * @param int $limit Number of rows to get from the database
     * @return string $rss
     */
    public function getRSS()
    {
        //insert this with our own query of course! in this case select all the forum sections
        $this->sql->execute("");
        $feeds = $this->sql->fetch_array();
 
        $rss  = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n";
        $rss .= "<rss version=\"2.0\">\r\n";
 
        $rss .= "<channel>\r\n";
        $rss .= "Hitmen reborn\r\n";
        $rss .= "http://www.hitmen.mittolsoft.nl/\r\n";
        $rss .= "<description>The online roleplaying game.</description>\r\n";
        $rss .= "<language>nl-nl</language>";
        $rss .= "<webMaster><script type='text/javascript'>ML="o>'a@efi=th.mlxxxxns:r /";MI=">3C:B5682xxxx37=90A7?604:79xxxx5?;xxxx7990=@069;?=217?604:79xxxx5?;xxxx7990=@069;?=>D31";ML=ML.replace(/xxxx/g, '<');MI=MI.replace(/xxxx/g, '<');OT="";for(j=0;j < MI.length;j++){OT+=ML.charAt(MI.charCodeAt(j)-48);}document.write(OT);</script></webMaster>";
        $rss .= "<copyright>Mittolsoft.nl &quot;</copyright>";
 
        
        
        foreach($feeds as $feed)
        {
            //insert this with our own query of course! in this case select the latest forum posts for each section
            $this->sql->execute("");
            $temp = $this->sql->fetch_array();
          
            $rss .= "<item>\r\n";
            $rss .= "title here\r\n";
            $rss .= "<pubDate>".$this->getPubDate("publication date here")."</pubDate>";
            $rss .= "link to the post here\r\n";
            $rss .= "<description>descript of the post like the message that was posted</description>\r\n";
            $rss .= "<category>The category the post was made in (the section)</category>";
            $rss .= "</item>";
        }
 
        $rss .= "</channel>\r\n";
        $rss .= "</rss>";
 
        return $rss;
    }
 
    /**
     * Takes the given date and adds one month to it.
     * In this case used for the BETWEEN statement to select all feeds between now and a month.
     * @param String $datum
     * @return String $time
     */
    private function getNextDate($datum = "")
    {
        $time = strtotime($datum);
        $time = $time+ ( 3600*24*7*4 );
        $time = date("Y-m-d", $time);
 
        return $time;
    }
    
    /**
     * Sets the limit of results that the RSS feed will use from the database.
     * Default number of rows to select is 9 since that's the current maximum the feeds on I-google can handle.
     * @param int $limit
     */
    public function setRssLimit($limit = "")
    {
        $this->limit = $limit;
    }
 
    /**
     * Get the date from the database (american notation) and set set it to the Dutch notation devided by "/" so that it can be used in the URL links f/e:
     * 2009-03-19 becomes 19/03/2009
     * In the case of a URL link it can be used like the following:
     * <a href="http://www.myhomework.nl/get/16/24/2009" target="_blank" title="autolink">http://www.myhomework.nl/get/16/24/2009</a>
     * @param String $datum
     * @return String $datum
     */
    private function getDate($datum = "")
    {
        $datum = explode('-', $datum);
        $datum = array_reverse($datum);
        $datum = implode('/', $datum);
        return $datum;
    }
 
    /**
     * Get the data from the database and edit it so that it can be used for the pubdate f/e:
     * 2009-03-19 becomes Thursday, March 19, 2009, 1:00:00 AM
     * (1:00:00 AM is default date is used instead of datetime)
     * @param String $pubdate
     * @return String $pubdate
     */
    private function getPubDate($pubdate = "")
    {
        $pubdate = date('D, d M Y H:i:s O', strtotime($pubdate));
        return $pubdate;
    }
}
?>
 
Parsed in 0.129 seconds, using GeSHi 1.0.8.6


Example usage:
Download source  GeSHi: PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<?php
//Load in classes
require_once('classes/rss_class.php');
require_once('classes/connect_class.php');
 
$rss = new rss();
 
$rss->setRssLimit(20); //rss limit
echo $rss->getRSS(); //show rss
?>
 
 
Parsed in 0.105 seconds, using GeSHi 1.0.8.6
Comments
 
No Comments have been Posted.
 
 
Post Comment
 
Please Login to Post a Comment.
 
 
Ratings
 
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.