Bulk Email Script in PHP and MySQL Database

In this post, I will show you how we can send an email to multiple receivers using simple PHP script. This script also shows how we can send bulk if we have server limitation on number of emails can be sent in period of time.  Many web hosting provider do not support bulk emails so I have set this script to come out of this limitation.

This Bulk Email script can send HTML email. You can also use this script to send promotional and marketing emails.

In this tutorial we will create three files. First file is HTML content of email, second file is the actual code which sends emails to multiple address one at a time and third file is allowing receivers to unsubscribe from email list.



Replace “http://yourdomain.com/path-to-folder/” with your path to unsubscribe.php

You can set the cron job on sendmail.php on particular time frame. For example if you hosting provider support only 100 mail per hour than you can set cron job par hour and update the value here



Comment here if you have any queries. 

Find HCF and LCM in C Programming

C program to find HCF (Highest Common Factor) and LCM( Least Common Multiple): Today I will write a program on how to find HCF and LCM of two integers. HCF is also known as Greatest Common Divisor(GCD) or Greatest Common Factor(GCF).

Here there are three methods to find HCF and LCM in C Programming as follow:

  1. Find HCF and LCM using Loop
  2. Find HCF and LCM using Recursion
  3. Find HCF and LCM using Function

Find HCF and LCM in C Programming using Loop

Output of C Program:


Find HCF and LCM in C Programming using Recursion

Find HCF and LCM in C Programming using Function

Please comment if this code is useful to you or having any queries.

Factorial Program in C Programming

Factorial program in C Programming Language: C Program code to find and print factorial of a number.

Factorial can be achieved by three methods as follow:

  1. Factorial Program using loop,
  2. Program using a function to find factorial and
  3. Factorial Program using recursion.

Factorial is represented using ‘!’, so five factorial will be written as (5!), n factorial as (n!). Also n! = n*(n-1)*(n-2)*(n-3)…3.2.1 and zero factorial is defined as one i.e. 0! = 1.

Factorial program in C Programming using ‘for’ loop

Here we find factorial using ‘for’ loop.



Factorial program in C Programming using function

Here we find factorial using function.


Factorial program in C Programming using recursion

Here we find factorial using Recursion.

Recursion is a technique in which a function calls itself, for example in above code factorial function is calling itself. To solve a problem using recursion you must first express its solution in recursive form.

Please comment if this post is useful to you or have any queries.

Add, Subtract, Multiply and Division in C Programming Language

Write a program in C Programming to perform basic arithmetic operation like addition, subtraction, multiplication and division. C Programming Language comes with arithmetic operators. Operator we will use in the C Program are:

  • ‘+’ Addition
  • ‘-‘ Subtraction
  • ‘*’ Multiplication
  • ‘/’ Division

This operation can be performed on Integer, Float or Double Number. These are Data Types.


In c language when we divide two integers we get integer result for example 5/2 evaluates to 2. As a general rule integer/integer = integer and float/integer = float or integer/float = float. So we convert denominator to float in our program, you may also write float in numerator. This explicit conversion is known as typecasting.

Check Odd or Even Number using C Programming Language

Today I will show How can we check a number is odd or even in C Programming Language. We also use different method to identify even and odd numbers.

As we all know if we divide any number by 2 and the remainder is 0 (zero), then that number is Even, Otherwise its odd. We will use same logic here in C Programming. In C Programming we can get remainder by % (Modulus) operator.

For example of modulus operator, 3%2 gives 1 as remainder. Even numbers are in form of (2*x) and Odd numbers are in form of ((2*x)+1). Here ‘x’ is integer number.

Program 1: Check whether number is even or odd using modulus operator

We can also check the whether the number is even or odd using bitwise operator & (AND).

For example, Binary of 9 is 1001. When we perform 9 & 1, The result will be 1 and you may observe that the least significant bit of every odd number is 1, so ( odd_number & 1 ) will be always one and also ( even_number & 1 ) is zero.

Program 2: Check whether number is even or odd using Bitwise operator 


Program 3: Check whether number is even or odd using Conditional Operator (Without using ‘if’ Conditional Operator)

In C Programming Language when we divide two integers we get an integer result.

For example the result of 7/3 will be 2. We can take advantage of this and can use it to find whether the number is odd or even. Consider an integer ‘n’ we can first divide by 2 and then multiply it by 2 if the result is the original number then the number is even otherwise the number is odd. For example 11/2 = 5, 5*2 = 10 (which is not equal to eleven), now consider 12/2 = 6 and 6 *2 = 12 ( same as original number). These are some logic which may help you in finding if a number is odd or not.

Program 4: Check whether number is even or odd without using Modulus or Bitwise Operator


Setting Different Template/Design for Post per Category – WordPress

WordPress is providing various ways to set different template on category page but How about if I want to set different template for each category for Single Post Page.

Today I will show how can we achieve this with simple code in single.php

First We need to create single post template for various categories as follow

Above three files i create because i want to use different single post page template for my music, SMS, and news category respectively. You can create as much file as you can

You can simply create copy of your single.php file and rename it with new template and do the changes that you want for each category single page.

After that open your single.php file remove all code and add following code.

Please comment here if this post is help to you or you have any queries.


Find Distance in km and Miles from latitude and longitude value in PHP

I was wondering How can I find distance between two places using latitude and longitude in PHP. Today I will show you How easily we can calculate the distance between to places in Kilometer and Miles. The example here, takes two values for each place ( latitude and longitude ).

Lets create form to accept latitude and longitude value.


Function to find the distance is as follow:

This function accept one parameter which is not mandatory. To get the result in mile pass ‘miles’ as parameter. Otherwise it returns result in kilometer.

Comment here if you have any queries.

Live Demo Here


CallServer FormAPI – Teamsite

What is CallServer in FormAPI – Teamsite?

FormAPI is client-side technology. The user scripts that the template designer writes are loaded into the browser and executed by its JavaScript engine. There are many times, however, when code in the user script needs to access resources on a remote server.

Most commonly, the user script needs to run a database query and use the results to set the value of an item. The canonical example is the address entry form that automatically populates the city and state fields after the user has entered the ZIP code. There is no way the user script can include the entire city/state/ZIP database in the code; that information is best obtained from a server.

In Interwoven Teamsite, CallServer is method to make an HTTP request with a set of attributes-value pairs. The request may take the form of either an HTTP POST or an HTTP GET call. The target server (which can be any process that can handle an HTTP request and make a response, such as a servlet or CGI) reads the request and returns JavaScript code embedded in an HTML page. This page is loaded into a hidden frame, distinct from the frame that contains the user script and FormAPI. FormsPublisher provides a special parent.getScriptFrame() function to this hidden frame that returns the user script frame. In this way, the code returned by the server coexists with the user script and has full access to its methods and data.

The callServer() method is asynchronous. A new thread is started with the HTTP request and completes only when it finishes executing the code returned by the server. The user script code that made the request continues executing immediately after the call to callServer(). For this reason, callServer() is usually the last line of code in an event handler; the logic “picks up” in the hidden frame after the post is complete.

Here is an example illustrating a typical city/state/ZIP code form:


The fillCityState() handler is a function that queries a remote server for city and state:


The result from a call to the server (which will be given the request like http://myserver/
getCityState?zip=94086) returns code similar to this:


One of the hazards of making a remote server request is that it may take too long to return. Worse, it may not return at all. To guard against this problem, a user script can use the JavaScript setTimeOut() function to handle a request that does not return within a specified amount of time. Before it calls the server, setTimeOut() is instructed to execute an error handler function. The code that returns from the server cancels the pending error handler call (if it is running, the request succeeded). If the server does not return in time, the error handler is executed.

Adjust the user script fillCityState() function to set up the time out:


Create a callServerFailed() function to handle the error case:

Finally, modify the JavaScript returned from the server to cancel the time out:

This does not handle the case where the server is not down, but simply slow. In this case, after one minute the user is prompted that the ZIP code lookup failed, but several moments later may suddenly see the city and state fields automatically change. To guard against this possibility, modify the callServerFailed() function to cancel the server call:

This request cancels the previous request by making a new one to an empty file. This illustrates an important point about the callServer() method: only one call can be active at a time. Subsequent calls to callServer() will cancel any previous calls.

Important Note:

  1. Use only one CallServer method in Form init for setting initial values in form. To set on init Handler see below code: IWEventRegistry.addFormHandler(“onFormInit”, init);
  2. If on any event you want to set data to more than one element, do not use two call server. Use only one CallServer Method to set all the dropdown.
  3. Above shown is the first way to set the data to elements. Another way to set elements is to set data in array variable and print it on the page in script tag. See below code in perl.

Please comment here if you have any queries or suggestion. I will be posting on generalization of CallServer Method for all the template.

Inline Callout in Autonomy Interwoven Teamsite

<inline>: Provides a method for making server-side inline callout programs that return multiple XML elements to the data capture form. It is like include method in any other anguage.

Syntax of  inline callout in Teamsite:

