How to Send Email using Mailgun PHP API

1. Create an account at, you would get API Key and a sandbox domain for testing. You shall later add your custom domain too.

2. Create a sample project folder and install Composer. mailguntest is out project name, you can change as per your requirement.
>mkdir mailguntest
>cd mailguntest
>curl -sS | php

Once Composer is installed, add Mailgun PHP API / library too.
>php composer.phar require mailgun/mailgun-php:~1.7.1

I have used version 1.7.1, you can use any. see for details.

3. In mailguntest folder, create mailer.php file with below contents:
Update the code as per your mailgun code settings:

require 'vendor/autoload.php';
use Mailgun\Mailgun;
$mg = new Mailgun("write your API key here");
$domain = "write-your-sandbox-domain for testing";

$mg->sendMessage($domain, array(
'from' => 'postmaster@write-your-sandbox-dom…

adsys schema

CREATE TABLE `ads` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `price` float DEFAULT NULL, `category_id` mediumint(9) DEFAULT NULL, `mobile_no` varchar(255) DEFAULT NULL, `condition` varchar(255) DEFAULT NULL, `picture_file_name` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `categories` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Make Single Page Web Application using JavaScript and AJAX - Practice Task

Above is User Interface of how your application shall look alike. Make a web page using HTML/CSS (you may use Bootstrap) and JavaScript. When user fill the form and press 'add' button, the record shall be added in the table given at left side. Action column contains Update and Remove links, "Update" shall load the record in form, shown at right. When user update the values and press 'update' button, it shall update the corresponding row in the left table. Initially, when the page is loaded, the table shall be empty and "Update" button shall be disabled. When user click the "Update" link in a row, "add" button shall be disabled. "Reset" button shall reinitialize the form at the same state when the page was loaded, to add new records. You are supposed to code above listed features using JavaScript (without refreshing the page).

At top of above created page, add a checkbox labeled "Sync with Database&q…

How to Create and Remove Cookies in PHP Web Applications and How Do They Work

First I explain basic idea of cookies in web applications and how they work. Then, I have listed code samples to create, read and remove cookies in PHP with brief description of each. Its written in right flow, first things are explained first. And no need to read in one sitting, take breaks but absorb as you read.
What are Cookies Basically, a cookie is data in the form of key value pair (e.g. city=Lahore) that is stored in browser's temporary memory. Cookies are created at web browser on the instuction of web server. Once some cookies are created in web browser by a web application, when user send new requests to same web application, all existing cookies are automatically added in HTTP request by the web browser. So the data stored by web developer in user browsesr (in the form of cookies), automatically reaches back at server in new requests.

When web server send instruction to create a new cookie, it also send cookie expiry time to browser (or default time is used, explained …

How to Use Sessions in PHP Web Applications

How does session work in web applications, covers basic concepts of session management. If you are new to web sessions, you should read that post first.

This article follows code centric approach i.e. it contains different code samples with brief description. It covers: how to create a session in PHP, how to put some data in session, how to get data from session, how to remove specific data element from session or all of the session data at once. Consider it a reference article of code samples of PHP Sessions.
How to Create New Session in PHP The below PHP file i.e. create_session.php creates new session at web server when the page is accessed from browser. session_start() method is used to create a new session. When session is created, a unique session ID is generated, we can read the value of session ID by calling session_id() function.

Server send the generated session ID to browser where it is stored as cookie, named PHPSESSID. When user send another request, browser automatically…

Create a Simple E-Commerce Store - Assignment 2

Create a simple e-commernce store to practice different concepts of web programming we discussed in class e.g. Bootstrap, form handling, files handling, sessions, cookies, database connectivity etc. E-commerce stores are used to sell products. The end product shall have Bootstrap based UI, so feel free to use a free Bootstrap theme. From functional perspective, your assignment shall look something like this: (UI shall be better)
The store shall have at least following functionalities: Use bootstrap 4 for layout and different page components e.g. forms, panels, cards, etc.It shall allow users to register, login, logout, change password, and edit profile. Use any basic attributes.After admin is login, admin (user type) shall add new products and categories. Let admin to update and delete both entities. Category shall have only name and id. Products shall have title, description, price, in-stock, and category_id fields. Let admin to upload maximum 4 pictures of…

Submit Web Technologies' Semester Project Proposals

Nature of Project for Web Technologies CourseYou would develop a web based system, application or proof of concept code samples (depending on nature of the semester project you choose). The project include, but not limited to, following types:
Develop a Management Information System (MIS) e.g. accounts management system, fleet management, school management system, assets management system, application processing system, sale management systems, pathology management system, etc. If if you select such MIS, make sure it contains at least 12 to 15 tables and there are at least 8 usecases per group-member.The project may be a web or mobile product based on your unique business idea that would deliver some unique value to users if you launch it. In this case, there may be less number of use cases and database tables, but you have to justify its uniqueness in your proposal explaining market need, other competitive products and how your idea or product is unique or why user would use it.It m…