Skip to content

Instantly share code, notes, and snippets.

View eboominathan's full-sized avatar
🎯
Focusing

Boominathan Elango eboominathan

🎯
Focusing
View GitHub Profile
<?php
$user_ip = getenv('REMOTE_ADDR');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$country = $geo["geoplugin_countryName"];
$city = $geo["geoplugin_city"];
?>
@eboominathan
eboominathan / Address autocomplete from google
Created April 22, 2016 06:44
Address autocomplete from google
<input type="text" name="address" placeholder="Address" id="autocomplete">
<script src="https://maps.googleapis.com/maps/api/js?signed_in=true&libraries=places&callback=initAutocomplete"
async defer></script>
<script>
// This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.
@eboominathan
eboominathan / ajax.php
Created March 7, 2016 01:48
Ajax code to submit form in Codeigniter
$('#submit').click(function(){
var formData = new FormData($('#form')[0]);
$.ajax({
url: '<?php echo base_url();?>controller/method',
type: 'POST',
data: formData,
async: false,
success: function(data) {
@eboominathan
eboominathan / Sum the time in php
Created January 14, 2016 05:21
Sum the time in php
function AddPlayTime($times) {
foreach ($times as $time) {
$all_seconds='';
list($hour, $minute, $second) = explode(':', $time);
$all_seconds += $hour * 3600;
$all_seconds += $minute * 60;
$all_seconds += $second;
}
@eboominathan
eboominathan / camera.html
Created January 6, 2016 08:58 — forked from dhavaln/camera.html
Phonegap Camera Capture Example
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"/>
<script type="text/javascript" charset="utf-8" src="js/phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
@eboominathan
eboominathan / wednesday_only.php
Created January 2, 2016 04:55 — forked from anonymous/wednesday_only.php
Insert only wednesday of the year
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
@eboominathan
eboominathan / Pagination.php
Created December 25, 2015 12:24
Pagination in javascript
<script type="text/javascript">
$('table.paginated').each(function() {
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
$table.bind('repaginate', function() {
$table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
});
$table.trigger('repaginate');
var numRows = $table.find('tbody tr').length;
@eboominathan
eboominathan / country_state_city.sql
Created December 13, 2015 09:59
Country,State.City Master
This file has been truncated, but you can view the full file.
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 13, 2015 at 10:50 AM
-- Server version: 5.6.21
-- PHP Version: 5.5.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@eboominathan
eboominathan / Lbs.php
Created October 12, 2015 09:31 — forked from amrishodiq/Lbs.php
PHP Code Igniter library class to get latitude & longitude, get address for specified latitude & longitude, get direction from one place to another place, and so on. Most LBS concept I implemented with PHP.
<?php
/**
* Written by Amri Shodiq.
* Do not hesitate to copy and paste this code.
* It's not embarassing.
*/
if (!defined('BASEPATH'))
exit ('No direct script access allowed');
<?php
include 'include/connect.php';
$tableqry = "SELECT image,maincat_name,php_name FROM tblmaincategories ";
$num_rows = mysql_num_rows(mysql_query("SELECT image,maincat_name,php_name FROM tblmaincategories "));
$result = mysql_query($tableqry);
?>
<html>
<head>
<meta charset="utf-8">