hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Design and Content : PHP/CSS/XHTML W3C Site Request
Reply

Forum Jump

PHP/CSS/XHTML W3C Site Request

Reply Post New Thread In Web Design and Content Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-11-2011, 11:23 PM
Nullified Nullified is offline
Web Hosting Master
 
Join Date: Jan 2004
Posts: 1,307

PHP/CSS/XHTML W3C Site Request


I am not requesting any solicited services. I am asking for recoomendations from WHT users.

A few years ago I purchased a psd design that I have since modifyed and coded to my liking. I have added much to it and have it mostly built, however I am no web designer. The site's backend is php/mysql. Only light php though; just enough to build retain session data to chache content, phrases and templates. The frontend is css/xhtml and light javascript in a mostly tabeless design.

The majority of the site is built; now I just need WHMCS, vBulletin & cPanel integration. I am looking for a company that will optimize my backend code to ensure there are no security or loadtime issues. I would also want them to fix all non w3c compliant pages to ensure proper display in all major browsers. Templating for WHMCS, vBulletin and cPanel isn't a neccessity, but would be nice. Can anyone reccomend a company that would do this (roughly 20 pages split amongst 30-40 dynamic php files) for somewhere in the low thousands?



Sponsored Links
  #2  
Old 07-12-2011, 08:30 AM
the_pm the_pm is offline
Community Liaison 2.0
 
Join Date: May 2004
Location: Pflugerville, TX
Posts: 11,222
Is the PHP built into your site actually touching a database? Because if it's not, and if it's not sending POST data anywhere, the chances that you have security issues are very slim. It's good that you're being cautious, but you'll probably be pleased to know this, in general.

Are there particular browsers in which you're having difficulty with how your site displays? In some cases, there's a code trick or two you can employ to tighten up the look in browsers that are causing problems for you, without needing to tear down and rebuild (like triggering HasLayout for IE7+, or using -moz filters for Firefox).

If you share a link, maybe you can get the insight you need to make everything work for you as expected?

__________________
Studio1337___̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.__Web Design

  #3  
Old 07-12-2011, 04:31 PM
Nullified Nullified is offline
Web Hosting Master
 
Join Date: Jan 2004
Posts: 1,307
Good to see you're still hanging around these parts. Surprised I still remember your username as an active WHTer back in the early 2000's.

Most of the errors are slight differences. I have coded the page to work fine in mozilla and see only minor error when viewing in IE, such as whitespace, margin offests, borders, and button/div styling. Most of which is probably tweekable as you've stated. I am just sick of doing it, but I'll continue to work on it.

In regards to the php: I'm not sure what you mean by "touching", but if it's what you think then there is only minor "touching". The myself user that is used to fetch the db data for php session info is only given read permissions to the db. Here is the code:
global.php (called on every page):
PHP Code:
require_once('config.php');
require_once(
'classes.php');
require_once(
'functions.php');

init_core(); 
Config:
PHP Code:
$config['server'] = array();
$config['links'] = array()
$config['meta'] = array()
// These arrays store my db settings, hyperlinks and meta tags. 
Classes:
PHP Code:
class Site {
    var 
$db;
    var 
$cache;
    var 
$session;
    function 
Site () {
        
$this->db = &new Database($this);
        
$this->cache = &new Cache($this);
        
$this->session = &new Session($this);
    }
}

