homepage Welcome to WebmasterWorld Guest from 54.224.202.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to properly build a PHP website?
Where and in which order to put the code?
MaxGrenk




msg:4305078
 11:19 pm on Apr 27, 2011 (gmt 0)

This is more so a fundamental question...
I started rewriting my ASP content mgmt system in PHP earlier this year... and as one would guess and hoe, I came across a lot of things I could do better these days. Utilising PHP provides different solutions to problems.

[I am quite shocked and amazed about what I managed to build over the past 10 years in 7,100 lines of code, some of it has grown like a cancer and other bits are quite nice.]

Now that I have almost finished the rewrite, with lots of reflecting, I started wondering about the question: What is the proper way to build a non-shopping web site?

To be more specific: I am wondering where to put various bits, such as:
1. the page build itself, incl MySql queries, etc.
2. input parameter validation of querystrings, GETs, etc.
3. hotlink protection
4. db-driven redirects
5. blog form, submit, validation
6. logging
7. tracking
8. 404 handling (or is it better to have on page dealing with all errors?)
9. spam protection (form spammers)
10. etc.

I am not after code, but a logical (best practice, or most effective) flow and arrangement.

Is there a point in handling all rewrite rules (hotlink protection, image serve from different directory, old->new link redirects in PHP code, or split these functions to .htaccess and PHP code?
Following that, where to put what?

Maybe my question is too big -- something I realised when writing this down... :o)

Is there a good book out there going through all these steps?
Other sources?

 

MaxGrenk




msg:4305095
 12:03 am on Apr 28, 2011 (gmt 0)

I did some further research on the 'unknown' drivers for my questions...
It looks like my intensive occupation with coding has led to the fundamental questions of software design, such as coupling, cohesion and decomposition of a system into modules.

The rewrite gave me the bigger picture, the issues surrounding code maintenance, etc.

Maybe there is no answer to my question, except to understand software design better, which would then led to the proper assembly of code components to form a better larger system.

coopster




msg:4305408
 3:05 pm on Apr 28, 2011 (gmt 0)

Valid question.

The web developer tool set is much more than code. Knowing which component handles which area best is part of the overall analysis, design and development process. For example, logging and tracking. Logging and tracking HTTP requests are handled quite well by the underlying HTTP server itself. You can push as much data as you like into the log files and forward them to a post-processing script that runs on your server too. Also, perhaps you want to grab HTML <form> requests and log/track them. If so, you can use your server-side PHP application to write the information to a database table, system file, and/or email yourself with failures or possible hack attempts.

g1smd




msg:4305409
 3:12 pm on Apr 28, 2011 (gmt 0)

I have written a whole page of related info dotted throughout this thread... [webmasterworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved