Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. <?php
  2.  
  3. include("template.class.php");
  4. session_start();
  5.  
  6. //Initial DB Queries
  7. $query = 'select * from authors '
  8. ."where username ='".$_SESSION['valid_user']."'";
  9. $result = mysql_query($query,$connection) or die(mysql_error());
  10.  
  11.  
  12. //Create user data variables
  13. $info = mysql_fetch_array($result);
  14. $id = $info['id'];
  15. $username = $info['username'];
  16. $password = $info['password'];
  17. $fname = htmlspecialchars($info['fname']);
  18. $lname = htmlspecialchars($info['lname']);
  19. $email = htmlspecialchars($info['email']);
  20. $displayname = htmlspecialchars($info['displayname']);
  21. $bio = htmlspecialchars($info['bio']);
  22. $avatar = $info['avatar'];
  23. $mailopt = $info['mailopt']; //0 == checked
  24.  
  25.  
  26. //Create site settings variables
  27. $sitequery = 'select * from settings;';
  28. $siteresult = mysql_query($sitequery,$connection) or die(mysql_error());
  29. $siteinfo = mysql_fetch_array($siteresult);
  30. $sitetitle = $siteinfo['title'];
  31. $siteurl = $siteinfo['url'];
  32. $logo = $siteinfo['logourl'];
  33. $statcode = $siteinfo['statcode'];
  34. $template = $siteinfo['template'];
  35.  
  36. if (is_file('seourls.php')) {
  37. include ('seourls.php');
  38. $seourls = 1;
  39. } else {
  40. $seourls = 0;
  41. }
  42.  
  43. // Needed to control file paths of the templates
  44. $sidebardir = "";
  45.  
  46.  
  47. // Setup this page's template information
  48. $header = new Template("templates/".$template."/header.tpl");
  49. $header->set("sitetitle", $sitetitle );
  50. $header->set("siteurl", $siteurl);
  51. $header->set("logo", $logo);
  52. $header->set("metatitle", $metatitle);
  53. $header->set("pgDesc", $pgDesc);
  54. $header->set("pgHeading", $pgHeading);
  55. $header->set("pgKeywords", $pgKeywords);
  56. $header->set("thistemp", $template);
  57.  
  58. // Create the logo
  59. if ($logo) {
  60. $header->set("sitelogo", '<a href="'.$siteurl.'"> <img border="0" alt="'.$sitetitle.'" src="'.$siteurl.'/admin/images/logo/'.$logo.'" /></a>');
  61. } else {
  62. $header->set("sitelogo", '<a href="'.$siteurl.'"><h1 style=\"padding-left: 10px;\">'.$sitetitle.'</h1></a>');
  63. }
  64.  
  65.  
  66. // Checks if user is logged in. If so, display custom header
  67.  
  68. session_start();
  69. if (isset($_SESSION['valid_user'])) {
  70. $header->set("loginarea", 'Welcome, '.$fname.'
  71. (<a href="'.$siteurl.'/author/logout.php">Logout</a>)');
  72. } else {
  73. $header->set("loginarea", '<a href="'.$siteurl.'/login.php">Login</a>
  74. | <a href="'.$siteurl.'/login.php">Submit Articles</a>
  75. | <a href="'.$siteurl.'/login.php">Register</a>');
  76. }
  77.  
  78.  
  79. // Populates the Top Menu list with all pages
  80. $query = "select * from pages where onmenu=0;";
  81. $result = mysql_query($query,$connection) or die(mysql_error());
  82. $num_results = mysql_num_rows($result);
  83.  
  84. if ($num_results == 0) {
  85. $header->set("topmenuitems", "");
  86. } else {
  87. for ($i=0; $i <$num_results; $i++) {
  88. $row = mysql_fetch_assoc($result);
  89. if ($seourls == 1) { $scrubtitle = generate_seo_link($row['title']); }
  90.  
  91. if ($seourls == 1) { // With SEO URLS
  92. $headlist = "<li><a href=\"".$siteurl."/page/".$row['id']
  93. ."/".$scrubtitle."/\">".$row['title']."</a></li>";
  94. $headoutput .= $headlist;
  95. } else {
  96. $headlist = "<li><a href=\"".$siteurl."/page.php?p=".$row['id']."\">".$row['title']."</a></li>";
  97. $headoutput .= $headlist;
  98. }
  99. $header->set("topmenuitems", $headoutput);
  100. }
  101. }
  102.  
  103.  
  104. // Checks if we need to create the category header
  105.  
  106. if($cathead == 1) {
  107.  
  108. $catheader = new Template("templates/".$template."/cathead.tpl");
  109. $catheader->set("catheadtitle", $catheadtitle);
  110.  
  111. $query = "select * from adboxes where id=2;";
  112. $result = mysql_query($query,$connection) or die(mysql_error());
  113. $info = mysql_fetch_assoc($result);
  114.  
  115. $catheader->set("468adcode", stripslashes($info['adcode']));
  116. $header->set("catheader", $catheader->output());
  117.  
  118. } else {
  119. $header->set("catheader", "");
  120. }
  121.  
  122. // Outputs the page template!
  123.  
  124. echo $header->output();
  125.  
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement