Your IP : 216.73.216.40


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

<?php
include "../functions.inc";
dbConnect();
session_start();

$tbl = 'tvnews';
$pg = $_REQUEST["pg"];

?>
<html><head>
<title>Newsflash @ Science Conclave 2013</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="shortcut icon" href="favicon.ico">

<?php
switch ($pg) {
case "runningnews":
	echo "<meta http-equiv='refresh' content='90;url=?pg=runningnews'>
	<script type='text/javascript' src='ajax.js'></script>
	<script type='text/javascript' src='rss.js'></script>";
	break;
case "breakingnews":
        echo "<meta http-equiv='refresh' content='90;url=?pg=breakingnews'>";
        break;
}
?>
</head>
<?php
//if ($pg) echo "<body background='logo1.jpg' STYLE='background-repeat: no-repeat; background-position: center; padding: 10px'
if ($pg) echo "<body style='margintop: 0px; padding-top: 0px;'>
<form method='post' action='$PHP_SELF?pg=$pg' enctype='multipart/form-data'>";

switch ($pg) {
case "title":
		echo "<div class='title'>News Flash @ Science Conclave 2013 <a href='?pg=postnews' style='font-size:10pt; font-weight: normal;' target='new'>post</a></div>";
		break;

	case "runningnews":
		$str = '<?xml version=\"1.0\" ?> <rss version=\"2.0\"><channel>';
		$rs = mysql_query("SELECT * FROM tvnews where tvflash='yes' and status='online' order by dated desc, id desc");

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

                	$str .= "<item>
                	<title>$subject</title>
                	<link>$sender</link>
                	<description>$description<br>";
			if ($attachment && strpos(mime_content_type("/var/www/websites/indem/newsflash/attachments/$attachment"),'image'))
				$str .= "<img src='attachments/$attachment' width='300' height='300'>";
                	$str .= "</description><pubDate>$dated</pubDate>
                	<category>News</category>
                	</item>";
        	}
        	$str .= "</channel></rss>";

		$file = 'rss.xml';
        	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);
        	shell_exec("chmod 757 $file");

		echo "<div class='newsflash' id='newsflash'></div>";
		break;

case "breakingnews":
	$rs = mysql_query("select * from $tbl where status='online' order by dated desc limit 2");
	while ($o = mysql_fetch_object($rs)) {
		$i++;
		//$news .= "{$o->subject}&nbsp;-&nbsp;{$o->description}&nbsp;({$o->sender}),&nbsp;";		
		if ($i % 2) $news .= "<font color='blue'>$i. {$o->subject}&nbsp;-&nbsp;{$o->description}&nbsp;</font>";		
		else $news .= "<font color='maroon'>$i. {$o->subject}&nbsp;-&nbsp;{$o->description}&nbsp;</font>";		
	}
	echo "<marquee align='middle' bgcolor='white' behavior='sequence' direction='left' scrollamount='5'
	scrolldelay='10' loop='infinite' style='font-size:65px; font-family:verdana; height:75px'>
        $news
        </marquee>";
        break;

case "postnews":
	include "postnews.inc";
	break;

default:
	echo "<frameset rows='10%,75%,15%' border='0'>
	<frame src='?pg=title' height='100%' name='a' width='100%' marginwidth='0' scrolling='no' noresize>
	<frame src='?pg=runningnews' height='100%' name='b' width='100%' marginwidth='0' scrolling='no' noresize>
	<frame src='?pg=breakingnews' height='100%' name='c' width='100%' marginwidth='0' scrolling='no' noresize>
	</frameset>";
	break;
}
if ($pg) echo "</form></body>";
?>
</html>