Jump to content

Huge Project - Big Mess - Css & Php Not Jiving?


pinecone
 Share

Recommended Posts

Hi Folks, :) I have a huge project that im undertaking. However it appears to me that CSS and PHP files are contradicting each other. i didnt develop this application however i have full rights and control over it. i scored 70% on W3Schools php quiz. so im no master at it but i do know enough to get by. the only thing is that im lost now. everything i do or try doesn't work. if only i knew where to look?The codes are actually too long to completely place here.this is my CSS file.BODY { background: #E0F3F3; color : Black; font-family : Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; text-align: left;}/* Default settings for table cells */TD { font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; color: SeaShell;}/* Settings for the bar at the top that contains Login/logout link */TD.top { line-height: 50px; background: url(images/OFfooter.jpg); font-weight: bold; font-family: Tahoma, Arial, Helvetica, sans-serif; color: SeaShell; font-size: 22px; padding-left: 16px; padding-right: 16px;}/* Header that contains site banner image */TD.header { border-top: 1px solid #c6c6c6; border-bottom: 1px solid #c6c6c6; border-left: 1px solid #c6c6c6; border-right: 1px solid #c6c6c6;}/* Headers in profile */.header2 { line-height: 26px; background: url(images/OFfooter.jpg); font-family: Tahoma, Arial, Helvetica, sans-serif; font-weight: bold; color: Seashell; padding-left: 10px; padding-right: 10px; border-bottom: 1px solid #cccccc;}/* Menu bar */TD.menu { line-height: 26px; background: white; padding-left: 10px;}/* Box below the menu (on Login, Register pages) */TD.rbody { padding-left: 20px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; border-top: 1px solid #c6c6c6; border-bottom: 1px solid #c6c6c6; border-left: 1px solid #c6c6c6; border-right: 1px solid #c6c6c6; height: 460px;}/* Table cells in Messages, Comments */TD.btopright { border-top: 1px solid #dcdcdc; border-right: 1px solid #dcdcdc; }/* Table cells in Messages, Comments */TD.btop { padding-left: 10px; padding-right: 10px; padding-bottom: 3px; border-top: 1px solid #dcdcdc;}/* Message background color 1 */TR.alt1, .alt1 { background-color: SeaShell;}/* Message background color 2 */TR.alt2, .alt2 { background-color: Linen;}/* Box that contains messages */.borders { border-collapse : collapse; border-top: 1px solid #dcdcdc; border-bottom: 1px solid #dcdcdc; border-left: 1px solid #dcdcdc; border-right: 1px solid #dcdcdc; }.borderbottom { border-bottom: 1px solid #dcdcdc;}.bordertop { border-top: 1px solid #dcdcdc;}.borders_thick { border-top: 4px solid #eaeaea; border-bottom: 4px solid #eaeaea; border-left: 4px solid #eaeaea; border-right: 4px solid #eaeaea;}.borders_thick_over { border-top: 4px solid #3333ff; border-bottom: 4px solid #3333ff; border-left: 4px solid #3333ff; border-right: 4px solid #3333ff;}.bordertop_thick { border-top: 4px solid #eaeaea;}/* Small text (ie. header text in messages) */.small { color: White; font-size: 11px; line-height: 20px;}/* Even smaller text */.smaller { color: White; font-size: 9px; line-height: 14px;}/* Display style for error messages */.error { color: Red;}/* Status messages */.status { color: Green;}/* Style for buttons */.buttonDef { font-family: Verdana, Tahoma; font-size: 11px; background-color: #eaeaea; color: Black; font-weight: bold; border: 1px dotted rgb(0,0,0); width: 120px; height: 20pt; cursor: pointer;}/* Style for buttons on mouseover */.buttonDef:Hover { color: SeaShell; border: 1px dotted #3333ff;}/* Style for back buttons */.buttonBack { font-family: Verdana, Tahoma; font-size: 11px; color: Black; border: 0px; padding-top: 1px; padding-bottom: 2px; cursor: pointer;}/* Style for back buttons on mouseover */.buttonBack:Hover { color: SeaShell;}/* Delete button */#delbutton { font-family: Verdana, Tahoma; font-size: 10px; background-color: #eaeaea; color: SeaShell; width: 64px; height: 20px; cursor: pointer;}/* Delete button on mouseover */#delbutton:Hover { color: #3333ff;}/* More button */.morebutton { font-family: Verdana, Tahoma; font-size: 10px; background-color: #eaeaea; color: SeaShell; width: 64px; height: 20px; cursor: pointer;}/* More button on mouseover */.morebutton:Hover { color: #3333ff;}/* Style for input boxes */.inputbox { font-family: Verdana, Tahoma; font-size: 12px; background-color: #ffffff; color: Black; font-weight: bold; border: 1px solid #b0c4de; width: 180px; height: 17pt; padding-top: 2px; padding-left: 1px;}/* Style for input boxes & textarea */.inputbox2 { font-family: Verdana, Tahoma; font-size: 12px; background-color: #ffffff; color: Black; font-weight: bold; border: 1px solid #b0c4de;}/* Style for descriptions of input boxes (Login, Register pages) */TD.desc { padding-left: 10px; color: Black;}/* Default style for links */A { font-family : Tahoma, Arial, Helvetica, sans-serif; font-weight: bold; text-decoration: none; color: Black;}/* Links on mouseover */A:Hover { color: #3333ff;}/* Style for read-only text */.rdonly { color: #3333ff;}/* Style for PRIVATE message text */.privmsg { font-weight: bold; color: Black; font-size: 24px; margin-top: 10px; margin-bottom: 20px;}/* Style for Gallery Video Code */#thecode { background-color: #dcdcdc; color: SeaShell; font-size: 11px; font-family: sans-serif;}.tool-tip { color: SeaShell; width: 139px; z-index: 13000;} .tool-title { font-weight: bold; font-size: 11px; margin: 0; color: Black; padding: 8px 8px 4px; background: url(bubble.png) top left;} .tool-text { color: #ffffff; font-size: 11px; padding: 4px 8px 8px; background: url(bubble.png) bottom right;}.sus-title { font-weight: bold; font-size: 11px; margin: 0; color: Black; padding: 8px 8px 4px; background: url(bubble_red.png) top left;}.sus-text { color: #ffffff; font-size: 11px; padding: 4px 8px 8px; background: url(bubble_red.png) bottom right;}#suspend_box { position: absolute; left: 100px; top: 90px; color: #ffffff; width: 200px; z-index: 14000;}This is my PHP index file.<?phpsession_start();require_once("dbconnect.php");require_once("vars.php");require_once("lang.php");$loggedin = 0;$loggedsuspend = 0;$do_update = 1;if ((isset($_SESSION['ses_info'])) && ($_SESSION['ses_info']['loggedin'] == "y") && (!isBanned($_SESSION['ses_info']['ID']))) { $loggedin = 1; $ip_ = getenv("REMOTE_ADDR"); if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $curfor = $_SERVER['HTTP_X_FORWARDED_FOR']; else $curfor = ''; if (strlen($curfor) > 6) $ip_ = $curfor; if (strlen($ip_) > 6) $ip_ = substr($ip_, 0, 20); if($ip_ == $_SESSION['ses_info']['ip']) { $loggeduser = $_SESSION['ses_info']['user']; $loggeduserid = $_SESSION['ses_info']['ID']; $loggedtime = $_SESSION['ses_info']['loggedtime']; $loggedsuspend = $_SESSION['ses_info']['suspend']; if ($loggedsuspend < 1) { if (isSuspended($loggeduserid)) $loggedsuspend = 1; } $curtime = time(); $timepast = $curtime - (3 * 60); // 3 minutes if ($loggedtime < $timepast) { $do_update = 0; mysql_query("DELETE FROM tonline WHERE id = $loggeduserid"); mysql_query("INSERT INTO tonline (id, time) VALUES ($loggeduserid, $curtime)"); } } else { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } $loggedin = 0; session_destroy(); }}function userLogOut() { global $loggeduserid; global $loggedin; $timepast = time() - (4 * 60); // 4 minutes mysql_query("DELETE FROM tonline WHERE time < $timepast OR id = $loggeduserid"); mysql_query("DELETE FROM tguests WHERE time < $timepast"); @mysql_query("DELETE FROM user WHERE member_id = $loggeduserid LIMIT 1"); mysql_query("DELETE FROM tprofile_allow WHERE allowed_id = $loggeduserid AND onlyonce = 1 AND viewed = 1"); $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } $loggedin = 0; session_destroy();}function getUsername($tmpid) { $tmpquery = mysql_query("SELECT login FROM tmembers WHERE id = $tmpid"); $tmpr = mysql_fetch_array($tmpquery); return $tmpr['login'];}function getLastIp($tmpid) { $tmpquery = mysql_query("SELECT lastip FROM tmembers WHERE id = $tmpid"); $tmpr = mysql_fetch_array($tmpquery); return $tmpr['lastip'];}function isAdmin($tmpid) { //if (($tmpid == 1) || ($tmpid == 3)) return 1; if ($tmpid == 1) return 1; return 0;}function isSuspended($pid) { global $ip_; if (strlen($ip_) > 10) $tmpq = mysql_query("(SELECT lastip FROM tmembers WHERE id = $pid AND suspend > 0) UNION (SELECT ip FROM tips_sus WHERE ip = '$ip_')"); else $tmpq = mysql_query("SELECT lastip FROM tmembers WHERE id = $pid AND suspend > 0"); if (mysql_num_rows($tmpq) > 0) return true; else return false;}function isBanned($pid) { global $ip_; if (strlen($ip_) > 10) $tmpq = mysql_query("(SELECT member_id FROM tbanned WHERE member_id = $pid) UNION (SELECT ip FROM tips_banned WHERE ip = '$ip_')"); else $tmpq = mysql_query("SELECT member_id FROM tbanned WHERE member_id = $pid"); if (mysql_num_rows($tmpq) > 0) return 1; else return 0;}function isChatBanned() { global $loggeduserid, $loggedsuspend; if (isAdmin($loggeduserid)) return false; if ($loggedsuspend) return true; $res = mysql_query("SELECT member_id FROM banned WHERE member_id = $loggeduserid LIMIT 1"); if (mysql_num_rows($res) > 0) return true; return false;}/*function flock_get_contents($filename){ $return = FALSE; if(is_string($filename) && !empty($filename)){ if(is_readable($filename)){ if($handle = @fopen($filename, 'r')){ while(!$return){ if(flock($handle, LOCK_SH)){ if($return = file_get_contents($filename)){ flock($handle, LOCK_UN); } } } fclose($handle); } } } return $return;}*/function make_links_blank($text) { return preg_replace( array( '/(?(?=<a[^>]*>.+<\/a>) (?:<a[^>]*>.+<\/a>) | ([^=\]?)((?:https?|ftp|bf2|):\/\/[^<> \n\r]+) )/iex', '/<a([^>]*)target="?[^"\']+"?/i', '/<a([^>]+)>/i', '/(^|\s)(www.[^<> \n\r,]+)/iex' ), array( "stripslashes((strlen('\\2')>0?'\\1<a href=\"\\2\">\\2</a>\\3':'\\0'))", '<a\\1', '<a\\1 target="_blank">', "stripslashes((strlen('\\2')>0?'\\1<a href=\"http://\\2\">\\2</a>\\3':'\\0'))" ), $text );}function ConvertBMP2GD($src, $dest = false) { if(!($src_f = fopen($src, "rb"))) { return false; } if(!($dest_f = fopen($dest, "wb"))) { return false; } $header = unpack("vtype/Vsize/v2reserved/Voffset", fread($src_f,14)); $info = unpack("Vsize/Vwidth/Vheight/vplanes/vbits/Vcompression/Vimagesize/Vxres/Vyres/Vncolor/Vimportant", fread($src_f, 40)); extract($info); extract($header); if($type != 0x4D42) { // signature "BM" return false; } $palette_size = $offset - 54; $ncolor = $palette_size / 4; $gd_header = ""; // true-color vs. palette $gd_header .= ($palette_size == 0) ? "\xFF\xFE" : "\xFF\xFF"; $gd_header .= pack("n2", $width, $height); $gd_header .= ($palette_size == 0) ? "\x01" : "\x00"; if($palette_size) { $gd_header .= pack("n", $ncolor); } // no transparency $gd_header .= "\xFF\xFF\xFF\xFF"; fwrite($dest_f, $gd_header); if($palette_size) { $palette = fread($src_f, $palette_size); $gd_palette = ""; $j = 0; while($j < $palette_size) { $b = $palette{$j++}; $g = $palette{$j++}; $r = $palette{$j++}; $a = $palette{$j++}; $gd_palette .= "$r$g$b$a"; } $gd_palette .= str_repeat("\x00\x00\x00\x00", 256 - $ncolor); fwrite($dest_f, $gd_palette); } $scan_line_size = (($bits * $width) + 7) >> 3; $scan_line_align = ($scan_line_size & 0x03) ? 4 - ($scan_line_size & 0x03) : 0; for($i = 0, $l = $height - 1; $i < $height; $i++, $l--) { // BMP stores scan lines starting from bottom fseek($src_f, $offset + (($scan_line_size + $scan_line_align) * $l)); $scan_line = fread($src_f, $scan_line_size); if($bits == 24) { $gd_scan_line = ""; $j = 0; while($j < $scan_line_size) { $b = $scan_line{$j++}; $g = $scan_line{$j++}; $r = $scan_line{$j++}; $gd_scan_line .= "\x00$r$g$b"; } } else if($bits == 8) { $gd_scan_line = $scan_line; } else if($bits == 4) { $gd_scan_line = ""; $j = 0; while($j < $scan_line_size) { $byte = ord($scan_line{$j++}); $p1 = chr($byte >> 4); $p2 = chr($byte & 0x0F); $gd_scan_line .= "$p1$p2"; } $gd_scan_line = substr($gd_scan_line, 0, $width); } else if($bits == 1) { $gd_scan_line = ""; $j = 0; while($j < $scan_line_size) { $byte = ord($scan_line{$j++}); $p1 = chr((int) (($byte & 0x80) != 0)); $p2 = chr((int) (($byte & 0x40) != 0)); $p3 = chr((int) (($byte & 0x20) != 0)); $p4 = chr((int) (($byte & 0x10) != 0)); $p5 = chr((int) (($byte & 0x08) != 0)); $p6 = chr((int) (($byte & 0x04) != 0)); $p7 = chr((int) (($byte & 0x02) != 0)); $p8 = chr((int) (($byte & 0x01) != 0)); $gd_scan_line .= "$p1$p2$p3$p4$p5$p6$p7$p8"; } $gd_scan_line = substr($gd_scan_line, 0, $width); } fwrite($dest_f, $gd_scan_line); } fclose($src_f); fclose($dest_f); return true;}function imagecreatefrombmp($filename) { $tmp_name = tempnam("/tmp", "GD"); if(ConvertBMP2GD($filename, $tmp_name)) { $img = imagecreatefromgd($tmp_name); unlink($tmp_name); return $img; } return false;}function validImgExt($imgstr) { global $valid_img_ext; if (strlen($imgstr) < 1) return true; $tmparr = explode('.', $imgstr); $tmpext = strtolower($tmparr[count($tmparr)-1]); if (in_array($tmpext, $valid_img_ext)) return true; else return false;}function delfile($str){ foreach(glob($str) as $fn) { @unlink($fn); }}if (isset($_POST['p_id'])) $_GET['id'] = $_POST['p_id'];if (isset($_POST['p_addphoto'])) $_GET['cmd'] = 'addphoto';elseif (isset($_POST['p_addcreation'])) $_GET['cmd'] = 'addcreation';elseif (isset($_POST['p_addsong'])) $_GET['cmd'] = 'addsong';elseif (isset($_POST['p_edit'])) $_GET['cmd'] = 'edit';elseif (isset($_POST['p_view'])) $_GET['cmd'] = 'view';elseif (isset($_POST['p_viewjournal'])) $_GET['cmd'] = 'viewjournal';if ($loggedin && (isset($_GET['cmd'])) && ($_GET['cmd'] == 'logout')) { $view_on = 0; $gallery_on = 0; $chat_on = 0; $reg_on = 0; userLogOut(); ?><!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" lang="en" xml:lang="en"><head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title><?php echo $site_title; ?></title> <meta NAME="Description" Content="Join Pinecone-crafts.com's FREE Christmas Arts & Craft Club. Share Christmas Craft ideas, chat with other members, seek out craft solutions to your projects, add videos, add photos and win awards."> <META NAME="MSSmartTagsPreventParsing" content="true"> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" type="text/css" href="style.css" /></head><body><table width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0"> <tr><td colspan="2"> <?php include "top.php"; ?>The index.php file is too big to place here:Youll notice on this page that you must scroll from left to right. no... i want it completely centered.the width is too large - i cannot even things out. basically all i want to change the look on the main page and profile page. thats it! but trying to locate to modify the correct file is darn right frustrating.Let me know as soon as you have a chance.Thankshttp://club.pinecone-crafts.com

Link to comment
Share on other sites

the problem seems to relate to your template site setting<table width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0">Assuming you wish to fit this on a 1024px screen resolution, the $site_width; is set to 1065px when it should be around 1000px (maybe a bit less) allowing for scrollbar.if it available? adjust the width to this smaller value, or you could set this value yourself by entering<?php $site_width = 1000; ?> just above <table width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0">Edit: The ad rotating image is around 982px so you might want to adjust the $site_width to this.

Edited by dsonesuk
Link to comment
Share on other sites

Jesus Christus, that's complicated! I'm sure I could make sense of it, but I'm so glad I don't have to.

Link to comment
Share on other sites

Thanks guys for taking a look and see.Okay i have a vars.php file that has the widthset at 1015 fixed, however i have tried changingthis several times but the only width change waswith the banner image. I tried reducing the imagefile size and the table width still remains. After ive reduced the image size the table still wouldn't changeto as low as i wanted to go. ive changed it to as low as 970pxbut then the image extended itself to fit. :mellow::(:Unsure: Here's my vars.php file.// site title$site_title = 'Pinecone-Crafts.com\'s Christmas Arts & Crafts Club';// domain$site_domain = 'www.Club.Pinecone-crafts.com';// site url, do not end with /$site_url = 'http://www.Club.Pinecone-crafts.com';// this should remain fixed$site_width = 1015;I cannot seem to change the index.php file either.the content meta tags were added manually by myselfand if you look at the source code - its not there!? :):) On the footer and the message board title banner i cannot find theassociating file to change the color, size or style of font. :) This is my header file:<?php $ext = array("jpg", "png", "jpeg", "gif"); $files = array(); if($handle = opendir('BANNERS')) { while(false !== ($file = readdir($handle))) for($i=0;$i<sizeof($ext);$i++) if(stristr($file, ".".$ext[$i])) //NOT case sensitive: OK with JpeG, JPG, ecc. $files[] = $file; closedir($handle); } $rndnum = rand(0, count($files)-1); echo '<tr><td class="header" colspan="2" style="height: 339px; background-image: url(BANNERS/' . $files[$rndnum] . ');">';?></td></tr>I can find heights no problem - but working with the widths aredriving me insane. :) What about javascript in da mix, will this have influence.mootools.v1.11.js Anywayz....Let me know as soon as you have a chance.Thanks

Link to comment
Share on other sites

there is a div further down which does not seem to do anything? just above whos online container, with a width of 1049 (used to be 1065), i don't know what is controlling it, to give advice. but you might wnat to investigate it.<div style="overflow: visible; width: 1049px;"><div style="float: left; left: 0px; top: 0px; margin-top: 5px; width: 485px;"><div style="border: 2px solid rgb(128, 128, 128); overflow: hidden; position: relative; left: 0px; top: 0px; width: 480px; margin-left: 5px;"><div id="online_users_toggle" class="header2" style="font-size: 13px; font-weight: bold; cursor: default;" onmouseout="this.style.cursor='default'" onmouseover="this.style.cursor='pointer'"><span style="font-size: 11px; color: rgb(128, 128, 128);">•</span> Who's online... <span style="font-size: 11px; color: rgb(128, 128, 128);">•</span></div>

Link to comment
Share on other sites

well, one option would be to give the table and div (if you can find it) a class ref, and then set the width using !important.mygoddamnwidth{width:982px !important;}<table width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0" class="mygoddamnwidth"><div style="overflow: visible; width: 1049px;" class="mygoddamnwidth">!important should cause this value to take precedence over the current width values.

Edited by dsonesuk
Link to comment
Share on other sites

That was very interesting! I tried using !important. It definitely made a difference on the above banner width, however the bottom tables remained the same. It also pushed all the above tables to the left to accommodate the smaller width. I also tried to center the whole page, but that didnt work either. So now i must find the associating file that controls the bottom tables. What a pain in da neck! :) Still not up to par, anymore suggestions?Thanks again

Link to comment
Share on other sites

How about starting over with something where you know how it works instead of trying to fix something that you don't know how it works?You can also use this function to list included files if you want to see all files that have been included:http://www.php.net/manual/en/function.get-included-files.php

Edited by justsomeguy
Link to comment
Share on other sites

Thank you! I will certainly look into it. My time is not on my side however. But it does make sense.Now i did find something really interesting though.Now my vars.php file demands the site width at 1015 as it stands now.This is what i found on my index.php page. Please let me know what it means.<div style="width: <?php echo $site_width+50;Does the +50 mean it will force the page 50 px wider? I didnt want tomodify it in case it was part of a value.Anybody?Thanks

Link to comment
Share on other sites

Yeah, it'll take the number in the variable $site_width and make it 50px bigger. Is that the entire line? It should end ?>

Edited by chibineku
Link to comment
Share on other sites

yep - that fixed a lot of my problem. but now i have to even out the whole page.Gosh... i wish it was easy as html - center please - and the whole page is centered.Isn't there a 1 variable string that will command a page to center, without havingto fight with css margins?Thanks guys

Link to comment
Share on other sites

It is as easy as "center please", you just need to know the language to say it in.Unfortunately, you are using table layout which doesn't always respond to CSS styling. If you were using current practice of <div> layout, I could assure you that the following would work.In your PHP index file, add an id to the main table:<body><table width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0">becomes<body><table id="mainWrapper" width="<?php echo $site_width; ?>" border="0" cellspacing="5" cellpadding="0">Now you have a way to address it in your stylesheet. Add to your stylesheet#mainWrapper {margin: auto; /*this centers the wrapper in the window*/text-align: center; /*this centers contained elements in the wrapper*/}If you want contents of subsidiary elements aligned left or right, give them ids and style them with text-align: left; or text-align: right;This is a bigger job than can be handled in a post; to really get this page working smoothly it should be recoded using modern practices.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...