



", "", $val);
$val = str_replace("
", "", $val);
return $val;
}
$sql = "SELECT * FROM `videos` WHERE `id` = '$id' AND `status` = '0' AND `show` = 'yes'";
$temp = mysql_query($sql) or die('Error, Video table query failed : ' . mysql_error());
$count_row = mysql_num_rows($temp);
if($count_row == '0'){
header("Location: http://videos.wishbowl.org/404.html");
}
$dlist = mysql_fetch_array($temp);
$file_id = $dlist['id'];
$cat_id = $dlist['cat_id'];
$cat_quary = "SELECT * FROM `video_category` WHERE `id` = '$cat_id'";
$cat_result = mysql_query($cat_quary) or die('Error, Category table query failed : ' . mysql_error());
$count_row_cat = mysql_num_rows($cat_result);
if($count_row_cat == '0'){
header("Location: http://videos.wishbowl.org/404.html");
}
$cat_row = mysql_fetch_array($cat_result);
$cid = $cat_row['id'];
$path = $cat_row['path'];
$path_name = $cat_row['path_name'];
$cat_name = $cat_row['cat_name'];
$cat_url = $cat_row['cat_url'];
$cat = $cat_row['cat_url'];
$l_path = explode("/", $path);
$l_path_name = explode(": ", $path_name);
$ii = count($l_path)-1;
$c_url = $l_path[0];
$title = $dlist['title'];
$description = str_replace("
", "
", $dlist['description']);
$description = str_replace("
", "
",$description);
$description = str_replace('\"', '"',$description);
$description = str_replace("\'", "'",$description);
$likes = $dlist['likes'];
$views = $dlist['views'];
$embedded_code = $dlist['embedded_code'];
$swf_file_name = $dlist['swf_file_name'];
$count_word_swf = str_word_count($swf_file_name);
if($count_word_swf > 0){
if($swf_file_name != '')
{
$p_width = $dlist['width'];
$p_height = $dlist['height'];
$x = $p_height*$o_width;
$y = $x/$p_width;
$o_hight = round($y);
if($p_width >= 740){
$width = $o_width;
$height = $o_hight;
}else{
$width = $p_width;
$height = $p_height;
}
}
}
$tot_views = $views + 1;
$qry_views = mysql_query("UPDATE `videos` SET `views`='$tot_views' WHERE `id` = '$id' AND `status` = '0' AND `show` = 'yes'");
$nxt = "SELECT `id` FROM `videos` WHERE `id` > '$id' AND `cat_id` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` > '$id' AND `additional_cat_id` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` > '$id' AND `additional_cat_id1` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` > '$id' AND `additional_cat_id2` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` > '$id' AND `additional_cat_id3` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` > '$id' AND `additional_cat_id4` = '$cid' AND `status` = '0' AND `show` = 'yes' ORDER BY `id` ASC LIMIT 0,1";
$r_nxt = mysql_query($nxt) or die('Error, Select video query failed : ' . mysql_error());
if (mysql_num_rows($r_nxt) == 0)
{
$nxtr = 'http://videos.wishbowl.org/'.$cat.'-videos.html';
}else
{
while($row_next = mysql_fetch_array($r_nxt))
{
$nxtr = 'http://videos.wishbowl.org/video-'.$row_next[id].'.html';
}
}
$pre = "SELECT `id` FROM `videos` WHERE `id` < '$id' AND `cat_id` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` < '$id' AND `additional_cat_id` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` < '$id' AND `additional_cat_id1` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` < '$id' AND `additional_cat_id2` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` < '$id' AND `additional_cat_id3` = '$cid' AND `status` = '0' AND `show` = 'yes' OR `id` < '$id' AND `additional_cat_id4` = '$cid' AND `status` = '0' AND `show` = 'yes' ORDER BY `id` DESC LIMIT 0,1";
$r_pre = mysql_query($pre) or die('Error, query failed ' . mysql_error());
if (mysql_num_rows($r_pre) == 0)
{
$prer = 'http://videos.wishbowl.org/'.$cat.'-videos.html';
}else
{
while($row_pre = mysql_fetch_array($r_pre))
{
$prer = 'http://videos.wishbowl.org/video-'.$row_pre[id].'.html';
}
}
$q_g_td = "SELECT * FROM `v_palyed_today` WHERE `date` = '$date'";
$r_td = mysql_query($q_g_td) or die('Error, Query failed to video today play count : ');
if (mysql_num_rows($r_td) != 1)
{
$q_td = "INSERT INTO `v_palyed_today` (`count`, `date`) VALUES ('1', '$date')";
$r_td = mysql_query($q_td) or die('Error, Query failed to upload first step to count : ');
}
else
{
$r_td = mysql_fetch_array($r_td);
$td_cont = $r_td['count'];
$tdc = $td_cont+1;
$tresult = mysql_query("UPDATE `v_palyed_today` SET `count` = '$tdc' WHERE `date` = '$date'") or die('Error, Query failed of count :' . mysql_error());
}
?>