Example of inline callout in Teamsite:

The inline callout program should return a well-formed XML document. The document’s outermost element should be a <substitution> element. It should contain any XML that is valid according to datacapture.dtd. That <substitution> element will contain six <option> elements as follow

This simple callout outputs a static result. A more sophisticated callout program could query a database and return the query results as <option> elements. When a server-side inline callout program is executed, it inherits the following  environment variables:„

  • IW_DCT: The server-inclusive vpath to the datacapture.cfg in use (for example, //servername/default/main/development/WORKAREA/username/templatedata/press/events/datacapture.cfg).
  • „IW_ROLE: The role of the current data capture user (for example, editor).
  • IW_USER: The domain and full user name of the current templating user (for example, domain\username).
  • „ IW_WORKAREA: The vpath to the current workarea (for example, //servername/default/main/development/WORKAREA/username).

The exit status from a server-side inline callout should be 0 to indicate a successful execution. Normally an inline callout should not return a non-zero value. However, an example where a non-zero value may be needed to indicate an error condition is if you are populating a <select> menu by making a database query and the database is offline. Rather than displaying a form with no choices, you may prefer an exception be displayed.

Calling Perl file Using inline command:

Here first we need to pass the commnad that execute the perl file code and second is the path to the perl file to be executed. Perl file should return well-formed XML as per above example. Perl file can return any number of example.

Getting passed parameter value in perl variable:

You can set first parameter value to perl variable as follow

Second Parameter as

Like this you can get any number of parameter passed using $ARGV.

You can get IW Home, IW Mount, Current Workarea path and DCT Path as follow:

You can extract Server, Store, Branch, Workarea name, Category and Datatype in one line code as follow:

Please comment if this information is useful to you or any you have any queries.

Whatsapp Alternatives (Other Options)

Few months before, I bought a new android mobile and started using many apps for free. It is really great experience using android mobile. Whatsapp is really nice app to chat with friends using data line, it supports sharing photos, videos and audio. It have some nice features to broadcast messages, group chat etc.

Some of the available alternates for Whatsapp are as follow. Use which ever you like, Invite your friends and Enjoy free chatting and sharing.

eBuddy XMS:

eBuddy Messenger is even the very popular Social Media Chat application and this eBuddy XMS not only just a chat application but you can even share Photos, video and emoticon. The XMS allows you to stay connected with friends, family and other who are in your contact list.

Download it from Google Play.


ChatPlus is an  Android chatting service which allows you to chat with your friends easier and more enjoyably in various way. By fast and correct push notification, you can exchange not only text messages but also photos,videos and voice, locations and handwrites without having to pay for that. And also ChatPlus supports a language translation and posting to Twitter and Facebook. In addition, ChatPlus provides a group chat and mass broadcast.

Download ChatPlus for Android.


GroupMe allows you to manage Groups and add your contacts from Social Media too.  In Group me you can send and receive messages using your data connection and in case if you have a poor connection, the app can switch you to SMS so you’ll never miss a message. The Location System in GroupMe is unique and it will show you all member’s who resides on Group on Map, Great !

Download GroupMe for Android:


ChatOn App from Samsung is giving a strong competition to WhatsApp because of it’s Manufacturer and obviously cause of it’s features too. You can chat to your Buddies via personal chat or group chat and can easily share the Pictures, Videos and other Multimedia Formats. You can view all share of multimedia content on ChatOn through one simple option called Trunk.

Download ChatOn for Android:


Viber is an application for that lets you make free phone calls to anyone that also has the application installed. When you use Viber, calls and text messages to any other Viber user are free, and the sound quality is much better than a regular call. You can call or text any Viber user, anywhere in the world, for free. All Viber Features are 100% FREE and do not require any additional “in application” purchase.

Download Viber for Android:

Kik Messenger:

Kik Messenger lets you make free messages like Whatsapp. Kik Messenger is not using phone number as identity user has its own identity on Kik messenger. It is fast, better graphics and organization of conversations and contacts, Finds contacts from your existing contact list (just like whatsapp) and completely free.

Download Kik Messenger for Android:


hike is a new messenger that lets you send free messages to your friends and family! With hike you can message friends that are on hike and also those who aren’t on hike too! You’ll never have to use another messaging app again. Better yet, it’s absolutely free!  It also support photos, Video and Audio sharing. It supports group messages.

Download hike for Android:

So here ends our list of WhatsApp alternatives (Other Options) for Android, if you liked this list, please share it on your social network profiles, If you would like to suggest any app our readers or would like to improve this list, please do let us know in comments section below.