get utm paramater from url in javascript



UTM paramaters are widely used in adcampaigns to check sources are traffice. google ads and other ads send a parameters, such as utm_source, utm_medium, utm_campaign in urls.

Some of the utm paramaters are as follows:-
1) Campaign Source (utm_source) – Required parameter to identify the source of your traffic such as: search engine, newsletter, or other referral.
2) Campaign Medium (utm_medium) – Required parameter to identify the medium the link was used upon such as: email, CPC, or other method of sharing.
3) Campaign Term (utm_term) – Optional parameter suggested for paid search to identify keywords for your ad. You can skip this for Google AdWords if you have connected your AdWords and Analytics accounts and use the auto-tagging feature instead.
4) Campaign Content (utm_content) – Optional parameter for additional details for A/B testing and content-targeted ads.
5) Campaign Name (utm_campaign) – Required parameter to identify a specific product promotion or strategic campaign such as a spring sale or other promotion.

Simple code snippet to get get url paramater values for utm sources.

//function to get url paramaters
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

//variable to stor url values
var utmsource = getUrlVars()["utm_source"];
var utm_medium = getUrlVars()["utm_medium"];
var utm_campaign = getUrlVars()["utm_campaign"];

Similarly you can get all other valiables from url.

Mobile First Media Queries for Resposive sites



Today we will look into media queries. Many peoples are searching for media queries format on google, but many times they dont get proper solution . so i am sharing Media query structure which i follow while writing css. hope this will be useful for all of you.

A media query consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color. Media queries, added in CSS3, let the presentation of content be tailored to a specific range of output devices without having to change the content itself.

Which direction should you choose when writing the CSS for a responsive website?

1) Mobile First :-
Start with the CSS for narrow viewports , then increase viewport and add breakpoints when needed.

2) Desktop First :-
Start with the CSS for wider viewports , then decrease viewport and add breakpoints when needed.

Mobile First Structure is as follows

/*==========  Mobile First Method  ==========*/

/* Custom, iPhone Retina */
@media only screen and (min-width : 320px){
      /* Some CSS Here */
}

/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px){
      /* Some CSS Here */
}

/* Small Devices, Tablets */
@media only screen and (min-width : 768px){
      /* Some CSS Here */
}

/* Medium Devices, Desktops */
@media only screen and (min-width : 992px){
      /* Some CSS Here */
}

/* Large Devices, Wide Screens */
@media only screen and (min-width : 1200px){
      /* Some CSS Here */
}

All the best........


URL Rewriting using .htaccess in PHP



Benefits of Static url over Dynamic URLs
1. Static URLs typically Rank better in Search Engines.
2. Search Engines are known to index the content of dynamic pages a lot slower compared to static pages.
3. Static URLs are always more friendlier looking to the End Users.

What is the benefits of rewriting URL?
When a search engine visits the dynamic url like product.php?id=3 it does not give much importance to that URL as search engine sees ? sign treat it as a url which keeps on changing. so we are converting the dynamic URL like the product.php?id=3 to static url format like product-3.html. We rewrite the url in such a way that in browser's address bar it will display as a product-3.html but it actually calls the file product.php?id=3. So that why these kind of URL also named as SEO friendly URL.

What is required for URL rewriting ??
To rewrite the URL you must have the mod_rewrite module must be loaded in apache server. And furthermore, FollowSymLinks options also need to be enabled otherwise you may encounter 500 Internal Sever Error.

If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I've given five useful examples of URL rewriting using .htacess.

Examples of url rewriting for seo friendly URL
For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes as your requirement.

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]
The following example will rewrite the test.php to test.html i.e when a URL like http://localhost/test.htm is called in address bar it calls the file test.php. As you can see the regular expression in first part of the RewriteRule command and $1 represents the first regular expression of the part of the RewriteRule and [nc] means not case sensitive.

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$1
The following example will rewrite the product.php?id=5 to porduct-5.html i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically.

SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.

RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
If you like to do like http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
Suppose the you've redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*) /new/$1

Hope this post will be helpful as other posts.

Parameter passing to CURL GET Request



This is simple example to pass parameters to php curl get method

<?php

    /* Script URL */
    $url = 'http://www.example.com/abc.php';

    /* $_GET Parameters to Send */
    $params = array('param1' => 'value1', 'param2' => 'value2');

    /* Update URL to container Query String of Paramaters */
    $url .= '?' . http_build_query($params);

    /* cURL Resource */
    $ch = curl_init();

    /* Set URL */
    curl_setopt($ch, CURLOPT_URL, $url);

    /* Tell cURL to return the output */
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    /* Tell cURL NOT to return the headers */
    curl_setopt($ch, CURLOPT_HEADER, false);

    /* Execute cURL, Return Data */
    $data = curl_exec($ch);

    /* Check HTTP Code */
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    /* Close cURL Resource */
    curl_close($ch);

    /* 200 Response! */
    if ($status == 200) {

        /* Debug */
        var_dump($data);

    } else {

        /* Debug */
        var_dump($data);
        var_dump($status);

    }

?>

Black Beauties for Techies

Today I am listing some of the black beauties of tech world. which every techies dream to buy. For me Black is a color of new technology and gadgets. Every year the Black Friday online circulars hit the Web and lots of sites round up every tech deal under the sun. Some of the big giants like Apple and Amazon comes with lots of offers on "Black Friday shopping event".

Following are Some of Gadgets actually worth getting excited.


1) iPhone 5s


1) iPhone 5s is the first 64‑bit smartphone in the world. And iOS 7 was designed with that in mind, built specifically for 64‑bit architecture.
2) Beautiful industrial design and superb build quality is matched with a phone that feels almost impossibly thin and light.
3) This is the fingerprint scanner that sits under the surface of the Home button. 
4) 4-inch IPS 1,136 x 640 pixel screen
5) iOS 7 was the biggest update to the system since its birth back in 2007.  It made the OS look and feel more modern, with a new design and better-looking screen transitions.
6) 64-bit dual-core 1.3GHz Apple A7, 1GB RAM, PowerVR G6430 GPU
7) 8-megapixel camera, 1/3.2-inch sensor, dual-LED ‘true tone’ flash

2) Apple iPad mini 2 Retina

1) The 7.9 inch IPS display. 2,048 x 1,536 pixels with a stunning 324 pixels per inch (ppi)
2) 64-bit A7 system-on-chip processor and 1GB RAM
3) Come with IOS 7
4) 5MP rear camera5) bigger battery, from 16.3 Wh to 23.8 Wh



3) MacBook Pro


1) OS X Mavericks. The world's most advanced desktop operating system.
2) Thin. Light. Powerful. There’s innovation in every nanometre.
3) With fourth-generation dual-core and quad-core Intel processors
4) Every new MacBook Pro comes with better-than-ever versions of iPhoto, iMovie, GarageBand, Pages, Numbers and Keynote.
5) the latest graphics, PCIe-based flash storage, 802.11ac Wi‑Fi


4) Nikon D5300 DSLR Camera


1) 24.2-megapixel DX-format CMOS sensor with the optical low pass filter (OLPF) removed to improve clarity and detail in images
2) 3.2-inch vari-angle LCD screen
3) capable of capturing images at a 5fps rate
4) built-in Wi-Fi, the Nikon D5300 can transmit images and videos to any iOS and Android smartphone or tablet
5) GPS function, images can also be geotagged


5) Xbox One with Kinect 2.0



1) Advanced motion sensor
2) Voice commands
3) come with a full 1080p RBG camera for HD detection that may help with facial recognition
4) Xbox One takes on set top TV boxes
5) Multitasking
6) HDMI-IN PORT


6) Programming Black Book collection




This is Specially For Computer Programmers. Black books is a awesome book series from DreamTech Publication. This books are solid introduction, written from the programmer s point of view that contains hundreds of examples covering every aspect of programming languages.
Some of the Black books are as Follows.
i) Java 6 Programming Black Book
ii) C, C++, C# Programming
iii) Java Server Programming JAVA EE 7
Read more: - http://www.dreamtechpress.com/

Hope you will like this post. Please Comment Your Suggestions to improve this blog contents.
Thank You.

force download file using php



By default most of the file types (eg: txt, jpg, png, gif, html, pdf, etc.) displayed in browser instead of download. But we can force browser to download these files instead of showing them.This tutorial goes over how to force file download in php.

<?php
   //file path to download
    $file_name=$_GET['file'];
    $outputfilename = "<DOWNLOAD_FILE_NAME>";
    header('Content-Description: File Transfer');
    //set content type
    header('Content-Type: application/octet-stream');
    //file name to save it may be different from original filename
    header("Content-Disposition:  attachment; filename=\"" . basename($outputfilename) . "\";" );
    //sends file size header to browser
    header('Content-Length: ' . filesize($file_name));
    header('Content-Transfer-Encoding: binary');
    header('Cache-Control: public');
    header('Pragma: public');
    ob_clean();
    //outputs file content to download stream
    readfile($file_name);
    exit;
?>

Add Google Plus Share Button to your site



Simple Tutorial to Create Google Plus Share Popup Window.

function shareongplus()
{
 var url2='https://plus.google.com/share?url='+encodeURIComponent("<URL_TO_SHARE>")+'&title='+encodeURIComponent('<TITLE_OF_SHARE>');

    newwindow=window.open(url2,'<TITLE_OF_POPUP>','height=450,width=650');
    if (window.focus) {newwindow.focus()}

}

Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.

Import csv file in mysql using php


This tutorial will go over how to import CSV ( comma separated value ) file data into Mysql Database using Php . 

CSV file is should be like below



<!-- form to submit csv file -->
<form enctype="multipart/form-data" method="post" role="form">
    <div class="form-group">
        <label for="exampleInputFile">File Upload</label>
        <input type="file" name="file" id="file" size="150">
        <p class="help-block">Only CSV File Import.</p>
    </div>
    <button type="submit" class="btn btn-default" name="Import" value="Import">Upload</button>
</form>


//php code to process csv file and store data into mysql database
<?php
if(isset($_POST["Import"]))
{
    //First we need to make a connection with the database
    $host='localhost'; // Host Name.
    $db_user= ''; //DB User Name
    $db_password= '';  //DB Password
    $db= ''; // Database Name.

    //Create connection with databse
    $conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error());
    mysql_select_db($db) or die (mysql_error());
    echo $filename=$_FILES["file"]["tmp_name"];

    if($_FILES["file"]["size"] > 0)
    {
        $file = fopen($filename, "r");
$count = 0;
        while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
        {
$count++;
                        // ignore first row for column names
if($count>1)
{
                                //insert into database
$sql = "INSERT into demo1(id,name) values ('$emapData[0]','$emapData[1]')";
mysql_query($sql);
}
        }
        fclose($file);
        echo 'CSV File has been successfully Imported';
    }
    else
        echo 'Invalid File:Please Upload CSV File';
}
?>

Export MS SQL SERVER data in MS Excel using php



This tutorial will go over how to download MS SQL Server data into Excel file. This is Very useful for generating Excel Reports of Php and MS SQL Server Applications. 

<?php
$myServer = "host_name";
$myUser = "user_name";
$myPass = "password";
$myDB =  "database_name";

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection") or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database
$query = "SELECT col1, col2, col3, .... , coln FROM table_name";

//execute the SQL statement and return records
$rs = $conn->execute($query);

$num_columns = $rs->Fields->Count();
//echo "col:".$num_columns . "<br>";

for ($i=0; $i < $num_columns; $i++) {
    $fld[$i] = $rs->Fields($i);
}

$contents="<table border='1'>";

