PageRenderTime 58ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 1ms

/report/main.php

https://bitbucket.org/3tierlogic/3tl.tabbuilder
PHP | 359 lines | 282 code | 51 blank | 26 comment | 26 complexity | 133cbf251703cb1900a7a85568b30ce8 MD5 | raw file
  1. <?php
  2. /* Load and clear sessions */
  3. session_start();
  4. if ( ! isset ( $_SESSION['companyid'] ) ) {
  5. header ( 'Location: http://platform.3tierlogic.com/tabbuilder/index1_3.php' );
  6. exit();
  7. } else {
  8. if (isset($_REQUEST['customerID'])) { ///**** This value is set when logged in as a superuser and selecting a company from the drop down to view
  9. $currentid = $_REQUEST['customerID'];
  10. } else {
  11. $currentid = $_SESSION['companyid'];
  12. }
  13. $issuperuser = $_SESSION['superaccount'];
  14. }
  15. // Connect to database
  16. require_once("db.php");
  17. $con = mysql_connect($dbhost, $dbuser, $dbpasswd); // connect to database
  18. if (!$con) { // error checking and handling
  19. die('Could not connect: ' . mysql_error());
  20. }
  21. mysql_select_db($dbname);
  22. $con_3tl = mysql_connect($dbhost_3tl, $dbuser_3tl, $dbpasswd_3tl); // connect to database
  23. if (!$con_3tl) { // error checking and handling
  24. die('Could not connect to 3TL: ' . mysql_error());
  25. }
  26. mysql_select_db($dbname_3tl);
  27. /*if (isset($_REQUEST['customerID'])) {
  28. $currentid = $_REQUEST['customerID'];
  29. $_SESSION['companyid'] = $currentid;
  30. } else {
  31. $currentid = $_SESSION['companyid'];
  32. }
  33. $issuperuser = $_SESSION['superaccount'];
  34. //echo "ID: ".$currentid.":super: ".$issuperuser;
  35. if ((!isset($currentid)) && (!isset($issuperuser))) {
  36. echo "<script language = 'javascript'> alert('Your session has expire. Please login again');</script>" ;
  37. echo "<script language = 'javascript'> window.location.href = 'index.php'; </script>" ;
  38. }
  39. */
  40. ?>
  41. <!doctype html>
  42. <html lang="en-US">
  43. <head>
  44. <meta charset="UTF-8" />
  45. <title>3 Tier Logic - Platform Tracker V1.3</title>
  46. <link href="style.css" rel="stylesheet" type="text/css" />
  47. <!--[if IE]>
  48. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  49. <![endif]-->
  50. <!--[if IE 6]>
  51. <script src="js/belatedPNG.js"></script>
  52. <script>
  53. DD_belatedPNG.fix('*');
  54. </script>
  55. <![endif]-->
  56. <link rel="stylesheet" href="colorbox.css" />
  57. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  58. <script src="colorbox/jquery.colorbox.js"></script>
  59. <!--<script src="js/jquery-1.4.min.js" type="text/javascript" charset="utf-8"></script>-->
  60. <script src="js/loopedslider.js" type="text/javascript" charset="utf-8"></script>
  61. <script type="text/javascript" charset="utf-8">
  62. $(function(){
  63. $('#slider').loopedSlider({
  64. autoStart: 6000,
  65. restart: 5000
  66. });
  67. });
  68. </script>
  69. <script language = "javascript">
  70. function myformsubmit(ind) {
  71. document.myform.submit();
  72. }
  73. </script>
  74. <script>
  75. $(document).ready(function(){
  76. $(".picspopup").colorbox({
  77. onOpen:function(){ },
  78. onLoad:function(){ },
  79. onComplete:function(){ },
  80. onCleanup:function(){ },
  81. onClosed:function(){ }
  82. });
  83. });
  84. </script>
  85. </head>
  86. <body>
  87. <section id="page">
  88. <div id="bodywrap">
  89. <section id="top">
  90. <nav>
  91. <h1 id="sitename">
  92. <a href="#">3 Tier Logic Inc.</a></h1>
  93. <ul id="sitenav">
  94. <li class="current"><a href="../editor/dashboard.php">Back to Tab Editor</a></li>
  95. </ul>
  96. </nav>
  97. <header id="homeheader">
  98. <?
  99. //**** Get the last 4 articles published on the website to display on the top header
  100. $publishnews_ok = true;
  101. $sql = "SELECT ID, post_date, post_content, post_title FROM 3tierweb.tier_posts WHERE post_type='post' and post_parent='0' and post_status='publish' order by post_date desc Limit 4";
  102. $res = mysql_query($sql, $con_3tl);
  103. if (mysql_num_rows($res) > 0) {
  104. /*while(list($pid, $pdate, $pcontent, $ptitle) = mysql_fetch_array($res)) {
  105. echo $pid."-".$pdate."-".$pcontent."-".$ptitle."<br>";
  106. }*/
  107. $publishnews_ok = true;
  108. } else {
  109. //echo "No Posts found";
  110. $publishnews_ok = false;
  111. }
  112. ?>
  113. <div id="slider">
  114. <div class="container">
  115. <ul class="slides">
  116. <?
  117. if ($publishnews_ok) {
  118. $latestCounter=0;
  119. while(list($pid, $pdate, $pcontent, $ptitle) = mysql_fetch_array($res)) {
  120. //echo $pid."-".$pdate."-".$pcontent."-".$ptitle."<br>";
  121. $sql_icon = "SELECT guid FROM 3tierweb.tier_posts where post_type='attachment' and (post_mime_type='image/jpeg' or post_mime_type='image/png') and post_parent='".$pid."' order by post_date desc";
  122. $res_icon = mysql_query($sql_icon, $con_3tl);
  123. if (mysql_num_rows($res_icon) > 0) {
  124. list($picon) = mysql_fetch_array($res_icon);
  125. } else {
  126. $picon = "";
  127. }
  128. echo "<li><div class='thumbholder'>";
  129. echo "<img src='".$picon."' width='200' height='200' /></div><div class='txtholder'>";
  130. echo "<h2>".$ptitle."</h2>";
  131. $pcontent = substr($pcontent, 0, 180);
  132. //$pcontent = $pcontent."... <a href='http://www5.3tierlogic.com/?p=".$pid."' target='_blank'>More</a>";
  133. $pcontent = $pcontent."...";
  134. if ($latestCounter == 0) {
  135. $latestImage = $picon;
  136. $latestTitle = $ptitle;
  137. $latestLink = "http://www.3tierlogic.com/?p=".$pid;
  138. }
  139. $latestCounter++;
  140. echo "<p>".$pcontent."</p>";
  141. echo "</div></li>";
  142. }
  143. }
  144. ?>
  145. </ul>
  146. <ul class="pagination">
  147. <li><a href="#">1</a></li>
  148. <li><a href="#">2</a></li>
  149. <li><a href="#">3</a></li>
  150. <li><a href="#">4</a></li>
  151. </ul>
  152. </div>
  153. </div>
  154. </header>
  155. </section>
  156. <section id="contentwrap">
  157. <div id="contents">
  158. <section id="normalpage">
  159. <section id="left">
  160. <h2>Report</h2>
  161. <article>
  162. <?
  163. if ($issuperuser) {
  164. $sql = "SELECT cp_companyID, cp_companyName FROM sp_company_info WHERE cp_status=1 order by cp_companyName";
  165. $res = mysql_query($sql, $con);
  166. ?>
  167. <form name="myform" method="POST" action="<?=$_SERVER['PHP_SELF']?>">
  168. <table width="100%">
  169. <tr><td>
  170. <b>Company:</b> <select name = "customerID" onChange = "myformsubmit(1);">
  171. <option value = ""> select </option>
  172. <?
  173. while(list($cid,$cname) = mysql_fetch_array($res)) {
  174. if($currentid == $cid) {
  175. echo "<option value = '$cid' selected> $cname </option>";
  176. } else {
  177. echo "<option value = '$cid'> $cname </option>";
  178. }
  179. }
  180. ?>
  181. </select>
  182. </td></tr>
  183. </table>
  184. </form>
  185. <?
  186. }
  187. //echo "companyID: ".$currentid;
  188. //**** Get the company Name for the selected companyID
  189. if ($currentid != "") {
  190. $sql_company = "SELECT cp_companyName FROM sp_company_info WHERE cp_companyID = '".$currentid."'";
  191. $res_company = mysql_query($sql_company, $con);
  192. if (mysql_num_rows($res_company) > 0) {
  193. list($currentCompanyName) = mysql_fetch_array($res_company);
  194. } else {
  195. $currentCompanyName = "Missing company name";
  196. }
  197. ?>
  198. <table cellspacing="0" cellpadding="0" border="0">
  199. <tr>
  200. <td align="left">
  201. <?
  202. //***** Select all the campaigns associated with the company
  203. $sql = "select campaign_sid, campaign_name, campaign_is_check_reentry FROM sp_campaign_info WHERE partner_sid = '".$currentid."'";
  204. $res = mysql_query($sql, $con);
  205. if (mysql_num_rows($res) > 0) {
  206. echo "<b>Select the campaign report you want to view:</b><br><br>";
  207. while(list($campaignID,$campaignName, $singleentry) = mysql_fetch_array($res)) {
  208. if ($singleentry == 1) {
  209. $multipleentry = "images/singleentry.png";
  210. } else {
  211. $multipleentry = "images/multipleentries.png";
  212. }
  213. ?>
  214. <a href="dailyentries.php?cID=<?=$campaignID?>"><?=$campaignName?> Report</a>
  215. <img src="<?=$multipleentry?>"></a>
  216. <br /><br>
  217. <?
  218. } //** WHILE
  219. } else {
  220. echo "No reports!";
  221. }
  222. ?>
  223. </td>
  224. </tr>
  225. </table>
  226. <?
  227. }
  228. ?>
  229. </article>
  230. </section>
  231. <section id="sidebar">
  232. <h2>Twitter</h2>
  233. <article class="testimonials">
  234. <script src="http://widgets.twimg.com/j/2/widget.js"></script>
  235. <script>
  236. new TWTR.Widget({
  237. version: 2,
  238. type: 'search',
  239. search: 'from:3tierlogicrobc OR from:3tierlogicmarie OR from:3tierlogiccarlo OR from:3TierLogicABat OR from:3tierlogicDOM OR from:3TierLogicBlack OR from:3tierlogicJILL OR from:3tierlogicPaul OR from:3tierlogicsandi',
  240. interval: 6000,
  241. title: '3 Tier Logic Twitter Feeds',
  242. subject: 'LIVE',
  243. width: 280,
  244. height: 300,
  245. theme: {
  246. shell: {
  247. background: '#333333',
  248. color: '#ffffff'
  249. },
  250. tweets: {
  251. background: '#000000',
  252. color: '#ffffff',
  253. links: '#4aed05'
  254. }
  255. },
  256. features: {
  257. scrollbar: false,
  258. loop: true,
  259. live: true,
  260. hashtags: true,
  261. timestamp: false,
  262. avatars: true,
  263. toptweets: true,
  264. behavior: 'default'
  265. }
  266. }).render().start();
  267. </script>
  268. </article>
  269. </section>
  270. <div class="clear"></div>
  271. </section>
  272. </div>
  273. </section>
  274. </div>
  275. <footer id="pagefooter">
  276. <div id="bottom">
  277. <div class="block1">
  278. <h2>Meet The Team</h2>
  279. <div class="teamimg">
  280. <? include("team.php")?>
  281. <!--<div class="imgthmb"><img src="images/team5.jpg" width="65" height="65" alt="team"></div>
  282. <div class="imgthmb"><img src="images/team1.jpg" width="65" height="65" alt="team"></div>
  283. <div class="imgthmb"><img src="images/team2.jpg" width="65" height="65" alt="team"></div>
  284. <div class="imgthmb"><img src="images/team4.jpg" width="65" height="65" alt="team"></div>
  285. <div class="imgthmb"><img src="images/team2.jpg" width="65" height="65" alt="team"></div>
  286. <div class="imgthmb"><img src="images/team1.jpg" width="65" height="65" alt="team"></div>-->
  287. </div>
  288. </div>
  289. <div class="block2">
  290. <h2>Latest Project</h2>
  291. <div class="projectthmb"> <a href="<?=$latestLink?>"><img src="<?=$latestImage?>" width="240" height="150" alt="project"></a><br><p style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#FFF"><?=$latestTitle?></p></div>
  292. </div>
  293. <div class="block3">
  294. <h2>About</h2>
  295. <p>3 Tier Logic is a full service digital marketing and technology services company that enables organizations to grow their customer and prospect communities through anywhere-anytime communications. </p>
  296. </div>
  297. <div class="clear"></div>
  298. </div>
  299. <div id="credits">
  300. <p>
  301. <span class="copyright">
  302. &copy; 2012 | 3 Tier Logic Inc | All Rights Reserved </span>
  303. </div>
  304. </footer>
  305. </section>
  306. </body>
  307. </html>