Skip to content

Instantly share code, notes, and snippets.

@InspectorGadget
Last active May 25, 2020 14:09
Show Gist options
  • Save InspectorGadget/0a75bdcda72e263ad1c89db8ea9909bd to your computer and use it in GitHub Desktop.
Save InspectorGadget/0a75bdcda72e263ad1c89db8ea9909bd to your computer and use it in GitHub Desktop.
<?PHP
// Include core files
include "Core/connect.php";
include "Core/functions.php";
// Connect
connect($server, $user, $password, $database);
// Get the options from the kbx_options table
$GetOpts = mysql_query("SELECT * FROM kbx_options");
$SiteName = mysql_result($GetOpts, 0, "SiteName");
$SiteURL = mysql_result($GetOpts, 0, "SiteURL");
$DefaultCat = mysql_result($GetOpts, 0, "DefaultCat");
$DefaultTheme = mysql_result($GetOpts, 0, "DefaultTheme");
$Announcement = mysql_result($GetOpts, 0, "Announcement");
$GuestMSG = mysql_result($GetOpts, 0, "GuestMSG");
$AdSection1 = mysql_result($GetOpts, 0, "AdSection1");
$AdSection2 = mysql_result($GetOpts, 0, "AdSection2");
$AdSection3 = mysql_result($GetOpts, 0, "AdSection3");
$AdSection4 = mysql_result($GetOpts, 0, "AdSection4");
// Get the links from the databse
$GetLinks = mysql_query("SELECT * FROM kbx_links");
$num = mysql_num_rows($GetLinks);
$Links = "";
for($i = 0; $i &lt; $num; $i++)
{
$LinkTitle = mysql_result($GetLinks, $i, "Title");
$LinkURL = mysql_result($GetLinks, $i, "URL");
$Links .= '&lt;a href="' . $LinkURL . '"&gt;' . $LinkTitle . '&lt;/a&gt;&lt;br /&gt;';
}
// Get the categories from the database
$GetCats = mysql_query("SELECT * FROM kbx_cats WHERE Type = 'news'");
$num = mysql_num_rows($GetCats);
$Cats = "";
for($i = 0; $i &lt; $num; $i++)
{
$CatID = mysql_result($GetCats, $i, "ID");
$CatName = mysql_result($GetCats, $i, "Name");
$Cats .= '&lt;a href="index.php?cat=' . $CatID . '"&gt;' . $CatName . '&lt;/a&gt;&lt;br /&gt;';
}
// Get the menu from the databse
$GetMenu = mysql_query("SELECT * FROM kbx_menu");
$num = mysql_num_rows($GetMenu);
$Menu = "";
for($i = 0; $i &lt; $num; $i++)
{
$MenuTitle = mysql_result($GetMenu, $i, "Title");
$MenuLinks = mysql_result($GetMenu, $i, "Links");
$MenuLinks = str_replace('{MENULINKS}', $Links, $MenuLinks);
$MenuLinks = str_replace('{MENUCATS}', $Cats, $MenuLinks);
$Menu .= '&lt;div class="menutitle"&gt;' . $MenuTitle . '&lt;/div&gt;';
$Menu .= '&lt;div class="menu"&gt;' . $MenuLinks . '&lt;/div&gt;';
}
// Handel Logout
if(isset($_GET['act']) &amp;&amp; $_GET['act'] == "Logout")
header("Location:Core/LoginAuth.php?act=Logout");
// Get user information
if(isLoggedIn())
{
$uID = $_COOKIE['member_id'];
$GetUserInfo = mysql_query("SELECT * FROM kbx_members WHERE id = $uID");
$uName = mysql_result($GetUserInfo, 0, 'Name');
$uEmail = mysql_result($GetUserInfo, 0, 'Email');
$uMSN = mysql_result($GetUserInfo, 0, 'MSN');
$uYahoo = mysql_result($GetUserInfo, 0, 'Yahoo');
$uAIM = mysql_result($GetUserInfo, 0, 'AIM');
$uOtherIM = mysql_result($GetUserInfo, 0, 'OtherIM');
$uJoined = mysql_result($GetUserInfo, 0, 'Joined');
$uHomePage = mysql_result($GetUserInfo, 0, 'HomePage');
$uLevel = mysql_result($GetUserInfo, 0, 'Level');
if($uHomePage != 0 || $uHomePage != NULL)
$DefaultCat = $uHomePage;
// Prepare user level
$getlev = mysql_query("SELECT * FROM kbx_levels WHERE ID = $uLevel");
$userLevel = mysql_result($getlev, 0, "Title");
$uViewSite = mysql_result($getlev, 0, "ViewSite");
$uComment = mysql_result($getlev, 0, "Comment");
$uAddNews = mysql_result($getlev, 0, "AddNews");
$uEditNews = mysql_result($getlev, 0, "EditNews");
$uEditOwnProfile = mysql_result($getlev, 0, "EditOwnProfile");
$uEditOtherProfile = mysql_result($getlev, 0, "EditOtherProfile");
}
// Prepare guest message
if(!isLoggedIn())
{
if($GuestMSG != "")
{
$WelcomeGuest = '&lt;div id="GuestMSG"&gt;' . $GuestMSG . '&lt;/div&gt;' . "\n";
}
else
$WelcomeGuest = '';
}
else
$WelcomeGuest = '';
// Prepare announcement
if($Announcement != "")
{
if(isAdm())
$AnnouncementAdm = '&lt;div class="fright"&gt;[&lt;a href="admin.php?mod=opts">Edit</a>;/div&gt;';
else
$AnnouncementAdm = '';
$Announcement = '&lt;div class="alert"&gt;' . $AnnouncementAdm . $Announcement . '&lt;/div&gt;' . "\n";
}
else
$Announcement = '';
// Prepare userbar
if(isLoggedIn())
{
if(isMod())
$UserBarLinks = '&lt;a href="cp/"&gt;Control Panel&lt;/a&gt; · ';
else
$UserBarLinks = '';
$UserBar = '&lt;div class="fright"&gt;' . $UserBarLinks . '&lt;a href="index.php?act=Logout">Logout</a></div>Welcome;a href="profile.php">$uName . '&lt;/a&gt;';
}
else
$UserBar = 'Welcome: Guest (&lt;a href="login.php">Login</a>lt;a href="register.php">Register</a>
include "Themes/$DefaultTheme/header.php";
?&gt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment