Jump to content
MakeWebGames

Dodgy header problem


josh-j-c

Recommended Posts

Hey, i have recently started on editing a header template i have found it is completely compatible with my version on McCodes, but the trouble starts when i attempt to attack somone.. All the alignment is out of place, i have no idea on how to fix this... Also when i placed a user within federal jail and i logged on his account it gave me no reason nore how many days i was in for. The code is shown bellow,

 

<?php

class headers {
function startheaders() {
global $ir, $set;
$back="#333333"; //Define the background colour of your site here.
echo <<<EOF
<html>
<head>
<title>{$set['game_name']}</title>
<style>
body {
background: $back;
font-family: Arial, Helvetica, sans-serif;
}
table {
font-family: Tahoma;
font-size: 12px;
}
.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;
}
a:link {
text-decoration: none;
color: #333333;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
color: #666666;
}
a:visited {
text-decoration: none;
color: #333333;
}
doodlebee


#:1177461 	
</style>
</head><body>
<center><table width=900 border=0 cellpadding=0 cellspacing=0><tr><td>
<image src='topheaderimage.png'></td></tr>
<td background='middleheaderimage.png'>

<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr valign="top"><td width=23><center></td><td width=183><center>
EOF;
}
function userdata($ir,$lv,$fm,$cm,$dosessh=1)
{
global $db,$c,$userid, $set;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$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 help@{$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=green>[i]{$ir['username']}</font>[/i]";$d="[img=donator.gif]"; }

$gn=""; 
global $staffpage;

$bgcolor = 'FFFFFF';

print <<<OUT

<center>
[b]Name:[/b] $gn{$u} [{$ir['userid']}] $d

[b]Money:[/b] {$fm}

[b]Level:[/b] {$ir['level']}

[b]Points:[/b] {$ir['crystals']}


[[url='logout.php']Emergency Logout[/url]]
<hr />
[b]Energy:[/b] {$enperc}%

<img src=greenbar.png width=$enperc height=10><img src=redbar.png width=$enopp height=10>

[b]Will:[/b] {$wiperc}%

<img src=greenbar.png width=$wiperc height=10><img src=redbar.png width=$wiopp height=10>

[b]Brave:[/b] {$ir['brave']}/{$ir['maxbrave']}

<img src=greenbar.png width=$brperc height=10><img src=redbar.png width=$bropp height=10>
<hr />

OUT;
if($ir['fedjail'])
{
$q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid");
$r=$db->fetch_row($q);
die("</td><td width=25></td><td width=643><center><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 = 'FFFFFF';
print '</td><td width=25></td><td width=643><center>';
if($ir['donatordays'] == 1)
{
print"Thank you for donating (:

";
}
elseif($ir['donatordays'] == 0)
{
print"[url='donate.php']* Donate today and gain loads of extra's! *[/url]

";
}
if($ir['hospital'])
{
 print "You are currently in hospital for {$ir['hospital']} minutes.
";
}
if($ir['jail'])
{
 print "You are currently in jail for {$ir['jail']} minutes.
";
}
}
function smenuarea()
{
include "smenu.php";
global $ir,$c;
$bgcolor = 'FFFFFF';
print '</td><td width=25></td><td width=643><center>';
}
function endpage()
{
global $db;
print <<<OUT
</td><td width=27></td></tr>
</table>
</td></tr>
<tr><td><image src='bottomheaderimage.png'></td></tr></table>
OUT;
}
}
?>

 

Ive been told there is a problem with my tables but I'm useless at finding and fixing such things, because i work with dreamweaver :x "Which is Lame btw..."

Could anyone actually take me and my header code under there wing and help me by fixing my errors that i am receiving ?

Please private message me or post here, Thanks in advance to any help that i may (Hopefully) Get,

Jc

Link to comment
Share on other sites

Re: Dodgy header problem

Try this one... it is fairly readable to find where potential problems are...

 

<?php

class headers {
function startheaders() {
global $ir, $set;
$back="#333333"; //Define the background colour of your site here.
?>
<html>
<head>
<title><?=$set['game_name']?></title>
<style>
body {
background: $back;
font-family: Arial, Helvetica, sans-serif;
}
table {
font-family: Tahoma;
font-size: 12px;
}
.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;
}
a:link {
text-decoration: none;
color: #333333;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
color: #666666;
}
a:visited {
text-decoration: none;
color: #333333;
}
doodlebee
#:1177461    
</style>
</head>
<body>
<table align="center" width="900" border="0" cellpadding="0" cellspacing="0">
<tr>
   	<td>
	<image src="topheaderimage.png">
       </td>
   </tr>
   <td background="middleheaderimage.png">
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr valign="top">
   <td width="23"></td>
   <td width="183">
<?
}
function userdata($ir,$lv,$fm,$cm,$dosessh=1)
{
global $db,$c,$userid, $set;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$db->query("UPDATE users SET laston=unix_timestamp(),lastip='$IP' WHERE userid=$userid");
if(!$ir['email'])
	{
	global $domain;
	?>
	Your account may be broken. Please mail help@<?=$domain?> stating your username and player ID
       <?
	$h->endpage();
	exit;
}
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=green>[i]{$ir['username']}</font>[/i]";
	$d="[img=donator.gif]";
}
$gn="";
global $staffpage;
$bgcolor = 'FFFFFF';
?>
[b]Name:[/b] <?=$gn($u)?> [<?=$ir['userid']?>] <?=$d?>

[b]Money:[/b] <?=$fm?>

[b]Level:[/b] <?=$ir['level']?>

[b]Points:[/b] <?=$ir['crystals']?>


[[url="logout.php"]Emergency Logout[/url]]
<hr />
[b]Energy:[/b] <?=$enperc?>%

[img=greenbar.png] height="10">[img=redbar.png] height="10">

[b]Will:[/b] <?=$wiperc?>%

[img=greenbar.png]" height="10">[img=redbar.png] height="10">

[b]Brave:[/b] <?=$ir['brave']?>/<?=$ir['maxbrave']?>

[img=greenbar.png]" height="10">[img=redbar.png]" height="10">
<hr />
<?
if($ir['fedjail'])
	{
	$q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid");
	$r=$db->fetch_row($q);
	die("</td><td width=25></td><td width=643><center><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 = 'FFFFFF';
?>
   </td><td width="25"></td><td width="643">
   <?
   if($ir['donatordays'] == 1)
	{
	?>
	Thank you for donating (:


       <?
}
elseif($ir['donatordays'] == 0)
	{
	?>
       [url="donate.php"]* Donate today and gain loads of extra's! *[/url]


       <?
}
if($ir['hospital'])
	{
	?>
 		You are currently in hospital for <?=$ir['hospital']?> minutes.

       <?
}
if($ir['jail'])
	{
	?>
       You are currently in jail for <?=$ir['jail']?> minutes.

       <?
   }
}
function smenuarea()
{
include "smenu.php";
global $ir,$c;
$bgcolor = 'FFFFFF';
?>
   </td><td width="25"></td><td width="643">
   <?
}
function endpage()
{
global $db;
?>
</td><td width="27"></td></tr>
</table>
</td></tr>
<tr><td><image src="bottomheaderimage.png"></td></tr></table>
<?
}
}
?>

 

Also, all die() statements try to change them to $h->endpage(); exit; (lines 90 to 98 on this attempt).

This hasn't been tested as i don't use V2 but it's pretty much readable on dreamweaver ;)

Link to comment
Share on other sites

Re: Dodgy header problem

am no expert at coding but i gotta say....

hmm you say Dreamweaver is lame, but looking at that header coding it doesn't look like you used Dreamweaver. not even near.

learn from your mistakes, learn HTML & CSS before php

your HTML coding is very strange, you open a column but don't even put content into it, so the browser might not show that column, try using a simple

 

were you don't need any content. and add " or ' after width= ...don't just type a number, like this

<tr><td width="23"> </td></tr>

hopefully you might understand what i am talking about.

so three things,

 

[*]don't blame dreamweaver for things your not capable of

[*]learn HTML and css

[*]use these links to help you:

http://www.w3schools.com/html/default.asp

http://www.w3schools.com/css/default.asp

 

 

am no expert but those are mistakes. easily recognisable

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...