Wednesday, 16 July 2014

auto generate password in php

function randompassword( $length = 8 ) {
    $passchar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
    $password = substr( str_shuffle( $passchar ), 0, $length );
    return $password;
}

$password = randompassword(8);

Sunday, 6 July 2014

file upload on click and get image

<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Anil Demo </title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
  <input type='file' onchange="GetUrl(this);" />
    <img id="anil" src="#" alt="Get Your Image" />
</body>
<script>

 function GetUrl(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#anil')
                        .attr('src', e.target.result)
                        .width(150)
                        .height(200);
                };

                reader.readAsDataURL(input.files[0]);
            }
        }
</script>
</html>

Friday, 4 July 2014

India State And City List In csv and xls File

download file csv and xls


Insert Data in mysql with csv file

<?php

 mysql_connect('localhost','root','');
mysql_select_db('Databasename

Tuesday, 24 June 2014

Display day month and current time through javascript

      <script type="text/javascript">
tday  =new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
tmonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");

function GetClock(){
d = new Date();
nday   = d.getDay();
nmonth = d.getMonth();
ndate  = d.getDate();
nyear = d.getYear();
nhour  = d.getHours();
nmin   = d.getMinutes();
nsec   = d.getSeconds();

if(nyear<1000) nyear=nyear+1900;

     if(nhour ==  0) {ap = " AM";nhour = 12;}
else if(nhour <= 11) {ap = " AM";}
else if(nhour == 12) {ap = " PM";}
else if(nhour >= 13) {ap = " PM";nhour -= 12;}

if(nmin <= 9) {nmin = "0" +nmin;}
if(nsec <= 9) {nsec = "0" +nsec;}


document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
setTimeout("GetClock()", 1000);
}
window.onload=GetClock;
</script>
<div id="clockbox" style="width:600px;position:fixed;margin-top:39px;margin-left:990px"></div>
                    </div>
                    <!--/.nav-collapse -->
                </div>
            </div>
        </div>
        <br>

Tuesday, 25 March 2014

Thursday, 13 March 2014

Beginner questionfor html


Every .html page we create requires tags to start and end html file an recognize it as a html file.
But even when I don't give any HTML tags and simply write a text in .html file, the file gets opened in the browser with the text I have written in the .html file without using any of the HTML tags.
How is the text getting displayed in the browser without using any HTML tags?
Does the browser automatically add HTML tags behind the scenes??
When I viewed the page source in that also it shows simply the text not the HTML tags...

Thursday, 6 February 2014

Adding image in dropdown select box

<option style="background-image:url(../flags/ad.png);background-repeat: no-repeat; float:left;">abc</option>