class 
Database {
    var 
$connection null;
    var 
$database null;
    function 
connect($username$password$database$server 'localhost'$port 3306$persistent false) {
        
$this->connection = empty($persistent) ? mysql_connect("$server:$port"$username$password) : mysql_pconnect("$server:$port"$username$password);
        if (!
$this->connectionshow_error('servercon'''$username$password$database$server$port);
        
$this->database mysql_select_db($database$this->connection);
        if (!
$this->databaseshow_error('dbcon'''$username$password$database$server$port);
        
$_SESSION['database'] = true;
    }
    function 
query($sql$connection) {
        
$result mysql_query($sql);
        if (!
$resultshow_error('query'$sql$username$password$database$server$port);
        return 
$result;
        @
mysql_free_result($result);
    }
    function 
insert($sql) {
        
$this->query($sql$this->connection);
    }
    function 
update($sql) {
        
$this->query($sql$this->connection);
    }
    function 
delete($sql) {
        
$this->query($sql$this->connection);
    }
    function 
fetch_array($sql$type MYSQL_ASSOC) {
        
$result $this->query($sql$this->connection);
        while(
$row mysql_fetch_array($result$type)) {
            
is_array($array) ? array_push($array$row) : $array = array($row);
        }
        return 
$array;
        @
mysql_free_result($array);
    }
}
class 
Cache extends Database {
    function 
meta($content) {
        if (
is_array($content)) foreach ($content as $var => $val$_SESSION['meta'][$var] = $val;
        unset(
$content);
        return 
$_SESSION['meta'];
    }
    function 
links($content) {
        if (
is_array($content)) foreach ($content as $var => $val$_SESSION['links'][$var] = $val;
        unset(
$content);
        return 
$_SESSION['links'];
    }
    function 
phrases($phrasegroups) {
        if (!
is_array($_SESSION['phrases'])) $_SESSION['phrases'] = array();
        foreach (
$phrasegroups as $group$phrasegroup = isset($phrasegroup) ? $phrasegroup.", '".$group."'" "'".$group."'";
        
$phrases $this->fetch_array("SELECT name, value FROM phrases WHERE location IN (".$phrasegroup.")");
        if (
is_array($phrases)) foreach ($phrases as $phrase$_SESSION['phrases'][THIS_SCRIPT][$phrase[name]] = $phrase['value'];
        unset(
$phrases);
        return 
$_SESSION['phrases'][THIS_SCRIPT];
    }
    function 
templates($templategroups) {
        if (!
is_array($_SESSION['templates'])) $_SESSION['templates'] = array();
        foreach (
$templategroups as $group$templategroup = isset($templategroup) ? $templategroup.", '".$group."'" "'".$group."'";
        
$templates $this->fetch_array("SELECT name, value FROM templates WHERE location = IN (".$templategroup.")");
        if (
is_array($templates)) foreach ($templates as $template$_SESSION['templates'][THIS_SCRIPT][$template[name]] = $template['value'];
        unset(
$templates);
        return 
$_SESSION['templates'][THIS_SCRIPT];
    }
}
class 
Session extends Cache {
    function 
build() {
        
//session_cache_expire(1);
        //session_cache_limiter('public');
        
session_start();
        if (!isset(
$_SESSION['timestamp'])) $_SESSION['timestamp'] = $_SERVER['REQUEST_TIME'];
        if (
$_REQUEST['session'] == 'destroy' || $_SERVER['REQUEST_TIME'] - $_SESSION['timestamp'] > 3600$this->destroy();
    }
    function 
destroy() {
        
session_unset();
        
$_SESSION = array();
        
session_destroy();
        
header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
    }
}

$site = new Site(); 
Functions:
PHP Code:
function init_core() {
    global 
$site$config$phrasegroups$templategroups;
    
$site->db->connect($config['server']['username'], $config['server']['password'], $config['server']['db'], $config['server']['addr'], $config['server']['port']);
    
$site->session->build();
    
$site->folder build_folders();
    
$site->url = isset($_SESSION['links']) ? $_SESSION['links'] : $site->cache->links($config['links']);
    
$site->meta = isset($_SESSION['meta']) ? $_SESSION['meta'] : $site->cache->meta($config['meta']);
    
$site->phrase = isset($_SESSION['phrases'][THIS_SCRIPT]) ? $_SESSION['phrases'][THIS_SCRIPT] : $site->cache->phrases($phrasegroups);
    
$site->template = isset($_SESSION['templates'][THIS_SCRIPT]) ? $_SESSION['templates'][THIS_SCRIPT] : $site->cache->templates($templategroups);
}
function 
print_template($template) {
    global 
$site$meta;
    include(
$template '.php');
}
function 
show_error($error_type$sql$username$password$database$server$port) {
    switch (
$error_type) {
        case 
'servercon':
            die(
'Unable to establish connection with ' $server ' utilizing port ' $port ': ' mysql_error());
        break;
        case 
'dbcon':
            die(
'Connection with server established, but unable to connect with ' $database ': ' mysql_error());
        break;
        case 
'query':
            die(
'Connected with the database was established, but unable to run query (' $sql '): ' mysql_error());
        break;
        default:
            die(
'MySQL has returned an error: ' mysql_error());
    }
    return 
$array;
    unset(
$array);
}
function 
build_folders() {
    
$dir['deep'] = number_format(substr_count($_SERVER['SCRIPT_FILENAME'], '/') - substr_count($_SERVER['DOCUMENT_ROOT'] . '/''/'));
    if (
$dir['deep'] == 1) {define('CD''../');} elseif ($dir['deep'] == 2) {define('CD''../../');} else {define('CD''');}
    
$array = array(
        
'images' => CD.'images/',
        
'includes' => CD.'includes/'
    
);
    
$array array_merge($array, array(
        
'styles' => $array['includes'].'styles/'
        
)
    );
    
$array['images'] = array(
        
'home' => $array['images'],
        
'header' => $array['images'].'header/',
        
'footer' => $array['images'].'footer/',
        
'icons' => $array['images'].'icons/',
        
'buttons' => $array['images'].'buttons/',
        
'column' => $array['images'].'column/'
    
);
    return 
$array;
    unset(
$dir$array);


Sponsored Links
  #4  
Old 07-12-2011, 05:10 PM
the_pm the_pm is offline
Community Liaison 2.0
 
Join Date: May 2004
Location: Pflugerville, TX
Posts: 11,222
Quote:
Good to see you're still hanging around these parts. Surprised I still remember your username as an active WHTer back in the early 2000's.
We keep pretty busy nowadays, and sometimes we're so busy I don't get a moment to spare for any communities, social media, etc. It's a good problem to have, but a problem nonetheless. Either way, I get a few minutes to breath now

If the user that's connecting to the database only has read permissions, and there are no ways for people to send POST data to it (which would have to be the case), then the chances of having a security hole are extremely remote.

Quote:
see only minor error when viewing in IE, such as whitespace, margin offests, borders, and button/div styling
it sounds to me like you're fighting browser defaults. Have you considered using universal resets at the beginning of your CSS document? Something like this might help you with consistency tremendously:

* { list-style:none ; margin:0 ; outline:none ; padding:0 }
a img { border:none }

Then you style these elements into place as you work your way down. It makes a HUGE difference!

__________________
Studio1337___̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.__Web Design

  #5  
Old 07-18-2011, 02:26 PM
Nullified Nullified is offline
Web Hosting Master
 
Join Date: Jan 2004
Posts: 1,307
Your css seems very helpful. I am using something along the lines of html {margin: 0px; padding: 0px;} Wat exactly does the html css actually set?

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Psd 2 Xhtml/Css - Only $15 - W3C Valid - 48 Hour Turnaround Finer - Tommy Design Offers 1 05-04-2009 05:30 PM
[Buy Now] - Only $250! XHTML/CSS - W3C Compliant, a must see! aneVe Design Offers 0 02-26-2008 04:24 PM
W3C XHTML, CSS Coding Needed WHN Daniel Design Offers 2 02-14-2007 03:51 PM
Best Hosting Teplates For Sale /xhtml/css/W3C Asterisk Techs Design Offers 4 01-01-2007 04:52 PM
[Sale] PR3 Script Site, $30/month Revenue, W3C Compliant XHTML/CSS Website gzola Other Offers & Requests 11 03-18-2006 04:07 AM

Related posts from TheWhir.com
Title Type Date Posted
Federation Against Copyright Theft Tells LeaseWeb to Take Down Streaming Site or Risk Money Laundering Charges Web Hosting News 2013-12-20 10:47:35
What Web Hosts Can Do About Revenge Porn Web Hosting News 2014-04-14 09:16:29
FireHost Report Shows Cybercriminals Are Using the Cloud to Deploy Attacks Web Hosting News 2013-07-30 11:58:07
FireHost Report Finds Cross-Site Attacks Trump SQL Injections in Q3 2012 Web Hosting News 2012-10-23 09:18:51
Prolexic Reports Key Holes in Popular DDoS Attack Tool Dirt Jumper Web Hosting News 2012-08-14 14:48:14


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?