Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/newsflash/
Upload File :
Current File : /var/www/html/mmishra/indem/newsflash/tvNews.php

<?php
function dbConnect() {
        $link = mysql_connect("localhost", "root", "iagtku!!");
        mysql_select_db("indem");
        return $link;
}
dbConnect();
function newsfeed(){
        $str = '<? xml version=\"1.0\" ?> <rss version=\"2.0\"><channel>';
        $rs = mysql_query("SELECT * FROM tvnews where status='online' order by dated desc, id desc");

        while ($o = mysql_fetch_object($rs)) {
                $subject = $o->subject;
                $description = $o->description;
                $sender = $o->sender;
                $dated = $o->dated;
                $expiry = $o->expiry;

                $str .= "<item>
                <title>$subject</title>
                <link>$sender</link>
                <description>$description</description>
                <pubDate>$dated</pubDate>
                <category>News</category>
                </item>";
        }
        $str .= "</channel></rss>";
        generate_file("rss.xml", $str);
	return $str;
}
function generate_file($file, $str) {
        if (!file_exists($file)) {
                touch ($file);
        }
        if (!$handle = fopen ($file, 'w+')) {
                echo "$file file permission error";
        } else if (is_writable($file)) {
                if (fwrite ($handle, $str) === FALSE) {
                        echo "Can't write to $file";
                }
        }
        fclose($handle);
        $out = shell_exec("chmod 757 $file");
}
echo newsfeed();
?>