function convert_to_india_time($date){
$month = date("n", strtotime($date));
$day = date("j", strtotime($date));
//DST from March 10th to November 3 for USA
if ($month > 3 && $month < 11){
return date("F d, Y h:i A", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else if ($month == 3 && $day >= 10){
return date("F d, Y h:i A", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else if ($month == 11 && $day <= 3){
return date("F d, Y h:i A", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else{ // non-DST time
return date("F d, Y h:i A", strtotime("+11 hours 30 minutes", strtotime($date)));
}
}
function convert_to_india_time_short($date){
$month = date("n", strtotime($date));
$day = date("j", strtotime($date));
//DST from March 10th to November 3 for USA
if ($month > 3 && $month < 11){
return date("d/m/Y", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else if ($month == 3 && $day >= 10){
return date("d/m/Y", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else if ($month == 11 && $day <= 3){
return date("d/m/Y", strtotime("+10 hours 30 minutes", strtotime($date)));
}
else{ // non-DST time
return date("d/m/Y", strtotime("+11 hours 30 minutes", strtotime($date)));
}
}
function cleanup_for_url( $string ){
$string = str_replace(" - ", "_", $string);
$string = str_replace("-", "_", $string);
$string = str_replace(" ", "_", $string);
$string = str_replace("'", "", $string);
$string = str_replace(",", "", $string);
$string = str_replace("?", "", $string);
$string = str_replace("!", "", $string);
$string = str_replace("%", "", $string);
$string = str_replace("__", "_", $string);
return $string;
}
//Use this to prevent SQL Injection
function sql_quote( $value ){
if( get_magic_quotes_gpc() )
{
$value = stripslashes( $value );
}
//check if this function exists
if( function_exists( "mysql_real_escape_string" ) )
{
$value = mysql_real_escape_string( $value );
}
//for PHP version < 4.3.0 use addslashes
else
{
$value = addslashes( $value );
}
return $value;
}
function display_pagenation($total_pages, $current_page, $file_name){
$display_count = 12;
$display_count_before = 5;
$display_count_after = 1 + $display_count - $display_count_before;
global $category_id;
if ($total_pages > $display_count){
$start = ($current_page - $display_count_before);
if ($start < 0) $start = 0;
$end = ($current_page + $display_count_after);
if ($end > $total_pages) $end = $total_pages;
}
else{
$start = 0;
$end = $total_pages;
}
if ($current_page > 0){
echo " << previous ";
}
for($i = $start; $i < $end; $i++){
if ($i == $current_page){
if ($i == $start){
echo " " . ($i + 1);
}
else{
echo " | " . ($i + 1);
}
}
else{
echo " | " . ($i + 1) . " ";
}
}
if ($current_page < $total_pages - 1){
echo " | next >>";
}
}
function display_pagenation_querystring($total_pages, $current_page, $file_name){
$display_count = 12;
$display_count_before = 5;
$display_count_after = 1 + $display_count - $display_count_before;
global $category_id;
if ($total_pages > $display_count){
$start = ($current_page - $display_count_before);
if ($start < 0) $start = 0;
$end = ($current_page + $display_count_after);
if ($end > $total_pages) $end = $total_pages;
}
else{
$start = 0;
$end = $total_pages;
}
if ($current_page > 0){
echo " << previous ";
}
for($i = $start; $i < $end; $i++){
if ($i == $current_page){
if ($i == $start){
echo " " . ($i + 1);
}
else{
echo " | " . ($i + 1);
}
}
else{
echo " | " . ($i + 1) . " ";
}
}
if ($current_page < $total_pages - 1){
echo " | next >>";
}
}
function only_numbers_and_comma($val){
$reg = "#[^0-9 -]#i";
$count = preg_match($reg, $val, $matches);
if ($count > 0){
return false;
}
else{
return true;
}
}
//strip all chars from source other than those mentioned in $allow.
//eg: cleanup_allow("12,13,14a", "0123456789,") => "12,13,14"
function cleanup_allow($value, $allow){
$output = $value;
for($i = 0; $i < strlen($value); $i++){
$temp = substr($value, $i, 1);
$allowed = false;
for ($j = 0; $j < strlen($allow); $j++){
$temp_allow = substr($allow, $j, 1);
if ($temp == $temp_allow){
$allowed = true;
break;
}
}
if ($allowed == false){
$output = str_replace($temp, "", $output);
}
}
return $output;
}
//find_invalid_chars returns true if invalid chars are found.
function find_invalid_chars($value, $invalid){
for($i = 0; $i < strlen($invalid); $i++){
$invalid_char = substr($invalid, $i, 1);
if (strpos($value, $invalid_char) === false){
continue;
}
else{
return true;
}
}
return false;
}
?>
:: TV CLUB /
()
/
if (!empty($video_embed_code)){ ?>
}
if (!empty($ad_image)){ ?>
} ?>
if (((strpos(strtolower($swf_path), "jpg") !== false) || (strpos(strtolower($swf_path), "jpeg") !== false))){ ?>
}
else{ ?>
}
?>
VIEWS - echo get_tvclub_article_hits($article_id) + 0 ?>
if (!empty($program_details_arr["ProgramSWF"])){ ?>
ABOUT ''
} ?>
POST YOUR COMMENT
EMAIL STORY
require_once "utils/db_utils.php";
require_once "utils/string_utils.php";
require_once "utils/config.php";
if (!isset($con)) $con = db_connect();
//pagenation
$article_count = get_tvclub_artcile_count($program_id);
$page_size = $category_page_limit;
$page_number = (isset($_GET["pn"]) && is_numeric($_GET["pn"]))?$_GET["pn"]:0;
$from = ($page_number * $page_size);
$to = ($page_number + 1) * $page_size;
$total_pages = ($article_count > 0) ? ceil($article_count/$page_size) : 1;
if ($program_id == 0){
$display_title = "TV CLUB RECENT ARTICLES";
$qry = "SELECT * FROM TVClubArticle
WHERE Active = 'Y'
ORDER BY ArticleId DESC
LIMIT $from, $page_size";
}
else{
$program_arr = get_program_details($program_id);
$display_title = "TV CLUB : " . $program_arr["Program"] . " (" . $program_arr["Channel"] . ") Recent Articles";
$qry = "SELECT * FROM TVClubArticle
WHERE Active = 'Y'
AND ProgramId = '$program_id'
ORDER BY ArticleId DESC
LIMIT $from, $page_size";
}
$res = mysql_query($qry) or die(mysql_error());
?>
::
if ( mysql_num_rows($res) > 0 ){
while ($rec = mysql_fetch_array($res)){
$l_id = $rec["ArticleId"];
$l_title = stripslashes($rec["Title"]);
$l_titleimage = $rec["TitleImage"];
$l_url = "/tvclubarticle.php?id=" . $l_id; ?>
}
if ($total_pages > 1){ ?>
display_pagenation_querystring($total_pages, $page_number, $_SERVER['PHP_SELF'] . "?id=" . $article_id) ?>
}
} ?>
require_once "utils/db_utils.php";
require_once "utils/string_utils.php";
require_once "utils/config.php";
if (!isset($con)) $con = db_connect();
$comment_count_qry = "SELECT COUNT(1) FROM TVClubComments WHERE Approve='Y' AND ArticleId='$article_id'";
$comment_count_res = mysql_query($comment_count_qry) or die(mysql_error());
$comment_count_rec = mysql_fetch_array($comment_count_res);
$total_comments = $comment_count_rec[0];
$qry = "SELECT * FROM TVClubComments WHERE Approve='Y' AND ArticleId='$article_id' ORDER BY CommentId DESC LIMIT $category_comments_limit";
$res = mysql_query($qry) or die(mysql_error());
if (mysql_num_rows($res) > 0){
?>
while ($rec = mysql_fetch_array($res)){
$name = $rec["Name"];
$postedon = date("F d, Y h:i A", strtotime("+11 hours 30 minutes", strtotime($rec["TS"])));
$comment = $rec["Comment"]; ?>
} ?>
if ($total_comments > $category_comments_limit){ ?>
}
}
else{ ?>
}
?>
session_start();
require_once "utils/db_utils.php";
require_once "utils/email_utils.php";
require_once "utils/file_utils.php";
require_once "utils/config.php";
if (!isset($con)) $con = db_connect();
if( ($_SERVER['REQUEST_METHOD'] == "POST") && ($_POST["formcode"] == "COMMENTS") ){
$c_name = mysql_real_escape_string(trim($_POST["c_name"]));
$c_email = mysql_real_escape_string($_POST["c_email"]);
$c_comments = mysql_real_escape_string($_POST["c_comments"]);
$c_comments = strip_tags($c_comments, ' ');
$c_comments_telugu = mysql_real_escape_string($_POST["c_comments_telugu"]);
$c_comments_telugu = strip_tags($c_comments_telugu, '
');
$c_comments_text = (empty($c_comments_telugu)) ? $c_comments : $c_comments_telugu;
$language = $_POST["language"];
$c_captcha = $_POST["c_captcha"];
$captcha_key = substr($_SESSION['captchakey'],0,6);
if ($c_captcha != $captcha_key){
$comments_message = "Verification code not valid. Please try again";
if ($language == "t"){ ?>
}
}
else{
$qry = "INSERT INTO TVClubComments (ArticleId, Name, Email, Comment)
VALUES('$article_id', '$c_name', '$c_email', '$c_comments_text')";
$res = mysql_query($qry) or die(mysql_error());
$comments_message = "Your comments have been submitted for review and approval";
$c_name = "";
$c_email = "";
$c_comments = "";
}
}
?>
:: FILM & TV CLUB
$qry = "SELECT * FROM TVPrograms WHERE Active='Y'";
$res = mysql_query($qry) or die(mysql_error());
?>
$loop_index = 0;
while ( $rec = mysql_fetch_array($res) ){
$id = $rec["ProgramId"];
$channel = $rec["Channel"];
$program = $rec["Program"];
$photo_path = $rec["Photo"]; ?>
$loop_index++;
if ($loop_index % 6 == 0){ ?>
}
} ?>
require_once "utils/db_utils.php";
require_once "utils/email_utils.php";
require_once "utils/file_utils.php";
require_once "utils/config.php";
if (!isset($con)) $con = db_connect();
if( ($_SERVER['REQUEST_METHOD'] == "POST") && ($_POST["formcode"] == "NEWSLETTER") ){
$nl_email = trim($_POST["nlemail"]);
if ( !empty($nl_email) && ($nl_email != "") ){
$dup_qry = "SELECT * FROM NewsLetterSubscriptions WHERE Email='$nl_email'";
$dup_res = mysql_query($dup_qry) or die(mysql_error());
if (mysql_num_rows($dup_res) == 0){
$qry = "INSERT INTO NewsLetterSubscriptions(Email) VALUES('$nl_email')";
$res = mysql_query($qry) or die(mysql_error());
$sid = mysql_insert_id();
if ($res) { $status = "done"; }
//SEND THE EMAIL
if ($sid > 0){
$email_template = "newsletter_email_verification_template.html";
$to_email = $nl_email;
$from_email = "webmaster@forwomen.in";
$subject = "ForWomen.in Newsletter Subscription Verification";
$email_body = read_file($email_template);
$sidcode = $sid * 379;
$email_body = str_replace("##sidcode##", $sidcode, $email_body);
phpmail($from_email, $to_email, $subject, $email_body, "html");
}
}
else{
$status = "duplicate";
}
}
}
?>