PoKeSaFaRi Posted January 7, 2007 Share Posted January 7, 2007 Recently, i've been coding some stuff on PHP, for a site that at peak times, has over 300 visitors surfing at the same time. Considering I was told not to use MySQL for this.As I'm not an expert, I'd like some opinions and (if possible) ways to make this work better.What I've been doing is the following:[code]<?// variables$number = "10";$template = "ps";$sitio = $_GET['sitio'];$slash = '/';$patilla = 'index';$error = "404.txt";$ext = ".shtml";$stringslash = strpos($sitio, $slash);$stringext = strpos($sitio, $ext);// GZIP Compressionob_start("ob_gzhandler");ob_start("compress");function compress($buffer) { $buffer = str_replace(array("\r"), '', $buffer); $buffer = str_replace(array("\t"), '', $buffer); return $buffer;}// Template Conditionalsif(!isset($_GET['sitio'])){ $menu = 'lateral.htm';}elseif($_GET['sitio'] == "") { $menu = 'lateral.htm';}elseif(isset($_GET['sitio']) && file_exists($_GET['sitio'].$ext) || $stringext){ if ( $stringext && file_exists($_GET['sitio']) ){ include $sitio; } elseif( ($stringext===false) && file_exists($_GET['sitio'].$ext) ){ include $_GET['sitio'].$ext; } else { include $error; }}elseif($stringslash) { $add = $sitio.$patilla.$ext; if(file_exists($add)){ include $add; } }else{ include $error;}?>[/code]Then, further in the code, all I do is basically print the variables pageTitle and pageContent into the area of layout containing the info. $pageContent contains lots of HTML to build the changing content.[code]<html><head><title><? echo $pageTitle?></title></head><body><? echo $pageContent; ?></body></html>[/code]Finally:[code]<?//Buffer says bye-bye ob_end_flush(); ob_end_flush(); ?>[/code]To anyone willing to comment on it, thanks in advance! Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/ Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 What is your question? Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/#findComment-155261 Share on other sites More sharing options...
PoKeSaFaRi Posted January 7, 2007 Author Share Posted January 7, 2007 If that's gonna kill the server badly or not. Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/#findComment-155264 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Why would it? Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/#findComment-155294 Share on other sites More sharing options...
PoKeSaFaRi Posted January 7, 2007 Author Share Posted January 7, 2007 Consider around 300 users surfing. That means lots of includes, copying into variables, and echo-ing them.I just want to make sure it's not abusing functions inneccesarly or it's pretty bad coded. Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/#findComment-155297 Share on other sites More sharing options...
PoKeSaFaRi Posted January 8, 2007 Author Share Posted January 8, 2007 For now I've decided to try it out.Still, if anyone can spot any weakness in the code, let me know please. Thanks =) Link to comment https://forums.phpfreaks.com/topic/33249-vars-and-server-load/#findComment-155704 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.