<?php
header('Content-Type: text/xml');
$connection  = mysql_connect("localhost", "securi_testedusr", "armia") or die("<span style='font-family:Arial, Helvetica, sans-serif; color:#FF0000; font-size:12px; font-weight:bold;'>An error occured :</span>".mysql_errno());
mysql_select_db("securi_tested")or die("<span style='font-family:Arial, Helvetica, sans-serif; color:#FF0000; font-size:11px; font-weight:bold;'>An error occured :</span>".mysql_errno());

 $get_details        = "SELECT
                            siteReportDetailsId , site, reportDetails, DATE_FORMAT(reportDate,'%a, %e %b %Y %T') as formatted_date1
                       FROM
                            site_report_details
                       ORDER BY
                            reportDate DESC
                       LIMIT 15
                       ";
$details            = mysql_query($get_details) or die(mysql_error());

$get_latest_details = "SELECT
                            DATE_FORMAT(reportDate,'%a, %e %b %Y %T') as formatted_date
                       FROM
                            site_report_details
                       ORDER BY
                            reportDate DESC
                        LIMIT 1
                       ";
$latest_details     = mysql_query($get_latest_details) or die(mysql_error());
$latest_detail      = mysql_fetch_assoc($latest_details);
$publish_date       = $latest_detail[formatted_date];

echo '<?xml version="1.0" encoding="utf-8"?>
        <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
            <channel>
                <title>TestedSecurity.com - Test your website for vulnerabilities and security issues!</title>
                <link>http://testedsecurity.com</link>
                <description>TestedSecurity.com - Test your website for vulnerabilities and security issues!</description>
                <pubDate>'.$publish_date.' GMT</pubDate>
                <lastBuildDate>'.$publish_date.' GMT</lastBuildDate>
                <image>
                    <title>Check website security online</title>
                    <url>http://testedsecurity.com/images/initial.jpg</url>
                    <link>http://testedsecurity.com</link>
                </image>';

while ($detail = mysql_fetch_array($details)){
    $description ="";
    $unserial_report_details = unserialize($detail['reportDetails']);

    if($unserial_report_details['isSqli']=='Y'){
        $description .=" Vulnerable to SQL injection ;";
    } else {
        $description .=" Not vulnerable to SQL injection ;";
    }
    if($unserial_report_details['isLFi']=='Y'){
        $description .=" Vulnerable to local file inclusion ;";
    } else {
        $description .=" Not vulnerable to local file inclusion ;";
    }
     if($unserial_report_details['isXss']=='Y'){
        $description .=" Vulnerable to cross site scripting ";
    } else {
        $description .=" Not vulnerable to cross site scripting ";
    }
            echo '
               <item>
                  <title>Testedsecurity report for '.$detail[site].'</title>
                  <description>
                  '.$description.'
                  </description>
                  <link>http://www.testedsecurity.com/site/'.$detail[site].'</link>
                  <pubDate>'.$detail[formatted_date1].' GMT</pubDate>
              </item>';
}
echo '<atom:link href="http://testedsecurity.com/rss.xml" rel="self" type="application/rss+xml" />';
echo '</channel>
</rss>';




?>