while (!$rs->EOF)  //carry on looping through while there are records
{
    $contents.="<tr>";
    for ($i=0; $i < $num_columns; $i++) {
        $contents.="<td>" . $fld[$i]->value . "</td>";
    }
    $contents.="</tr>";
    $rs->MoveNext(); //move on to the next record
}

$contents.="</table>";

$file="File_name.xls";
$test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=File_name".date('Y-m-d').".xls");
echo $contents;

//close the connection and recordset objects freeing up resources
$rs->Close();
$conn->Close();

$rs = null;
$conn = null;
?>

Display MS Sql Server Data using PHP



This tutorial will go over how to Display MS SQL Server datausing PHP.

<?php
$myServer = "host_name";
$myUser = "user_name";
$myPass = "password";
$myDB =  "database_name";

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection") or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database
$query = "SELECT col1, col2, col3, .... , coln FROM table_name";

//execute the SQL statement and return records
$rs = $conn->execute($query);

$num_columns = $rs->Fields->Count();
//echo "col:".$num_columns . "<br>";

for ($i=0; $i < $num_columns; $i++)
{
    $fld[$i] = $rs->Fields($i);
}

echo "<table>";

while (!$rs->EOF)  //carry on looping through while there are records
{
    echo "<tr>";
    for ($i=0; $i < $num_columns; $i++) {
        echo "<td>" . $fld[$i]->value . "</td>";
    }
    echo "</tr>";
    $rs->MoveNext(); //move on to the next record
}

echo "</table>";

//close the connection and recordset objects freeing up resources
$rs->Close();
$conn->Close();

$rs = null;
$conn = null;
?>

Add a Pinterest button to site





Another Simple Tutorial to Add a Pinterest button to site.

Pins are like little bookmarks. Whenever you find something on the web that you want to keep, add it to Pinterest. If your site have multiple images and you want give facility to users to bookmark this images for later use. you can use this Pinterest plugin.

Steps to Add Pinterest Button to site.

1) Add following pinterest script to your site.

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

2) Create pin it button using simple Anchor Tag.

<a href="//www.pinterest.com/pin/create/button/?url=<SITE_URL>&media=<IMAGE_TO_PIN_IT>&description=<DESCRIPTION_TO_SHARE>" data-pin-do="buttonPin" data-pin-config="above"  target="_blank"><img src="images/btn_pinit.png" class="shares" ></a>

Its done. :)

for more information visit:- http://business.pinterest.com/widget-builder/#do_pin_it_button

Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.

Send Facebook Notification via Graph API using PHP



function fbnotification($userid,$message)
{
$app_id = "<APPLICATION_ID>";
$app_secret = "<APPLICATION_SECRET_KEY>";
$app_access_token = $app_id . '|' . $app_secret;

$facebook = new Facebook(array(
'appId'  => $app_id,
'secret' => $app_secret,
'cookie' => true,
));

$response = $facebook->api( '/'.$userid.'/notifications', 'POST', array(
'template' => $message,
'access_token' => $app_access_token
) );  
}

fbnotification($userid,$message)

Add LinkedIn Share Button




Simple Tutorial to Create LinkedIn Share Popup Window.

Sharing Any article on linkedin via your site or a web page is very simple. just follow below simple steps. linkedpopup() functions create a popup window for sharing content.

function linkedpopup()
{
var url1='http://www.linkedin.com/shareArticle?mini=true&url=<LINK_TO_SHARE>&title=<TITLE_TO_SHARE>&summary=<DESCRIPTION_TO_SHARE>&source=<YOUR_WEBSITE_NAME>';
      newwindow=window.open(url1,'<TITLE_OF_POPUP>','height=450,width=650');
      if (window.focus) {newwindow.focus()}

}

Parameter List:--

Parameter

Character Limit Description
mini

4 Must always be true
url

1024 The permanent link to the article. Must be URL encoded
title

200 The title of the article. Must be URL encoded
source

200 The source of the article. Must be URL encoded. Example: Wired Magazine
summary

256 A brief summary of the article. Must be URL encoded. Longer titles will be truncated gracefully with ellipses.


