Conditional comments only work in Explorer on Windows, and are thus excellently suited to give special instructions meant only for Explorer on Windows. They are supported from Explorer 5 onwards, and it is even possible to distinguish between 5.0, 5.5 and 6.0.
Monday, December 21, 2009
What are conditional comments?
Deprecated XHTML Elements
This page will list the Elements and attributes that have been deprecated in the most recent version of XHTML, XHTML 1.0.
Friday, December 04, 2009
How to find which version of Drupal I'm running?
Failing that, look for a file called CHANGELOG.txt in the root of your Drupal directory and open it up to find the version you are running.
If CHANGELOG.txt is missing, you can also check in system.module for a line at the top like:
define('VERSION', '5.5');
If this is present, it will tell you which version you are running. If not, you have a version earlier than 4.7.2.
What are the content types associated with core Drupal modules?
What are the five main layers in the Drupal system?
1. Data (Nodes, etc)
At the core of the system is the big bucket of nodes—the data pool. Before anything can be displayed on the site, it must be input as data
2. Modules
Modules are functional plug-ins that are either part of the Drupal core (they ship with Drupal) or they are contributed items that have been created by members of the Drupal community.
3. Blocks & Menus
Blocks often provide the output from a module or can be created to display whatever you want, and then can be placed in various spots in your template (theme) layout.
4. User Permissions
This is where settings are configured to determine which things different user types have access to.
5. Template
This is made up predominately of XHTML and CSS, with some PHP tokens sprinkled throughout to insert content from the system into the correct spots.
Wednesday, November 18, 2009
How to get ONLY column names of a table in MySQL?
Here is the query
select column_name from information_schema.columns where table_name='tablenamehere
Wednesday, September 16, 2009
Database Normalization Basics
In this article, we'll introduce the concept of normalization and take a brief look at the most common normal forms.
MySQL Handling Duplicates
Tables or result sets sometimes contain duplicate records. Sometime it is allowed but sometime it is required to stop duplicate records. Sometime it is required to identify duplicate records and remove them from the table. This chapter will describe how to prevent duplicate records occurring in a table and how to remove already existing duplicate records.
INSERT ON DUPLICATE KEY UPDATE - MySQL
INSERT ... ON DUPLICATE KEY UPDATE is a very powerful but often forgotten MySQL feature. It was introduced in MySQL 4.1.
Friday, September 04, 2009
Thursday, September 03, 2009
Monday, August 24, 2009
About PHP5
PHP5 has improved support for OOPS when compared to PHP4. The 4 pillars of OOPS are fully supported by PHP5 i.e. Encapsulation, Inheritance, Polymorphism and Abstraction. You can also create interfaces; if you have been designing classes for a while, you know how important interfaces are.
Labels:
abstraction,
encapsulation,
inheritance,
oops,
php5,
polymorphism
Friday, August 21, 2009
Constructors
Constructors are functions in a class that are automatically called when you create a new instance of a class with new. A function becomes a constructor, when it has the same name as the class. If a class has no constructor, the constructor of the base class will be called, if it exists.
Tuesday, August 18, 2009
Some useful Crontab generator URLs
http://www.thepcmanwebsite.com/crontab_generator.shtml
http://www.openjs.com/scripts/jslibrary/demos/crontab.php
http://webtools.live2support.com/misc_crontab.php
http://www.openjs.com/scripts/jslibrary/demos/crontab.php
http://webtools.live2support.com/misc_crontab.php
Monday, August 17, 2009
Caching your pages with PhP
In the modern days, most of the sites are database driven. That means that your site is actually an application which retrieves data from a DBMS ( database managment system, eg MySQL) , parses the data and shows the result to the user. Most of these data are usually don't change frequently or don't change at all, and the reason that we use the database is that we can easilly update the site and the content.
A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especcially for sites with heavy traffic is a real big problem.
A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especcially for sites with heavy traffic is a real big problem.
Uploading, Saving and Downloading Binary Data in a MySQL Database
This article is aimed at answering one of the most asked questions on the PHP mailing list and discussion forums alike: How to store binary files in a MySQL database.
VPS MySQL and Apache Optimization Guide
With a considerable number of webmasters switching to Virtual Private Servers (VPS) from shared hosting these days and preferring them over costlier fully dedicated servers, memory and resource optimization has become a burning issue. Most VPS packages being bought these days, have dedicated memory constraints of 128MB to 256MB. Apache and MySQL are known to be the most memory (resource) intensive applications that tend to crash or slow down a low to mid range VPS often. While OpenVZ or Virtuozzo based VPSs can have a burst memory limit in addition to the dedicated RAM to quench occassional high memory needs, Xen based VPSs cannot use more than the stipulated amount of dedicated RAM, adding to the problem.
Using Stored Procedures & MySQLI in PHP 5
For the occasions that you want to use a stored procedure you’ve written in MySQL 5 through PHP , the semantic tool to use is PHP’s built in mysqli objects/package.
According to the php.net: “The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.”
MySQLI stands for MySQL Improved, and it most certainly is with the addition of prepared statements and extensible Object Oriented interface.
According to the php.net: “The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.”
MySQLI stands for MySQL Improved, and it most certainly is with the addition of prepared statements and extensible Object Oriented interface.
How to Create an RSS Feed for Your Site in PHP
Most blogging platforms come with built-in support for RSS feeds. Why? It’s a great way for users to keep up to date on your new content. Instead of loading up a dozen favorite sites, they can look at one feed reader and then decide what to pursue further.
So what if you don’t use a blogging platform or CMS that creates a feed for you? You can create one yourself in PHP. It’s pretty simple.
So what if you don’t use a blogging platform or CMS that creates a feed for you? You can create one yourself in PHP. It’s pretty simple.
PHP: Be Notified When Google Crawls Your Site
Have you ever wanted to know when Google crawls your website? Well now you can using a simple PHP script which emails you everytime GoogleBot crawls your site.
PHP and AJAX - Make a Password Strength Bar that Updates in Real-time
This tutorial will show you how to make a very simple feature which will help your users make more secure passwords, in registration forms. After the user types their password, this script will make a request to a PHP page, which will check the password for lowercase letters, uppercase letters, numbers and symbols. Without reloading the page, a bar displaying the strength of the password will be shown to the user.
Facebook like multi Toggle Comment Box with jQuery and PHP.
Implement Facebook like toggle comment box for every updated wall. Here is a simple example which contains of very simple jQuery and PHP code.
Thursday, August 06, 2009
Introduction to MySQL Views
By definition, view is a virtual or logical table which is composed of result set of a SELECT query. Because view is like the table which consists of row and column so you can retrieve and update data on it in the same way with table. View is dynamic so it is not related to the physical schema and it is only stored as view definition. When the tables which are the source data of a view changes; the data in the view change also.
MySQL Copying Data from one Table to a New One
In this tutorial, you will learn how to copy data from one table into a new table by using SQL CREATE TABLE and SELECT statement. Copying data from an existing table to a new one is useful in some cases such as backing up data, create a copying of real data for testing.
MySQL Commands
This article has a list of handy MySQL commands that we use time and time again. At the bottom are statements, clauses, and functions we can use in MySQL. Below that are PHP and Perl API functions we can use to interface with MySQL. To use those PHP need to build with MySQL functionality. To use MySQL with Perl the Perl modules DBI and DBD::mysql must be configured.
Monday, August 03, 2009
Building an IP-to-Country Mapping Application with PHP
Table of Contents:
1. Building an IP-to-Country Mapping Application with PHP
2. Start building an IP-to-country PHP application
3. Transferring the data of the IP-to-country database to the MySQL table
4. Importing records of the IP-to-country database to the MySQL table
1. Building an IP-to-Country Mapping Application with PHP
2. Start building an IP-to-country PHP application
3. Transferring the data of the IP-to-country database to the MySQL table
4. Importing records of the IP-to-country database to the MySQL table
The X-debug Extension
Table of Contents:
1. The X-debug Extension
2. Getting started using the X-debug library
3. Keeping track of file calls with the X-debug extension
4. Working with the xdebug_call_line() function
1. The X-debug Extension
2. Getting started using the X-debug library
3. Keeping track of file calls with the X-debug extension
4. Working with the xdebug_call_line() function
Building a Database-Driven Application with the Code Igniter PHP Framework
This article explains the below.
1. Introducing the Code Igniter PHP framework
2. Retrieving user-related data from a MySQL table
3. Defining a controller class
4. Outputting user-related data with Code Igniter
1. Introducing the Code Igniter PHP framework
2. Retrieving user-related data from a MySQL table
3. Defining a controller class
4. Outputting user-related data with Code Igniter
Designing a Captcha System with PHP and MySQL
This articles explains the below.
1. Designing a Captcha System with PHP and MySQL
2. The Captcha Image Generation Script
3. The PHP Form with Captcha-Generated Challenge
4. Captcha System Without GD Support
1. Designing a Captcha System with PHP and MySQL
2. The Captcha Image Generation Script
3. The PHP Form with Captcha-Generated Challenge
4. Captcha System Without GD Support
How to redirect browser to https (ssl) in php
Most of the e-commerce website uses payment gateway for online payment. And, those sites uses SSL (secure socket layer) connection to transfer data to and from the payment gateway.
In the common scenario, most of the sites uses “http” protocol and you can see “http” in the browser’s address bar. But in the above scenario,we need to redirect the browser to “https” which means that “Hypertext Transfer Protocol over Secure Socket Layer”.
Ok let’s see a real example, type “http://www.gmail.com” in browser after a while the “http” gets converted to “https” in address bar, which means this site is transferring the data over SSL protocal.
In the common scenario, most of the sites uses “http” protocol and you can see “http” in the browser’s address bar. But in the above scenario,we need to redirect the browser to “https” which means that “Hypertext Transfer Protocol over Secure Socket Layer”.
Ok let’s see a real example, type “http://www.gmail.com” in browser after a while the “http” gets converted to “https” in address bar, which means this site is transferring the data over SSL protocal.
Labels:
.,
e-commerce,
http https,
online payment,
payment gateway,
SSL
Creating and Parsing JSON data with PHP
This article describes about what is JSON and how we can handle it via PHP. Although, JSON stands JavaScript Object Notation, it is used by many other technologies like PHP and Java for data interchange format over the Internet.
5 useful url rewriting examples using .htaccess
If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, they’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check here for url rewriting using .htaccess.
Monday, July 27, 2009
PHP Tutorial on Classes, Inheritance, Polymorphism, Magic Methods & Exceptions
This page will consist of various articles and tutorials on PHP, e.g.: PHP5 Tutorial, PHP Examples, PHP Class, etc. Read on to find out.
Labels:
class,
classes,
exceptions,
inheritance,
magic methods,
php,
php5,
polymorphism
Image watermark with PHP
To prevent quality images being stolen, we can use PHP to watermark web-images in popular formats like GIF/PNG/JPEG. We print a transparent gif-image on a jpeg-photo in this tutorial. For best results use gif than png, because some png formats require extra functions to print a transparent image. We can convert this script to a batch-watermarker easily to watermark photo albums/galleries with multiple pictures by putting code in a loop or create a function.
Steps:
1.Load both images
2.Get size of both images
3.Copy watermark to main image
4.Print image to screen
Steps:
1.Load both images
2.Get size of both images
3.Copy watermark to main image
4.Print image to screen
How to Implement Text to Speech in PHP
Festival, application allows us to convert Text to Speech(WAV) format. In this article we will learn on how we can convert text to speech from PHP applications.
Facebook like Autosuggestion with jQuery, Ajax and PHP.
This article shows how to implement Autosuggestion search with jquery...
MySql Prepared Statement in PHP
Prepared Statements are always better than normal statements as it prevent SQL Injection etc. This article will discuss on how we can make Prepared Statement Call to MySql Database Call using MySqli Extension of PHP.
Getting Started with Drizzle and PHP
When It Rains, It Drizzles
Unless you've been completely out of touch with the open source world, you'll have heard of Drizzle, a new database server that's derived from MySQL. The Drizzle project aims to build a "smaller, lighter, faster" version of MySQL that offers similar stability and ease of use, but strips out certain features from the core system in order to improve performance and scalability.
Now, while Drizzle is still relatively new, it is quickly gaining attention among open source developers who are interested in experimenting with it, contributing to it, and using it in their projects. And that's where this article comes in. Over the next few pages, I'll guide you through the process of getting started with Drizzle, showing you how to compile and install it, set up a Drizzle database, and connect to it using PHP. Let's get started!
Unless you've been completely out of touch with the open source world, you'll have heard of Drizzle, a new database server that's derived from MySQL. The Drizzle project aims to build a "smaller, lighter, faster" version of MySQL that offers similar stability and ease of use, but strips out certain features from the core system in order to improve performance and scalability.
Now, while Drizzle is still relatively new, it is quickly gaining attention among open source developers who are interested in experimenting with it, contributing to it, and using it in their projects. And that's where this article comes in. Over the next few pages, I'll guide you through the process of getting started with Drizzle, showing you how to compile and install it, set up a Drizzle database, and connect to it using PHP. Let's get started!
Friday, July 24, 2009
Regex Coach
The Regex Coach is a graphical application for Windows which can be used to experiment with (Perl-compatible) regular expressions interactively. It has the following features:
It shows whether a regular expression matches a particular target string.
It can also show which parts of the target string correspond to captured register groups or to arbitrary parts of the regular expression.
It can "walk" through the target string one match at a time.
It can simulate Perl's split and s/// (substitution) operators.
It tries to describe the regular expression in plain English.
It can show a graphical representation of the regular expression's parse tree.
It can single-step through the matching process as performed by the regex engine.
Everything happens in "real time", i.e. as soon as you make a change somewhere in the application all other parts are instantly updated.
It shows whether a regular expression matches a particular target string.
It can also show which parts of the target string correspond to captured register groups or to arbitrary parts of the regular expression.
It can "walk" through the target string one match at a time.
It can simulate Perl's split and s/// (substitution) operators.
It tries to describe the regular expression in plain English.
It can show a graphical representation of the regular expression's parse tree.
It can single-step through the matching process as performed by the regex engine.
Everything happens in "real time", i.e. as soon as you make a change somewhere in the application all other parts are instantly updated.
Thursday, July 16, 2009
PHP performance tips
1. Profile your code to pinpoint bottlenecks
2. Upgrade your version of PHP
3. Use caching
4. Use output buffering
5. Don't copy variables for no reason
6. Avoid doing SQL queries within a loop
7. Use single-quotes for long strings
8. Use switch/case instead of if/else
2. Upgrade your version of PHP
3. Use caching
4. Use output buffering
5. Don't copy variables for no reason
6. Avoid doing SQL queries within a loop
7. Use single-quotes for long strings
8. Use switch/case instead of if/else
Wednesday, July 01, 2009
10 Useful PHP Tips
1. Use an SQL Injection Cheat Sheet
2. Know the Difference Between Comparison Operators
3. Shortcut the else
4. Drop Those Brackets
5. Favor str_replace() Over ereg_replace() and preg_replace()
6. Use Ternary Operators
7. Memcached
8. Use a Framework
9. Use the Suppression Operator Correctly
10. Use isset() Instead of strlen()
2. Know the Difference Between Comparison Operators
3. Shortcut the else
4. Drop Those Brackets
5. Favor str_replace() Over ereg_replace() and preg_replace()
6. Use Ternary Operators
7. Memcached
8. Use a Framework
9. Use the Suppression Operator Correctly
10. Use isset() Instead of strlen()
PHP File Upload Security Ideas
When you allow users to upload files to your website, you are putting yourself at a security risk. While nobody is ever completely safe, here are some precautions you can incorporate to make your site safer.
1.Check the referrer: Check to make sure that the information being sent to your script is from your website and not an outside source. While this information can be faked, it's still a good idea to check.
2.Restrict file types: You can check the mime-type and file extension and only allow certain types to be uploaded.
3.Rename files: You can rename the files that are uploaded. In doing so, check for double-barreld extensions like yourfile.php.gif and eliminate extensions you don't allow, or remove the file completely.
4.Change permissions: Change the permissions on the upload folder so that files within it are not executable. Your FTP program probably allows you to chmod right from it.
5.Login and Moderate: Making your users login might deter some deviant behavior. You can also take the time to moderate all file uploads before allowing them to become live on the web.
1.Check the referrer: Check to make sure that the information being sent to your script is from your website and not an outside source. While this information can be faked, it's still a good idea to check.
2.Restrict file types: You can check the mime-type and file extension and only allow certain types to be uploaded.
3.Rename files: You can rename the files that are uploaded. In doing so, check for double-barreld extensions like yourfile.php.gif and eliminate extensions you don't allow, or remove the file completely.
4.Change permissions: Change the permissions on the upload folder so that files within it are not executable. Your FTP program probably allows you to chmod right from it.
5.Login and Moderate: Making your users login might deter some deviant behavior. You can also take the time to moderate all file uploads before allowing them to become live on the web.
How can I execute PHP code on my existing myfile.html page?
The way to execute PHP on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html:
AddType application/x-httpd-php .html
Or for .htm
AddType application/x-httpd-php .htm
If you only plan on including the PHP on one page, it is better to setup this way:
AddType application/x-httpd-php .html
This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages.
AddType application/x-httpd-php .html
Or for .htm
AddType application/x-httpd-php .htm
If you only plan on including the PHP on one page, it is better to setup this way:
This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages.
Subscribe to:
Posts (Atom)