"; include 'opendb.php'; //$cat = str_replace("-", "_", $_REQUEST['cat']); $cat = $_REQUEST['cat']; $get_cat = $_REQUEST['cat']; //echo "CAT = $cat
"; $w = $_REQUEST['w']; $w = (($w*20)-20); $st = $w; $pr = $_REQUEST['pr']; if((!$st || ($st < 0))) $st = 0; if(!$pr) $pr = 20; $slr = round($st/$pr, 0)+2; $next = $st+$pr; if($st <= $pr) { $back = 0; }else{ $back = $st-$pr; } $val = str_replace("_", " ", $cat); $val = str_replace("-", " ", $val); $path = '/'.$_REQUEST[cat]; $sqlch = "SELECT * FROM `poems_main_categories` WHERE `cat_url` = '$cat'"; $resultch = mysql_query($sqlch) or die('Error, query failed ' . mysql_error()); $count_if_ext = mysql_num_rows($resultch); if($count_if_ext != '0') { $cat_url = $cat; $rowch = mysql_fetch_array($resultch); $category_name = $rowch['cat_name']; $q_cat_url = $rowch['cat_url']; $head_title = $rowch['cat_name']; $head_title_text = ''; $title = $rowch['cat_title']; $keywords = $rowch['cat_keywords']; $description = $rowch['cat_description']; $cat_text = $rowch['cat_text']; $inccat = 1; if($_REQUEST['w'] > '0') { $ww = $w+1; $meta_title_end = " - page $_REQUEST[w]"; } } else { $sqlcdb = "SELECT * FROM `poems_categories` WHERE `sub_cat_url` = '$cat' AND `sub` = 'no'"; $resultcdb = mysql_query($sqlcdb) or die('Error, query failed ' . mysql_error()); $count_if_exist = mysql_num_rows($resultcdb); if($count_if_exist != '0') { $rowcdb = mysql_fetch_array($resultcdb); $catnamedb = $rowcdb['cat_name']; $subcatnamedb = $rowcdb['sub_cat_name']; $sub_cat_url = $rowcdb['sub_cat_url']; $head_title = $rowcdb['sub_cat_name']; $head_title_text = $rowcdb['cat_name']; $cat_url = $rowcdb['cat_url']; $q_cat_url = $rowcdb['cat_url']; $title = $rowcdb['sub_cat_title']; $keywords = $rowcdb['sub_cat_keywords']; $description = $rowcdb['sub_cat_description']; $cat_text = $rowcdb['sub_cat_text']; $inccat = 1; if($_REQUEST['w'] > '0') { $meta_title_end = " - page $_REQUEST[w]"; } } else { $sql_q = "SELECT * FROM `poems_sub_categories` WHERE `ss_cat_url` = '$cat'"; $result_q = mysql_query($sql_q) or die('Error, query failed ' . mysql_error()); $count_ext = mysql_num_rows($result_q); if($count_ext != '0') { $dlist = mysql_fetch_array($result_q); $cat_name = $dlist['cat_name']; $cat_url = $dlist['cat_url']; $sub_cat_name = $dlist['sub_cat_name']; $sub_cat_url = $dlist['sub_cat_url']; $ss_cat_name = $dlist['ss_cat_name']; $ss_cat_url = $dlist['ss_cat_url']; $head_title = $dlist['ss_cat_name']; $head_title_text = $dlist['sub_cat_name']; $title = $dlist['ss_cat_title']; $keywords = $dlist['ss_cat_keywords']; $description = $dlist['ss_cat_description']; $cat_text = $dlist['ss_cat_text']; $inccat = 0; if($_REQUEST['w'] > '0') { $meta_title_end = " - page $_REQUEST[w]"; } } else { $sqlcdb = "SELECT * FROM `poems_sub_categories` WHERE `sub_cat_url` = '$cat'"; $resultcdb = mysql_query($sqlcdb) or die('Error, query failed ' . mysql_error()); $count_if_exist = mysql_num_rows($resultcdb); if($count_if_exist == '0') { header("HTTP/1.1 301 Moved Permanently"); header("Location: /"); } else { $rowcdb = mysql_fetch_array($resultcdb); $cat_name = $rowcdb['cat_name']; $cat_url = $rowcdb['cat_url']; $sub_cat_name = $rowcdb['sub_cat_name']; $sub_cat_url = $rowcdb['sub_cat_url']; $ss_cat_name = $rowcdb['ss_cat_name']; $ss_cat_url = $rowcdb['ss_cat_url']; $head_title = $rowcdb['sub_cat_name']; $head_title_text = $rowcdb['cat_name']; $title = $rowcdb['ss_cat_title']; $keywords = $rowcdb['ss_cat_keywords']; $description = $rowcdb['ss_cat_description']; //$cat_text = $rowcdb['ss_cat_text']; $sqlsub = "SELECT * FROM `poems_categories` WHERE `sub_cat_url` = '$cat'"; $resultsub = mysql_query($sqlsub ) or die('Error, query failed ' . mysql_error()); $rowsub = mysql_fetch_array($resultsub); $subch = $rowsub['sub']; $title = $rowsub['sub_cat_title']; $keywords = $rowsub['sub_cat_keywords']; $description = $rowsub['sub_cat_description']; $cat_text = $rowsub['sub_cat_text']; $inccat = 1; if($_REQUEST['w'] > '0') { $meta_title_end = " - page $_REQUEST[w]"; } } } } } //============================================================================ if($inccat == '0'){ $topsql_sg = "SELECT SUM(voteup) AS `vtup`, SUM(votedown) AS `vtdown`, SUM(views) AS `totalview` FROM `poems` WHERE `cat_url` = '$cat_url' AND `sub_cat_url` = '$sub_cat_url' AND `ss_cat_url` = '$ss_cat_url'"; $tags_qury = "WHERE `tags` != '' AND `cat_url` = '$cat_url' AND `sub_cat_url` = '$sub_cat_url' AND `ss_cat_url` = '$ss_cat_url'"; }else{ if($rowcdb['sub_cat_url'] != ''){ $topsql_sg = "SELECT SUM(voteup) AS `vtup`, SUM(votedown) AS `vtdown`, SUM(views) AS `totalview` FROM `poems` WHERE `cat_url` = '$cat_url' AND `sub_cat_url` = '$sub_cat_url'"; $tags_qury = "WHERE `tags` != '' AND `cat_url` = '$cat_url' AND `sub_cat_url` = '$sub_cat_url'"; }else{ $topsql_sg = "SELECT SUM(voteup) AS `vtup`, SUM(votedown) AS `vtdown`, SUM(views) AS `totalview` FROM `poems` WHERE `cat_url` = '$cat_url'"; $tags_qury = "WHERE `tags` != '' AND `cat_url` = '$cat_url'"; } } //$topsql_sg = "SELECT SUM(voteup) AS `vtup`, SUM(votedown) AS `vtdown`, SUM(views) AS `totalview` FROM `poems`"; $topresult_sg = mysql_query($topsql_sg) or die('Error, query failed ' . mysql_error()); $toprow_sg = mysql_fetch_array($topresult_sg); $voteup_sg = $toprow_sg['vtup']; $votedown_sg = $toprow_sg['vtdown']; $totalview = $toprow_sg['totalview']; $total_sg = $voteup_sg + $votedown_sg; if($voteup_sg > 0) { $percenteach = ($voteup_sg/$total_sg) * 5; $rate_sg = round($percenteach, 0); }else{ $rate_sg = "0"; } //============================================================================= ?> <?=$head_title;?> Poems, Poetry, Verses, Wishes, Quotes, Prose<?=$meta_title_end;?> <?=$title;?><?=$meta_title_end;?> "; } }else{ $k_words = explode(", ", $keywords); for($i = 0; $i < count($k_words); $i++){ echo ""; } } ?>