- Set all warnings and errors to ‘on’ in php.ini file.
- Set register_ globals to ‘off’ in php.ini file.
- Set magic_quotes_gpc to ‘off’ in php.ini file.
- Set magic_quotes_runtime to ‘off’ in php.ini file.
- Test in browser with javascript errors on.
- Make an include file for all settings and variables.
- Check data entry with single quotes and double quotes.
- Use stripslashes() when fetching data.
- Use nl2br() when printing data (entered from a textarea) in html pages.
- Use encrypted query strings where required.
- One user must not be able to see the records of another user by tampering with the query string variables.
- Use image resizing wherever required.
- Do not resize images that are smaller than the specified size.
- When uploading file, display allowable file types and maximum upload size like: JPG, PNG and GIF Only. Max file size 2 MB.
- All forms should come filled in, in case of any errors in filling the form, so that user does not have to type all info again.
- All deletes must be confirmed before deletion.
- Use lipsum for dummy text. Get it from www.lipsum.com.
- When a search or view record is not found, please show a message, “No record found.”.
- Check for cascade deletions where required or warn for child record entry.
- On all submitted forms, especially contact us pages, please check referrer.
- Make messages like this:
- Username is a required field.
- Your passwords do not match.
- This category cannot be deleted as it is being referred to in a subcategory. Please delete the subcategory first.
- Delete corresponding images when deleting records from database.
- All forms must be validated.
- Use date picker or date combos whenever date is required to be entered.
- Paginate when required.
- When writing insert and/or update SQL queries, always write field names and then values. Do not insert or update all values.
- When writing database queries, always use quotes, even for numeric fields. This is for MySQL database.
- Table names and field names should be like this:
- Table name: databasename_tablename
- Field name: tablename_fieldname
- Some commonly used field sizes should be as below:
- username: varachar(20)
- password: varchar(20)
- firstname: varchar(15)
- lastname: varchar(15)
- fullname: varchar(30)
- phone: varchar(15)
- fax: varchar(15)
- email: varchar(50)
- address: text
- city: varchar(20)
- state: varchar(20)
- zip: varchar(12)
- country: int (to come from from country’s table).
- url: varchar(255)
- amount/price: double
- date: date
- timestamp: bigint
- Please set textbox’s max attribute to what it is in the database.
- Add server timeout when required.
- Test all your applications on multiple browsers.
- Give alt tag to all images
- Give title tags to images and hyperlinks.
- There is always space after a comma, a colon, a semi-colon and a full stop and not before them.
- Place an index page (with page title and text as “Access Denied” in all folders without index page to stop directory browsing. Or stop directory browsing using htaccess file.
- Show dates in full date format (January 10, 2012)
- Make admin login window database driven.
- All forms submitted, leading to select statements most have GET method.
- All views must be ordered by their respective fields.
- In user manager, the application must not be able to delete self and must not be able to delete the admin level user.
- Password protect admin folder with database driven module. Do not depend on password protecting admin folder.
- Use meta tag to redirect to log out page for auto log out when required.
- Always use die() with queries.
- Set auto complete off for login forms.
- Stripslashes() in email messages.
- Use substr where required to show long messages like “Lorem ipsum dorit…”.
- Format numbers as 24.00 where required.
- Spell check
- Write recommended size for pictures
- Contact and similar pages should go to thank you page.
- Required field must be marked with *.
- Use inner joins where required.
- Use enum data type where required.
- Close connections at page end or before redirection.
- Clean up test files before uploading.
- Use frame busters where required.
- Centre pop up windows.
- Delete images before updating them. Either check if exists before deleting or use @unlink.
- Mark all required fields with * in all forms.
- To get file path, use the following as it works on Apache and IIS.
- $url_to=”http://”.$ HTTP_HOST.$SCRIPT_NAME;
- Set different session names for admin and public users.
- Remove all test email addresses that send forms to you.
- Some sample messages at below.
Signup: Thank you very much for registering. Your account is now active and ready to use.
Contact Us: Thank you for contacting us. Your message has been sent to the concerned department and you will be contacted back shortly.
Profile Update: Your profile has been updated successfully.
Bug report submission message: Thank you very much for your time. Your reported bug/error has been routed to the concerned department for further action.
Lost Password: Your login information has been mailed to your email@domain.com.
Wrong Login info for Lost Password: Invalid login information; please provide the email address you used when you registered with us.
Lost Password Email:
Subject: Your SITE_NAME Login Information
Dear Member Name,
Your SITE_NAME login information is as below.
User Name: username
Password: password
The SITE_NAME Team
Registration Email to the member:
Subject: Welcome to SITE_NAME
Dear Member Name,
We welcome you to SITE_NAME. Your login information is as below and you can change your password anytime after logging in to the web site.
User Name: username
Password: password
The SITE_NAME Team