for more information visit:- http://developer.linkedin.com/documents/share-linkedin

Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.

Twitter tweet button



Simple Tutorial to Create Twitter Share Popup Window.

tweetpopup() function helps your visitor to create popup for tweeting content and connect on twitter.

function tweetpopup() 
{
      var url2='https://twitter.com/intent/tweet?hashtags=<HASHTAG>&text=<TEXT_TO_TWEET>&url=<URL_TO_TWEET>&via=<HANDLE_FOR_TWEET>';

      newwindow=window.open(url2,<TITLE_OF_POPUP>','height=450,width=650');
      if (window.focus) {newwindow.focus()}

}

for more information visit:- https://about.twitter.com/resources/buttons#tweet

Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.

Add facebook share button




Simple Tutorial to Create Facebook Share Popup Window.

function facebookshare()
{
var url2='http://www.facebook.com/sharer.php?s=100&p[title]='+encodeURIComponent(' TITLE_OF_SHARE') + '&p[summary]=' + encodeURIComponent(' DESCRIPTION_TO_SHARE') + '&p[url]=' + encodeURIComponent(' URL_TO_SHARE ') + '&p[images][0]=' + encodeURIComponent(' IMAGE_TO_SHARE');
newwindow=window.open(url2," POPUP_WINDOW_HEADING",'height=480,width=680');
if (window.focus) {newwindow.focus()}

}

Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.

Export Mysql Table in XML using php



This tutorial will go over how to download Mysql Table into XML file. This is Very useful for generating XML Data files when you have to work with javascript to get data.

<?php
$conn = mysql_connect('localhost', 'user_name','password');
mysql_select_db('database_name');
$xml = '';

//query the db
$query = mysql_query("SELECT col1, col2, col3, col4 FROM TableName");
    $xml .='<main>';
//loop through query results
while ( $row = mysql_fetch_array ( $query ) )
{
 //Add to xml
$xml .= '<group>';
 $xml .= '<col1><![CDATA[' . $row['col1'] . ']]></col1>'; 
$xml .= '<col2><![CDATA[' . $row['col2'] . ']]></col2>'; 
 $xml .= '<col3><![CDATA[' . $row['col3'] . ']]></col3>'; 
$xml .= '<col4 ><![CDATA[' . $row['col4 '] . ']]></col4 >'; 
$xml .= '</group>';
}

    $xml .='</main>'; 

//Write to xml and override
$handle = fopen('data.xml', 'w+');
fwrite($handle, $xml);
?>

Note:- Please Assign 777 permission to folder to write file into it.

Simulating Pencil Tool in AS3



var drawing:Boolean = false;
this.graphics.lineStyle(1, 0x000000);
this.graphics.moveTo(mouseX, mouseY);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0,true);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp, false, 0, true);

function onDown(evt:MouseEvent):void
{
     drawing = true;
}
function onUp(evt:MouseEvent):void
{
     drawing = false;
}

function onLoop(evt:Event):void
{
     if (drawing)
     {
          this.graphics.lineTo(mouseX, mouseY);
     }
     else
     {
          this.graphics.moveTo(mouseX, mouseY);
     }
}

Get long lived access_token for facebook pages


Facebook API’s allows a developer to update a cover photo of a page through code. I am creating a Live Cover photo change App for One of the client. this apps mechanism is to change cover photo depending on the no of likes of page.

for such type of apps. you need a long lived access_token so you can run a script from server itself.

Following it the step-by-step process.

1)   Make Sure you are the admin of FB Page.
2)   Create a FB App with same user account.
4)   On the Top Right , Select the FB App you created from the "Application" drop down list.
5)   Click "Get Access Token" Button.
    Select Permission Window will open.
6)   Click on "Extended Permission" Tab and Check "manage_pages" permission
7)   type "me/accounts" in FQL Query Box.
    It show you complete listing of page details like category, name, access_token, permissions..
    This Access token is short-lived-token. you have to convert this short live token to long lived token.
