Tag Archives: php

Filters in Yii

Yii FiltersFilter is a piece of code that is configured to be executed before and/or after a controller action executes. For example, an access control filter may be executed to ensure that the user is authenticated before executing the requested action; a performance filter

may be used to measure the time spent executing the action.
An action can have multiple filters. The filters are executed in the order that they appear in the filter list. A filter can prevent the execution of the action and the rest of the unexecuted filters.
There are two types of filter

Continue reading Filters in Yii

How to read files in PHP

There are many options are available when it comes to file processing with PHP. Each option has its own importance. We will discuss some of the functions related to file processing, such as fopen, fclose, feof, file, file_get_contents etc. We will also discuss, when we should use which function, because it always depends on the goal of parsing the file.

Continue reading How to read files in PHP

Twitter bot tutorial

Twitter is heavily becoming a source of traffic and with there extremely powerful api , it’s very easy to automate stuff via Twitter bots.

Today i am going to show you a tutorial for very simple but yet very powerful bot which if used effectively can drive great traffic on sites. These bots simply search twitter stream for predefined keywords and tweet target messages to the tweeters. These bots can be set via cron to read stream every few minutes and make responses in real time.

For newbies and starters all Twitter API documentation can be found here , From here we are going to use Search API methods and Status Update REST api method for sending predefined tweets to the users.
Continue reading Twitter bot tutorial

7 jQuery code snippets a programmer need daily

Usually programmers use a lot of JavaScript code snippets as functions regularly, These JavaScript functions are lengthy code snippets and are usually tough to understand and edit. Some of the most common functions used are form validation functions , Pagination functions etc.

The day since jQuery has been on the block , It has provided a nifty way of solving a lot of common problems for which we needed lengthy JavaScript functions. I am sharing with you guys top 20 jQuery plugins and code snippets that are pretty useful for daily coding routines.

Continue reading 7 jQuery code snippets a programmer need daily

City , Country and zipcode lookup via Ip address in PHP

A lot of times i have seen newbies and even PHP pros struggling to find any method of implementing zipcode and country lookup !

This can be easily achieved with the help of Maxmind Geo API, They provide a exhaustive DB lookup functionality of IP adress . Which can be further translated into City, Country and Zipcode information ! . This API prove to be very useful in the web apps which require providing user specific content to the users.
Continue reading City , Country and zipcode lookup via Ip address in PHP

How to create a Simple Php Contact form

Here I am going to discuss a most common and necessary component which everyone requires for their blog or website, which is a contact-us form. Below you will find the code of a simple contact form. Also, I will discuss how to create the form and handle its submission. Generally We require that when someone is filling the form, its information will be either stored in a database or will be mailed to a given email address. In this post, we will only discuss the email part. You are welcome to modify and store the information in database with very small tweaks.

Let’s start..!! We need files, one to display the form and other one to capture its submission:

  • contact.php : this will contain the html code for the contact form.
  • process.php : this file will have necessary php cods for handling the above contact form.

//

Continue reading How to create a Simple Php Contact form

Spell Check in PHP with Yahoo API

Spell Check is a very nifty feature that a developer need to know , Especially when creating htaccess rewrite rules dynamically you will not want your URL’s to have index with wrong spellings , As this will hamper your SEO performance.

Here is a very easy tool that a developer can implement in their applications for checking the spellings, I have used this API when the users are searching on my web app !, This search make SEO URL’s which i don’t want to index in a incorrect manner.


Continue reading Spell Check in PHP with Yahoo API

Php Login System – Login Management and Login Control Tutorial

One of the most basic and most common question that i encounter via Php newbies is how to make a login system in PHP , The login, registration and authentication are very basic and yet very important tools that a php programmer should posses !

For this tutorial there are few prerequisites:-

1) You should be able to right a simple hello world program in php
2) You should know the basics of mysql, Creating tables and sql queries.

In following tutorial we will create 3 files:-

1) login_home.php
2) login_check.php
3) login_success.php

First of all we need to create a table users in mysql database !, This User table will contain all user login information and details.


Continue reading Php Login System – Login Management and Login Control Tutorial

Friendfeed API implementation in PHP

Recently for a client i needed to make a friendfinder script via Friendfeed API !, On giving a initial look at their API homepage , i was happy to see that Friendfeed provides client libraries for PHP development and their API is REST based.

However, on going through the PHP Client library i realized that they are not providing support for authenticated function calls in the library, That means anyone using their client library will not be able to use functionality of subscribing , unsubscribing and other user account specific authenticated calls. (Hope Friendfeed API developer guys are listening)

In the following tutorial i will list out all the functionalities friendfeed API support and will explain methods to call them from a PHP code.

Before we start talking about various API functionality , We need the understanding of CURL php library. To make things easier i used a PHP class Simple Curl Wrapper.
Continue reading Friendfeed API implementation in PHP