cat_list_2.php * Date:October 2011 * Author:Steadroy Thompson * Description: This page is the home page */ session_start(); include_once("classes/news.class.php"); include_once("classes/paginator.class.php"); include_once("classes/commonDB.class.php"); include_once("classes/config.php"); include_once("connect.php"); $comobj = new commonDB(); $newsObj = new news(); $filePath = PROFILE_IMG_PATH; $result_s = mysql_query("SELECT * FROM images WHERE articleid = '$id'"); // get all images based on id if ($result_s && mysql_num_rows($result_s)) { $numrows = mysql_num_rows($result_s); $i=0; while ($row = mysql_fetch_assoc($result_s)) { $datas[$i] = $row['image']; $datascap[$i] = $row['caption']; // place image names in a array called dataas $i++; } } // =================images =============== $ids = $row['articleid']; $result_s = mysql_query("SELECT * FROM images WHERE articleid = '$ids'"); $rowf = mysql_fetch_assoc($result_s); $idsa =$row['userid']; $result_s = mysql_query("SELECT * FROM user WHERE userid = '$idsa'"); $rowe = mysql_fetch_assoc($result_s); $comp = $rowe['company']; // gettting id number and making decision if current company is managed by PR or not $compid=safe($_GET['compid']); $result_s = mysql_query("SELECT * FROM article WHERE articleid = '$compid'"); $rowe = mysql_fetch_assoc($result_s); $user_comp = $rowe['userid']; $comp_user = $rowe['company_id']; // decide if company is pr or not if ( $comp_user > 0 ) { $the_key_comp = $comp_user; $query = "SELECT COUNT(*) FROM article WHERE company_id = '$the_key_comp' && release_date <= NOW() && articleallow = '1' ORDER BY views DESC"; $result = mysql_query($query); }else { $the_key_user = $user_comp; $query = "SELECT COUNT(*) FROM article WHERE userid = '$the_key_user' && release_date <= NOW() && articleallow = '1' ORDER BY views DESC"; $result = mysql_query($query); } $num_rows = mysql_fetch_row($result); $pages = new Paginator; $pages->items_total = $num_rows[0]; $pages->mid_range = 2; // Number of pages to display. Must be odd and > 3 $pages->paginate(); $post_number = $num_rows[0]; // decide if company is pr or not if ($comp_user > 0 ) { $the_key_comp = $comp_user; $query = "SELECT * FROM article WHERE company_id = '$the_key_comp' && release_date <= NOW() && articleallow = '1' ORDER BY views DESC $pages->limit"; $result = mysql_query($query); }else { $the_key_user = $user_comp; $query = "SELECT * FROM article WHERE userid = '$the_key_user' && release_date <= NOW() && articleallow = '1' ORDER BY views DESC $pages->limit"; $result = mysql_query($query); } $ids_art =$row['articleid']; $idsa_userid =$row['userid']; $comp_userid=$row['company_id']; $gettheid_1 = $newsObj->getthecorr_author($idsa_userid); //Seleccting the correct display name for the comapnay if ($gettheid_1['Class'] == 1) { $comp=$row['company_id']; $gettheid_2 = $newsObj->getthecorr_author2($comp_userid); $rowe_comp2 = $gettheid_2['comp_name']; } if ($gettheid_1['Class'] == 1) { $the_name = $gettheid_2['comp_name']; } else { $the_name = $gettheid_1['company']; } $compids = $_GET['compid']; $sqlcname="select * from company where Companyid ='$compids' " ; $resultcname= mysql_query($sqlcname) or die(mysql_error()); $resultcname; $cnameob= mysql_fetch_assoc($resultcname); $compname = $cnameob['comp_name']; include('tpl_bycompany.html'); ?>