Results 1 to 10 of 10
Threaded View
-
17th Jul 2010, 11:30 PM #1OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.com[PHP] Discussion (System Building)
This thread is mainly to try and help guide the lost sheep in the right direction when it comes to PHP and building systems securely.
Now you all probably think that I'm real good at PHP but I'm not, what im good at is understanding architecture.
What i mean by architecture is summarized in these key points
- Functional/logic view
- Code/module view
- Development/structural view
- Concurrency/process/thread view
- Physical/deployment view
- User action/feedback view
- Data view
From this list you will see that an application is more that an if statement here and and else statement there, its about writing code in a way that it can be used for multiple purposes and have a more abstract approach to things.
now if i refer to you as a noob do not take it personally if you write code at a lower level, theres still time to save you, but noobs are everywhere and they create sites that are error prone and unsecured and unstable.
this is why everyday somebody in this forum posts a topic regarding asome shitty php code and saying help me fix it, as you notice us programmers such as jayfella hyperz and me get annoyed because its hard to fix a peice of code thats written poorly.
so firstly im going to explain how a noob would create a small website and how it can be dramatically changed to a more stable and less error prone system.
----
Site Name: My Mini Blog
Site Desc: Small blog
Created By: A Noob
the noob would firstly start placing all his html into into index.php with some sample posts in there aswell, so he can see where he wants his code.
then after he has the design how he wants it it will cut out the html posts and place some php tags there, connect to the database and start running queries
then he will create another page call addpost.php and do the exact same as in the first page
not this is not smart atall, this means that if he wants to make a change to lets say the database he would have to go throughout each file and do lots of edits.
ok so lets talk about how a professional programmer would accomplish the same thing!
he would create a set of files that store configurations such as datbase credentials, error settings, security, options etc.
he would then create a small database layer,security layer,error layer, etc etc
this would give him the flexibility to make 1 change to his database layer and that would change for the whole application.
For example
PHP Code:class MySql extends mysqli
{
public function __construct($host,$user,$pass,$db)
{
parent::__construct($host,$user,$pass,$db);
}
}
ok so lets say that you want to have a prefic for your tables so you can do
Code:SELECT * FROM #__users WHERE userid = 1
PHP Code:public function query($query, $result_mode = MYSQLI_STORE_RESULT)
{
$query= str_replace("#__","myPrefix_",$query);
return parent::query($query,$result_mode);
}
if you have any questions about building a system like this and how to start it, just ask your questions and ill try and help
also do not be afraid of making mistakes, if you kept doing the way you know is wrong but it works, then you will never ever learn.litewarez Reviewed by litewarez on . [PHP] Discussion (System Building) This thread is mainly to try and help guide the lost sheep in the right direction when it comes to PHP and building systems securely. Now you all probably think that I'm real good at PHP but I'm not, what im good at is understanding architecture. What i mean by architecture is summarized in these key points Functional/logic view Code/module view Development/structural view Rating: 5Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
PHP PDO login system, user class. Also Includes a theming system {Source}
By xifyhosting in forum Web Development AreaReplies: 3Last Post: 29th Aug 2012, 02:33 AM -
Free Report : List Building System
By errabbaa in forum Webmasters, Money MakingReplies: 2Last Post: 6th Jun 2012, 01:25 PM -
The FartMan is in the building...
By The FartMan in forum IntroductionsReplies: 3Last Post: 25th Jun 2011, 04:04 PM -
Building R/C Car
By sniper in forum General DiscussionReplies: 6Last Post: 11th Jul 2010, 09:19 PM -
building your pr-
By clarksta in forum Webmaster DiscussionReplies: 5Last Post: 17th Nov 2008, 04:11 PM
themaLeecher - leech and manage...
Version 5.05 released. Open older version (or...