furn355 Posted July 16, 2009 Posted July 16, 2009 Okay so i attempted to make a css mod for myself. I used snippets from other code and overall things went quite well i feel, however i have two problems which i would like some help with if possible Problemo a) There are 2 different views.... When logged in as a staff member.. there is my header the main menu on the left and the game content centered... When logged in as a normal user... there is the header at the top, main menu on the left and the main game content is all squeezed under the 15% i have allowed for my menu on the left and there is a big blank space where the main game content would have been on the right Problem b) is similar to the above but when logged in as a staff as soon as i access the staff panel the last ten staff actions is squeezed under the 15% i have alllowed for the menu and the area on the right where the last ten staff actions should be displayed is all blank Pictures to demonstrate what i mean Admin view User View Admin Panel View Please refrain from posting until its up Quote
furn355 Posted July 16, 2009 Author Posted July 16, 2009 Re: Attempted css mod. <?php class headers { function startheaders() { global $ir, $set; echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head> <body> <div class="PageBackgroundGradient"></div> <div class="Main"> <div class="Sheet"> <div class="Sheet-body"> <div class="nav"> <ul class="menu"> <center>[*][url="index.php"]<span><span>Home</span></span>[/url] [*][url="explore.php"]<span><span>Explore</span></span>[/url] [*][url="donate.php"]<span><span>Donate To {$set['game_name']}</span></span>[/url] [*][url="voting.php"]<span><span>Vote For {$set['game_name']}</span></span>[/url] [*][url="logout.php"]<span><span>Logout</span></span>[/url] </center> [/list] <div class="l"></div> <div class="r"><div></div></div> </div> </div> EOF; } function userdata($ir,$lv,$fm,$cm,$dosessh=1) { global $db,$c,$userid, $set; $IP = $_SERVER['REMOTE_ADDR']; $IP=addslashes($IP); $IP=mysql_real_escape_string($IP); $IP=strip_tags($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 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); $exp=(int)($ir['exp']/$ir['exp_needed']*100); $count = 3; $x = -1; while($x < $count) { $places_to_be_secured = array("ID","viewforum","viewtopic"); $x++; $_GET[$places_to_be_secured[$x]] = abs(@intval($_GET[$places_to_be_secured[$x]])); } $enopp=100-$enperc; $wiopp=100-$wiperc; $exopp=100-$experc; $bropp=100-$brperc; $hpopp=100-$hpperc; $d=""; $ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ']; $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); $tsrank=get_rank($ts,'strength+agility+guard'); $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); $ir['labour']=number_format($ir['labour']); $ir['IQ']=number_format($ir['IQ']); $ts=number_format($ts); $u=$ir['username']; if($ir['donatordays']) { $u = "<font color=yellow>[b]{$ir['username']}[/b]</font>";$d="[img=donator.gif]"; } $gn=""; $ec=$ir['new_events']; $mc=$ir['new_mail']; $city = mysql_fetch_object(mysql_query("SELECT cityname FROM cities WHERE cityid = ".$ir['location']." ")); global $staffpage; print <<<OUT <center><table width='100%' bgcolor='#000000' cellspacing='1' border='1'>   dont need too see as it works :) </table> <table width="100%" background="gradient.gif" > <tr height=21><td width="20%"> </td><td width ="60%"><center>[url='index.php'] Home[/url] | [url='criminal.php']Crime[/url] | [url='search.php']Search [/url] | [url='inventory.php']Manage Inventory[/url] | [url='explore.php']$city->cityname[/url] | [url='donator.php']Donate to Deadland today![/url] </center></td><td width="20%"> </td> </tr> </table> <div class="contentLayout"> <div class="sidebar1"> <div class="Block"> <div class="Block-body"> <div class="BlockHeader"> Navigation <div class="l"></div> <div class="r"><div></div></div> </div> <div class="BlockContent"> <div class="BlockContent-body"> <ul> 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 = 'FFFFFF'; print '</td><td width="20%" class="linegrad" bgcolor="#'.$bgcolor.'"> </td>'; print <<<OUT [/list] </div> <div class="BlockContent-tl"></div> <div class="BlockContent-tr"><div></div></div> <div class="BlockContent-bl"><div></div></div> <div class="BlockContent-br"><div></div></div> <div class="BlockContent-tc"><div></div></div> <div class="BlockContent-bc"><div></div></div> <div class="BlockContent-cl"><div></div></div> <div class="BlockContent-cr"><div></div></div> <div class="BlockContent-cc"></div> </div> </div> </div> </div> <div class="contentLayout"> <div class="sidebar1"> <div class="Block"> <div class="Block-body"> <div class="BlockHeader"> Navigation <div class="l"></div> <div class="r"><div></div></div> </div> <div class="BlockContent"> <div class="BlockContent-body"> <td width="80%" bgcolor="#'.$bgcolor.'" valign="top"> <center> OUT; 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. "; } } function smenuarea() { include "smenu.php"; global $ir,$c; $bgcolor = 'FFFFFF'; print '</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"> </td>'; } function endpage() { global $db,$c; print <<<OUT </p> <div class="entry"> <div style="align:right;"></div> </div> </div> </div> <div class="BlockContent-tl"></div> <div class="BlockContent-tr"><div></div></div> <div class="BlockContent-bl"><div></div></div> <div class="BlockContent-br"><div></div></div> <div class="BlockContent-tc"><div></div></div> <div class="BlockContent-bc"><div></div></div> <div class="BlockContent-cl"><div></div></div> <div class="BlockContent-cr"><div></div></div> <div class="BlockContent-cc"></div> </div> </div> </div> </div> </div> </div> </body> </html> OUT; } } ?> Quote
CrazyT Posted July 16, 2009 Posted July 16, 2009 Re: Attempted css mod. $IP = $_SERVER['REMOTE_ADDR']; $IP=addslashes($IP); $IP=mysql_real_escape_string($IP); $IP=strip_tags($IP); What the hell ?lol Quote
furn355 Posted July 16, 2009 Author Posted July 16, 2009 Re: Attempted css mod. Lol dont worry about that for the minute, the game is on a closed server, finishing things like that is what im doing at the end, so any ideas what the hell is up with my css? I cant see it :-( Quote
Karlos Posted July 16, 2009 Posted July 16, 2009 Re: Attempted css mod. Lol dont worry about that for the minute, the game is on a closed server [...] You should always care about security no matter what! :x The best way I have seen to get an IP: [FAQ] How Do I Retieve The Remote IP Of A User <?php // // <string> remote_ip( ) // // Returns the IP address(s) of the remote user // function remote_ip( ) { $keys = array ( "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED", "HTTP_FORWARDED_FOR", "HTTP_FORWARDED", "REMOTE_ADDR", ); $list = array ( true => array(), false => array(), ); foreach ($keys as $key) if (isset($_SERVER[$key]) && is_string($_SERVER[$key])) foreach (explode(",", $_SERVER[$key]) as $ip) if (is_ipv4($ip = trim($ip))) $list[is_local_ipv4($ip)][] = $ip; list($local, $remote) = array_values($list); usort($remote, "ipcmp"); usort($local, "ipcmp"); return implode(",", array_merge($remote, $local)); } // // <boolean> is_ipv4( <string> $ip ) // // Returns TRUE if the passed string is an IPv4 address // function is_ipv4( $ip ) { if (!preg_match("`^\d+(\.\d+){3}$`ims", $ip)) return false; foreach (explode(".", $ip) as $part) if ($part > 255) return false; return true; } // // <boolean> is_local_ipv4( <string> $ip ) // // Returns TRUE if the passed IPv4 address is local (see RFC 1918) // function is_local_ipv4( $ip ) { $table = array ( 167772160 => 4278190080, // (127/8) 2130706432 => 4278190080, // (10/8) 2886729728 => 4293918720, // (172.16/12) 3232235520 => 4294901760, // (196.168/16) ); $net = iptolong($ip); foreach ($table as $addr => $mask) if (($net & $mask) == $addr) return true; return false; } // // <integer> iptolong( <string> $ip ) // // Replacement for the standard ip2long( ) function // function iptolong( $ip ) { $parts = explode(".", $ip); return $parts[0] > 127 ? ((ip2long($ip) & 0x7FFFFFFF) + 0x80000000) : ip2long($ip); } // // <integer> ipcmp( <string> $a, <string> $b ) // // Like strcmp(), but for IP addresses // function ipcmp( $a, $b ) { return iptolong($a) - iptolong($b); } ?> Quote
furn355 Posted July 16, 2009 Author Posted July 16, 2009 Re: Attempted css mod. Security comes last whilst its on a closed server with only me having access to it. i want to get everything running, i will then do my best to secure it, including the aboves Ask a couple of people to have a look around see if they can find any exploits and if they do, get back to the drawing board. And thanks for that link it has been bookmarked, Quote
furn355 Posted July 16, 2009 Author Posted July 16, 2009 Re: Attempted css mod. This thread was more for the css than the security im a bit better of with that than i am with css Quote
furn355 Posted July 17, 2009 Author Posted July 17, 2009 Re: Attempted css mod. Okay i got the two user bits all sorted hopefully. Just need help with the admin panel now :mrgreen: Quote
Karlos Posted July 19, 2009 Posted July 19, 2009 Re: Attempted css mod. Security comes last whilst its on a closed server with only me having access to it. Should always be done, no matter the conditions. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.