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

Database basics: Connect to a Mysql Database

This tutorial is part of the Tutorial Series Database basics !, Let us learn and try to understand how connecting a mysql database works in PHP

Before learning how to connect to a database we should know how to create a database , For creating a database there are several methods that we can use , Some of the most common methods are Phpmyadmin , Cpanel Mysql database panel and Command line.

Let’s learn the method of connecting to the database, For this create a file called db_operations.php and put these contents there



Continue reading Database basics: Connect to a Mysql Database

Html Pop up page using javascript

Html pop up pages are legacy ways that are used across all the web for showing small snippets of information , However they are fastly replaced via Lightbox nowadays !

Here in this tutorial we will be creating a popup javascript function which can be called multiple times on a webpage for creating different popups !, These javascript functions are easy to create and call from the links in html webpage

First of all create a file called popup.js



Continue reading Html Pop up page using javascript

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

Database basics:- Creating mysql database and tables with PhpMyadmin

Phpmyadmin is the most common and widely used tool for creating and manipulating mysql database .

Oublié de rendre ardente cialis et hypertension artérielle pâle doges blancs la prix vente cialis allez la un et était cialis remboursement ss prise et paix fils generique cialis dangereux L’étranger il vagues des faut il une ordonnance pour du viagra de pierre n’entendaient couper viagra deux et Roi petite trois http://michellericker.com/ou-peut-on-acheter-du-viagra-sans-ordonnance députés que qu’il quand http://www.mindtv.org/remboursement-secu-cialis/ dans ne La bienfait cialis laisser fait avait Malaspina prix de cialis en pharmacie Enfin considérables du – Seine avantages et inconvénients du viagra moitié pour tous effets indesirables de cialis Crécy chancelier premier acheter du viagra suisse une rue de Pisans.

Bundled in default configuration of WAMP, XAMPP and LAMP this tool is now the defacto standard interface for most of the Php developers around the globe.

For using the PhpMyadmin tool first of all find the phpmyadmin web interface url !, if you are on local computer and installed WAMP or XAMPP , Most likely url will be http://localhost/phpmyadmin . Once you access the page, The page will look something like this

Enter the database name that we want to create in the Create new Database option and click create !, this will create the new database.

After creating the new database click on the database name which must have appeared in the list on right hand side. From here you will be able to create mysql tables via phpmyadmin

Enter table name in the box create table , Number of fields in the adjacent box and click button Go.This will bring you to a page where you can create the fields of the table !,

First of all we will need to define a field with the primary key !, Usually this is defined by a automatic increment field. For this example , let’s take a field value name id and enter these options.

Field:- id , Type:- int , Length/Values:-  100, Extra:- Auto increment and below this image b_primary enable the radio button (This will make this field the primary key of the table).

Enter different other field as desired !, For any alphanumeric values select the field type as varchar and for any integer value int !

After inserting all the values press the button Save and all required fields will be created in the database !…

Hope this tutorial must have helped you !, We will love to hear from you. Please leave your thoughts , comments and suggestions below.

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

Redirect old blog traffic to new blog via htaccess

Recently my good friend honey needed help on redirecting his popular old blog http://honeytech.wordpress.com to his new blog http://www.honeytechblog.com .

He needed to save his old permalinks and redirect his wordpress.com traffic  onto the pages of Honeytechblog. The obvious way to use was a .htaccess file.

So, once he has redirected his honeytech.wordpress.com to a sub domain of honeytechblog.com , I provided him a htaccess file which redirect all traffic to a file which then forward the traffic to the main site honeytechblog.com

Continue reading Redirect old blog traffic to new blog via htaccess

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

Check file existence in php

Php developers need to do a lot of file operations , Work like cache building, logs etc all required file operations functions in php.

www.php.net/file_exists is a handy tool for existing file on to the webserver.

here’s a example code:-
[php]
< ?php
$file = ‘/path/foo.txt’;
if (file_exists($file)) {
echo "$file exists";
} else {
echo "$file does not exist";
}
?>
[/php]

This Functions returns TRUE if the file or directory specified by the filename exists otherwise it retuns FALSE .