8)   https://graph.facebook.com/oauth/access_token?client_id={fb_app id}&client_secret={fb_app_secret}&grant_type=fb_exchange_token&fb_exchange_token={short-lived-access_token}
9)   Grab the new long-lived access token.
10) Make A Graph API call to see your account using the new long-lived access token
      https://graph.facebook.com/me/accounts?access_token={your_long_lived_access_token}
11) Grab the access_token for the page.
12) You can use following link to https://developers.facebook.com/tools/debug/  to get Access Token Info. 
It will provide info like Application ID, Profile ID, User ID, Issued, Expires, Scopes etc.

This step-by-step process will give you Long Lived Access Tokens.


Multiple image format change using photoshop


This tutorial will go over how to Change format of multiple images at  once using Photoshop. This is also known as Bulk image format change in Photoshop(bridge).

If you want to convert image from one format to another, Photoshop and Photoshop Tools allow you to do this in just few minutes. For doing this process you requires Photoshop File Browser (or Adobe Bridge in CS3 or higher).

1) Open Photoshop.

2) click on "FILE" menu.


 3) Select "Browse in Bridge" option.
    A new window will open.
    In a "content" window select images you want to rename.

4) click on "Tool" Menu   


5) Hover "Photoshop" Menu.
    select "Image Processor" option.
    A new window will open
 
6) Select various options as per requirement like
    Destination folder,
    Image type,
    Copyright info 

7) Click on "Run" Button.
   
    Its done :)

Rename multiple images ( Batch Rename Files in Photoshop )



This tutorial will go over how to Rename multiple images at  once using Photoshop. This is also known as Batch Rename Files in Photoshop.

If you want to rename a series of files -- such as several pictures from a digital camera. Photoshop and Photoshop Tools allow you to do this in just few minutes. For doing this process you requires Photoshop File Browser (or Adobe Bridge in CS3 or higher).

1) Open Photoshop.

2) click on "FILE" menu.


 3) Select "Browse in Bridge" option.
    A new window will open.
    In a "content" window select images you want to rename.

4) click on "Tool" Menu


5) select "Batch Rename" option
    A new window will open

6) Select various options like
    Destination folder,
    New File Names
        You can use Text, Sequence number, date and time for names of files
    You can see preview in preview box.


7) Click on "Rename" Button.
   
    Its done :)

Export Mysql data in MS Excel using php



This tutorial will go over how to download Mysql data into Excel file. This is Very useful for generating Excel Reports of Php Applications, and database. 


<?php
      //database credentials
      $username = "user_name";
      $password = "password";
      $host = "host_name";
      $dbname = "database_name";

      //Connect to database      $connector = mysql_connect($host,$username,$password)
          or die("Unable to connect");
        //echo "Connections are made successfully::";


     //Select database
      $selected = mysql_select_db($dbname, $connector)
        or die("Unable to connect");

      //execute the SQL query and return records
      $result = mysql_query("SELECT col1, col2, col3 FROM tablename");

    $contents="<table border='1'><tr><th>COL1</th><th>COL2</th><th>COL3</th></tr>";
    while($row = mysql_fetch_array($result))
    {
        $contents.="<tr><td>".$row['col1']."</td>";
        $contents.="<td>".$row['col2']."</td>";
        $contents.="<td>".$row['col3']."</td></tr>";
       
    }
   
    $contents.="</table>";

//header to make force download the file
$file="Report.xls";

header("Content-type: application/vnd.ms-excel");
//.date() functions add current date to file name
header("Content-Disposition: attachment; filename=Report".date('Y-m-d').".xls");
echo $contents;

mysql_close($connector);
?>

Note:- When you run this script Force download of Excel file starts.

Disable right click on web page using javascript



This tutorial will go over how to DisableRight Mouse Click using javascript

<!-- turn off right click -->

<script language=javascript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script>

Note:- This only stops people from right clicking on your page and there is no real way to stop people from viewing your html, if someone is determined to see your code they will.