Category: PHP

In our PHP session you will learn about PHP, and how to execute scripts on your application

HTML mailto attribute

The HTML mailto is a quick way to add the facility of receiving feedback from visitor on the web site. when the visitor clicked the HTML mailto, It lanuches their email program with new email window. Note: HTML mailto assumes that the visitor has configured an email client (Outlook Express, Netscape Messenger, Thunderbird or any …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/html-mailto-attribute/

Find out IP address

We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/find-out-ip-address/

Send HTML Mail With PHP

Sending html email in php is extremely easy. All you have to do is call the “mail” function with some extra header. Have a look on example: <?php //define the receiver of the email $to = ‘youraddress@example.com’; //define the subject of the email $subject = ‘Test HTML email’; //create a boundary string. It must be unique //so …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/send-html-mail-with-php/

Single quotes, Double quotes

It’s easy to just use double quotes when concatenating strings because it parses everything neatly without having to deal with escaping characters and using dot values. However, using single quotes has considerable performance gains, as it requires less processing. For Example: <?php //Consider this string $howdy = ‘everyone’; $foo = ‘hello $howdy’; $bar = “hello $howdy”; // Concatenating this strings $howdy = ‘everyone’; …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/single-quotes-double-quotes/

Scripts Execution Time Limits

Putting a time limit on your PHP scripts is a very critical thing. There are times when your scripts will fail, and when they do, you’ll want to use the set_time_limit function to avoid infinite loops and database connection timeouts. The set_time_limit puts a time limit on the maximum number of seconds a script will …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/scripts-execution-time-limits/

Increase PHP Script Execution Time Limit

Every once in a while we need to process a HUGE file. Though PHP probably isn’t the most efficient way of processing the file, we usually use PHP because it makes coding the processing script much faster. To prevent the script from timing out, I need to increase the execution time of the specific processing …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/increase-php-script-execution-time-limit/

Refresh / Redirection

When you need your web page automatic refresh in 5 second or any second, use this meta tag.  It’s a simple code, put it between HEAD tag in your web page. This script easy but powerful. <HEAD> <meta http-equiv=’refresh’ content=’2;url=’file_name or URL’> </HEAD> // content = time (second) // file_name = name of file you …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/refresh-redirection/

cURL Function

cURL is a library which allows you to connect and communicate to many different types of servers with many different types of protocols. Using cURL you can: Implement payment gateways’ payment notification scripts. Download and upload files from remote servers. Login to other websites and access members only sections. PHP cURL library is definitely the …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/curl-function/

PHP sessions problem

Below are some of the common problems faced by beginners while using sessions in PHP. Headers already sent This is the most commonly faced error is also the easiest to fix. Lets first see what a typical HTTP response looks like. As can see from the image headers always precede (come before) the content. The …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/php-sessions-problem/

Set error reporting level to maximum

Configure your development environment to display all PHP warnings, notices and errors. This will help you code better and also help in catching potential bugs early in development phase. You can change the error reporting level at runtime by adding the following code at the top of your PHP script: <?php // Report all PHP …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/11/set-error/