Simple Header made for those who are just getting started with a game and want to change from the mcc Default layout (Simple & Free)
Header.php
Stylesheet (CSS)
images all need to go in an image folder
W3C Validated
Ive also used a sprite might wanna have a look at it you can do great things having sprites when using loads of images
Tested in Browsers Opera - IE7 - IE8 - IE9 -Firefox
<?php
header('X-UA-Compatible: IE=EmulateIE8');
ob_start ("ob_gzhandler");
header("Cache-Control: must-revalidate");
$count = 3;
$x = -1;
while($x < $count)
{
$security = array("ID","viewforum","viewtopic");
$x++;
$_GET[$security[$x]] = abs(@intval($_GET[$security[$x]]));
}
class headers {
function startheaders() {
global $ir, $set;
echo <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{$set['game_name']}</title>
<meta http-equiv="content-language" content="en"/>
<meta name="Distribution" content="Global"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<link rel="stylesheet" type="text/css" href="custom.css" />
</head>
<body>
<center>
<table width="970" border="0" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td class="lgrad"></td>
<td class="center">
<style type="text/css">
img { border: none; }
</style>
EOF;
}
function userdata($ir,$lv,$fm,$cm,$dosessh=1)
{
global $db,$c,$userid, $set;
$IP = $_SERVER['REMOTE_ADDR'];
$IP = mysql_real_escape_string($IP);
$IP = $db->escape($IP);
$db->query("UPDATE users
SET laston=unix_timestamp(),
lastip='$IP' WHERE userid=$userid");
if(!$ir['email'])
{
global $domain;
die (" <body>
Your account may be broken.
Please mail support@{$domain}
stating your username and player ID.");
}
if($dosessh && ($_SESSION['attacking'] || $ir['attacking']))
{
print "
You lost all your EXP for running from the fight.";
$db->query("UPDATE users
SET exp=0,
attacking=0
WHERE userid=$userid");
$_SESSION['attacking']=0;
}
$enperc=(int) ($ir['energy']/$ir['maxenergy']*100);
$wiperc=(int) ($ir['will']/$ir['maxwill']*100);
$experc=(int) ( $ir['exp']/$ir['exp_needed']*100);
$brperc=(int) ($ir['brave']/$ir['maxbrave']*100);
$hpperc=(int) ($ir['hp']/$ir['maxhp']*100);
$enopp=100-$enperc;
$wiopp=100-$wiperc;
$exopp=100-$experc;
$bropp=100-$brperc;
$hpopp=100-$hpperc;
$d="";
$u=$ir['username'];
if($ir['donatordays']) { $u = "
<font color=red>{$ir['username']}</font>
";$d="[img=donator.gif]";
}
$gn="";
global $staffpage;
$bgcolor = '999999';
//Display Pic
$display_pic = $ir['display_pic'];
if(!$display_pic) {
$display_pic="/images/noav.png";
}
print <<<OUT
<div id="hd">
<div class="hd_displaypic">[img=$display_pic]</div>
<div class="hd_username">
[b]Name:[/b]
[url="viewuser.php?u={$ir['userid']}"] $gn{$u} [{$ir['userid']}] $d[/url]
</div></div>
<ul id="menu">
[*][url="index.php"]Home[/url]
[*][url="inventory.php"]Inventory[/url]
[*][url="explore.php"]City[/url]
[*][url="viewuser.php?u={$ir['userid']}"]Profile[/url]
[*][url="bank.php"]Bank[/url]
[*][url="gym.php"]Gym[/url]
[*][url="bank.php"]Test[/url]
[*][url="gym.php"]Test[/url]
[*][url="logout.php"]Logout[/url]
[/list]
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" bgcolor="#$bgcolor" valign="top" align="left" style="padding-left:10px;">
<span class='icons1' style='padding-left:24px;'></span>[b]Money:[/b] {$fm}
<span class='icons2' style='padding-left:24px;'></span>[b]Level:[/b] {$ir['level']}
<span class='icons3' style='padding-left:24px;'></span>[b]Crystals:[/b] {$ir['crystals']}
<hr />
<div class="stat_bars">
<div>[b]Energy:[/b]</div>
<a href="#" class="Tooltip"><span>Current Energy:{$enperc}%</span>
<img src=images/bar.png width=$enperc height=10><img src=redbar.png width=$enopp height=10></a>
</div>
<div class="stat_bars">
<div>[b]Will:[/b]</div>
[url="#"]<span>Current Will: {$wiperc}%</span><img src=images/bar.png width=$wiperc height=10><img src=redbar.png width=$wiopp height=10>[/url]
</div>
<div class="stat_bars">
<div>[b]Brave:[/b]</div>
[url="#"]<span>Current Brave: {$ir['brave']}/{$ir['maxbrave']}</span><img src=images/bar.png width=$brperc height=10><img src=redbar.png width=$bropp height=10>[/url]
</div>
<div class="stat_bars">
<div>[b]EXP:[/b]</div>
[url="#"]<span>Current EXP: {$experc}%</span><img src=images/bar.png width=$experc height=10><img src=redbar.png width=$exopp height=10>[/url]
</div>
<div class="stat_bars">
<div>[b]Health:[/b]</div>
[url="#"]<span>Current Health: {$hpperc}%</span><img src=images/bar.png width=$hpperc height=10><img src=redbar.png width=$hpopp height=10>[/url]
</div>
<hr />
OUT;
if($ir['fedjail'])
{
$q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid");
$r=$db->fetch_row($q);
die("
[b] <font color=red size=+1>
You have been put in the {$set['game_name']} Federal Jail for {$r['fed_days']} day(s).
Reason: {$r['fed_reason']}</font>[/b]</body></html>");
}
if(file_exists('ipbans/'.$IP))
{
die(" [b]<font color=red size=+1>Your IP has been banned from {$set['game_name']},
there is no way around this.</font>[/b]</body></html>");
}
}
function menuarea()
{
include "mainmenu.php";
global $ir,$c;
$bgcolor = '999999';
print '
</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"></td>
<td width="80%" bgcolor="#'.$bgcolor.'" valign="top">
<center>';
if($ir['hospital'])
{
print "[b]NB:[/b] You are currently in hospital for {$ir['hospital']} minutes.
";
}
if($ir['jail'])
{
print "[b]NB:[/b] You are currently in jail for {$ir['jail']} minutes.
";
}
print "[url='donator.php'][b]Donate to {$set['game_name']} now for game benefits![/b][/url]
";
}
function smenuarea()
{
include "smenu.php";
global $ir,$c;
$bgcolor = 'FFFFFF';
print '
</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"></td>
<td width="80%" bgcolor="#'.$bgcolor.'" valign="top"><center>';
}
function endpage()
{
global $db;
//Shows useronline & Total Users
$q=$db->query(" SELECT userid FROM users
WHERE laston>unix_timestamp()-100*60
ORDER BY laston DESC");
$r1=$db->num_rows($q);
$q=$db->query("SELECT userid FROM users");
$r2=$db->num_rows($q);
print <<<OUT
</center>
</td></tr></table>
</td><td class="rgrad"></td>
</tr><tr><td colspan="3">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="dgradl"></td>
<td class="dgrad" align="center">Total Users [url="userlist.php"]$r2[/url] | Users Online [url="usersonline.php"]$r1[/url] </td>
<td class="dgradr"></td>
</tr></table>
</td></tr></table>
</body>
</html>
OUT;
}
}
?>
body {
background-color : #333333;
margin-top : 0;
margin-bottom : 0;
font-family : calibri, helvetica, arial, geneva, sans-serif;
font-size : 12px;
color : black;
}
#hd {
background : url('images/header.png') no-repeat scroll 0% 0%;
height : 200px;
width : 932px;
}
.hd_displaypic {
position : absolute;
top : 16px;
left : 213px;
}
.hd_username {
position : absolute;
top : 160px;
left : 210px;
font-variant : small-caps;
}
a img {
border : none;
}
a:visited {
text-decoration : none;
color : black;
}
a:active, a:link {
color : black;
text-decoration : none;
text-indent : 20px;
}
a:hover {
text-decoration : underline;
color : red;
}
table, tr, td {
font-family : helvetica, arial, geneva, sans-serif;
font-size : 12px;
}
img {
border : none;
}
textarea {
font-family : helvetica, arial, geneva, sans-serif;
font-size : 12px;
color : black;
}
.lgrad {
background-image : url(images/lgrad.png);
background-repeat : repeat-y;
width : 19px;
}
.linegrad {
background-image : url(images/lgrad.png);
background-repeat : repeat-y;
width : 2px;
}
.rgrad {
background-image : url(images/rgrad.png);
background-repeat : repeat-y;
width : 19px;
}
.dgrad {
background-image : url(images/dgrad.png);
background-repeat : repeat-x;
height : 38px;
}
.dgradl {
background-image : url(images/dgradl.png);
background-repeat : no-repeat;
height : 38px;
width : 38px;
}
.dgradr {
background-image : url(images/dgradr.png);
background-repeat : no-repeat;
height : 38px;
width : 38px;
}
.center {
width : 932px;
background-color : #ffffff;
}
.table {
background-color : #000000;
}
.table3 {
background-color : #000000;
}
.table td {
background-color : #dedede;
height : 22px;
}
.table3 td {
background-color : #cccccc;
}
td .alt {
background-color : #eeeeee;
height : 22px;
}
td .h {
background-image : url(tablehgrad.png);
background-repeat : repeat-x;
font-weight : bold;
background-color : #d6d6d6;
}
.table th {
background-image : url(tablehgrad.png);
background-repeat : repeat-x;
font-weight : bold;
background-color : #d6d6d6;
}
ul#menu {
margin : 0;
padding : 0;
list-style-type : none;
width : auto;
position : relative;
display : block;
height : 36px;
font-size : 12px;
font-weight : bold;
text-transform : lowercase;
background : transparent url("images/bg.jpg") repeat-x left top;
font-family : "Trebuchet MS", Helvetica, Arial, Verdana, sans-serif;
border-bottom : 1px solid #000000;
border-top : 1px solid #000000;
font-variant : small-caps;
}
ul#menu li {
display : block;
float : left;
margin : 0;
}
ul#menu li a {
display : block;
float : left;
color : #999999;
text-decoration : none;
font-weight : bold;
padding : 12px 20px 0 20px;
height : 24px;
}
ul#menu li a:hover {
color : #ffffff;
background : transparent url("images/over.jpg") no-repeat right top;
}
.stat_bars {
color : #000;
margin : 0px auto;
font-family : Verdana;
font-size : 11px;
font-weight : normal;
height : 25px;
border:0;
border:none;
}
.icons1 {
background : url(images/icons.png) no-repeat scroll -1px 2px;
height : 16px;
width : 16px;
margin : 0 0 0 auto;
}
.icons2 {
background : url(images/icons.png) no-repeat scroll -1px -14px;
height : 16px;
width : 16px;
margin : 0 0 0 auto;
}
.icons3 {
background : url(images/icons.png) no-repeat scroll -1px -30px;
height : 16px;
width : 16px;
margin : 0 0 0 auto;
}
a.Tooltip {
position : relative;
z-index : 24;
background-color : #555555;
color : #000;
text-decoration : none;
}
a.Tooltip:hover {
z-index : 25;
}
a.Tooltip span {
display : none;
}
a.Tooltip:hover span {
display : block;
position : absolute;
top : 2em;
left : 2em;
width : 14em;
border : 1px solid #333333;
background-color : #555555;
color : #000;
text-align : center;
}
If you need anything changed or added let me know
Thanks
http://img411.imageshack.us/img411/2251/headerpe.png
http://www.2shared.com/photo/CqspSUgR/new_header.html <<--- PSD