Thursday, December 13, 2012

Auto Fill second input box js

Auto Fill second input box Java Scripts 




when you fill first  input box above second one fills automatically by using the Java Scripts bellow

<html>
<head>
<script type="text/javascript">
    function copy_data(val){
     var a = document.getElementById(val.id).value
     document.getElementById("copy_to").value=a
    }

    </script>
</head>
<body>
<input type="text" name ="a" id="copy_from" onkeyup="copy_data(this)"/>
<input type="text" name ="a" id="copy_to"/>
</body>
</html>

Thursday, December 6, 2012

Elapse time, cookies name and last visited, page load time Java Scripts



Elapse time, cookies name and last visited, page load time Java Scripts 


Following piece of java Scripts code will show you cookie name and the date of last visited the site.

<!DOCTYPE html>
<html>
<head>
<script>
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
  {
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}

function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function checkCookie()
{
var username=getCookie("username");
if (username!=null && username!="")
  {
  alert("Welcome again " + username);
  }
else
  {
  username=prompt("Please enter your name:","");
  if (username!=null && username!="")
    {
    setCookie("username",username,365);
    }
  }
}
</script>
<script type = "text/javascript">



var days = 730;
var lastvisit=new Object();
var firstvisitmsg="This is your first visit to this page. Welcome!";
lastvisit.subsequentvisitmsg="Welcome back visitor! Your last visit was on <b>[displaydate]</b>";

lastvisit.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1];
return'';
}

lastvisit.setCookie=function(name, value, days){
var expireDate = new Date();

var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}

lastvisit.showmessage = function() {
var wh = new Date();
if (lastvisit.getCookie("visitc") == "") {
lastvisit.setCookie("visitc", wh, days);
document.write(firstvisitmsg);
}

else {
var lv = lastvisit.getCookie("visitc");
var lvp = Date.parse(lv);
var now = new Date();
now.setTime(lvp);
var day = new Array("Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat");
var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var dd = now.getDate();
var dy = now.getDay();
dy = day[dy];
var mn = now.getMonth();
mn = month[mn];
yy = now.getFullYear();
var hh = now.getHours();
var ampm = "AM";
if (hh >= 12) {ampm = "PM"}
if (hh >12){hh = hh - 12};
if (hh == 0) {hh = 12}
if (hh < 10) {hh = "0" + hh};
var mins = now.getMinutes();
if (mins < 10) {mins = "0"+ mins}
var secs = now.getSeconds();
if (secs < 10) {secs = "0" + secs}
var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm
document.write(lastvisit.subsequentvisitmsg.replace("\[displaydate\]", dispDate))
}

lastvisit.setCookie("visitc", wh, days);

}

lastvisit.showmessage();

</script>
</head>
<body onload="checkCookie()">
</body>
</html>

Bellow codes of Java Scripts shows you elapse time stayed in a specific page as countdown timer 

<html>
<head>
<title>load</title>

<Script Language="JavaScript">

var startDate = new Date();
var startTime = startDate.getTime();

function seconds_elapsed ()
{
var date_now = new Date ();
var time_now = date_now.getTime ();
var time_diff = time_now - startTime;
var seconds_elapsed = Math.floor ( time_diff / 1000 );

return ( seconds_elapsed );
}

function time_spent ()
{

var secs = seconds_elapsed ();


var mins = Math.floor ( secs / 60 );
secs -= mins * 60;


var hour = Math.floor ( mins / 60 );
mins -= hour * 60;


document.display.timeElapsed.value = pad ( hour ) + ":" + pad ( mins ) + ":" + pad ( secs );


setTimeout( "time_spent ()", 1000 );
}

function pad ( num )
{
return ( ( num > 9 ) ? num : "0" + num );
}
</Script>
</head>

<body onLoad="time_spent()">

<form name="display">
<input name="timeElapsed" type="text" size=8>
</form>

</body>
</html>

Following codes are really php in which you can find the tame taken to page load. 

<html>
<head>
</head>
<body>
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Page generated in '.$total_time.' seconds.';
?>
<body>
<html>

Tuesday, December 4, 2012

HTML Save as word doc

HTML Save as word doc

HTML body content could be save as Microsoft word document by using PHP file as bellow including header information to save as word document.

<?php
  
header("Content-type: application/vnd.ms-word");
  
header("Content-Disposition: attachment; Filename=SaveAsWordDoc.doc");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">
<title>Saving HTML as a Word Doc</title>
</head>

<body>
<table border=1 align="center">
<tr><td>Name</td><td>Age</td></tr>
<tr><td>Mark Taylor</td><td>34</td></tr>
<tr><td>Oksana dassie</td><td>32</td></tr>
<tr><td>Oksana Babiac</td><td>38</td></tr>
<tr><td>karina kpoor</td><td>22</td></tr>
<tr><td>Alisa diction jonson</td><td>48</td></tr>
</table>
</body>
</html>

Friday, November 30, 2012

E-Money With Advertising

E-Money With Advertising 


This is a simple way of earning money from your site and also effective method.Here the advertisers come to your site automatically by implementing HTML codes of advertisers in your site.Then automatically advertisements will be displayed in your site.
                      If you have a site with good content and good traffic,You could be happy with continuous income   flowing to you .By this you can earn always even with away from your computer and even in sleeping.
I have listed bellow a few of best web advertisers.


Google Ad sense

Infolinks

BuySellAds

Chitika

Adbrite

Kontera

Bidvertiser

Clicksor



Thursday, November 29, 2012

E-Money With Web Affiliate

E-Money With Web Affiliate 


Affiliate marketing is a best way of earning money through internet.By introducing good and services through your web/blog site or through E-mail.you could earn  money according to your skills.Selecting goods or service which need to lot of people is very important.
                           First  you have to register the site where affiliate is provided.Then you will get rifer link or banner through which you can register the person interested with particular good or service.If the person registered to buy a good or service you will get 10%-25% commission from the sale.
                                It is very important to select good or service which  are good in market than same kind and low in  price.
Following are the best affiliate program links






  
 

Wednesday, November 28, 2012

e.money with adf.ly

e.money with adf.ly 



adf.ly is a site,which shares links and allow us to earn money.We could get $4 for 1000 visitors maximum.We can short the link from this site and release these shorten links to the cyber space. Shortened links are directed to advertisements and then redirected to original links allowing us to earn money from these adds.
start with registering free in  http://adf.ly


log in to your account and use shrink to shortened URL


Payments are high in amount with the click in United States,United Kingdom,Canada,Australia like countries.Payment for other countries you could find from
 The ways of getting visitors


01. Leave comments in blogs

02. Answer questions in genre related forums and blogs

03. Get yourself a Website or Blog

04. Put your band's video on YouTube

05. Join Twitter, start following, post what's happening

06. Join Facebook, start wall posting

07. Put your URL on everything
In addition to the above mentioned  facts you can start your own blogs and for your links in the blog you can add adf.ly links ex;- software down load page.and also you can upload YouTube videos and put adf.ly links.

Monday, November 19, 2012

PHP switch statement in user management

PHP switch statement in user management

php switch statement can be used in user management First create database table  as bellow

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(60) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(60) NOT NULL,
  `pass_word` varchar(60) NOT NULL,
  `user_type` varchar(40) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
Then create bellow HTML file

<form id="loginForm" name="loginForm" method="post" action="check_login.php">
            <label>Username</label><br>
            <input size="30" name="user_name" type="text"><br>
            <label>Password</label><br>
            <input size="30" name="pass_word" type="password"><br>
            <label>User Type</label><br>
            <select name="user_type">
                                <option value="1">User1</option>
                                <option value="2">User2</option>
                                <option value="3">User3</option>
                
                                <option value="3">User4</option>
                                <option value="4">User5</option>
                                </select><br>
            <input value="Submit" type="submit">
</form>
Then create check_login.php

<?php
 
    session_start();
 
 
    require_once('dbcon.php');
 
 
    $errmsg_arr = array();
 

    $errflag = false;
 
 
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if(!$link) {
        die('Failed to connect to server: ' . mysql_error());
    }
 
    //Select database
    $db = mysql_select_db(DB_DATABASE);
    if(!$db) {
        die("Unable to select database");
    }
 
 
    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return mysql_real_escape_string($str);
    }
 
 
    $user_name = clean($_POST['user_name']);
    $pass_word = clean($_POST['pass_word']);
   $user_type = clean($_POST['user_type']);
    //Input Validations
    if($user_name == '') {
        $errmsg_arr[] = 'Login ID missing';
        $errflag = true;
    }
    if($pass_word == '') {
        $errmsg_arr[] = 'Password missing';
        $errflag = true;
    }
   if($user_type == '') {
        $errmsg_arr[] = 'User Type missing';
        $errflag = true;
    }
    //If there are input validations, redirect back to the login form
    if($errflag) {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        session_write_close();
        header("location: login_form.php");
        exit();
    }
 
 
    $qry="SELECT * FROM users WHERE (user_name='$user_name' AND pass_word='".md5($_POST['pass_word'])."' AND user_type='$user_type')";
    $result=mysql_query($qry);
 
    switch($user_type){
case 1:
    //Check whether the query was successful or not
        if($result){      
    if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
            $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
          
            session_write_close();
            header("location: upload1.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
       break;
     
case 2:
    //Check whether the query was successful or not
 if($result){      
          if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
           $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
            session_write_close();
            header("location: upload2.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
     break;
   
case 3:
    //Check whether the query was successful or not
    if($result){      
    if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
           $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
          
            session_write_close();
            header("location: upload3.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
     break;
    
case 4:
    //Check whether the query was successful or not
        if($result){      
    if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
            $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
          
            session_write_close();
            header("location: upload4.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
       break;
     
case 5:
    //Check whether the query was successful or not
 if($result){      
          if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
           $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
            session_write_close();
            header("location: upload5.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
     break;
default:die("Query failed");
     exit();
    }
       
?>

Sunday, November 18, 2012

Olympic Games: Years and Location



Olympic Games: Years and Location


Since Modern Olympics began in 1896. Here are the host cities were held and scheduled up to 2020 every 4 years time it will be held.
  Summer Olympic
1896-Athens, Greece
1900 - Paris, France
1904 - St. Louis, United States
1908 - London, United Kingdom
1912 - Stockholm, Sweden
1916 - Scheduled for Berlin, Germany*
1920 - Antwerp, Belgium
1924 - Paris, France
1928 - Amsterdam, Netherlands
1932 - Los Angeles, United States
1936 - Berlin, Germany
1940 - Scheduled for Tokyo, Japan*
1944 - Scheduled for London, United Kingdom* 1948 - London, United Kingdom
1952 - Helsinki, Finland
1956 - Melbourne, Australia
1960 - Rome, Italy
1964 - Tokyo, Japan
1968 - Mexico City, Mexico
1972 - Munich, West Germany (now Germany)
1976 - Montreal, Canada
1980 - Moscow, U.S.S.R. (now Russia)
1984 - Los Angeles, United States
1988 - Seoul, South Korea
1992 - Barcelona, Spain
1996 - Atlanta, United States
2000 - Sydney, Australia
2004 - Athens, Greece
2008 - Beijing, China
2012 - London, United Kingdom
2016 - Rio de Janeiro, Brazil
2020 - Candidate host cities: Istanbul, Tokyo, or Madrid (host city to be selected September 2013)
Winter Olympic
1924 - Chamonix, France
1928 - St. Moritz, Switzerland
1932 - Lake Placid, N.Y., United States
1936 - Garmisch-Partenkirchen, Germany
1940 - Scheduled for Sapporo, Japan*
1944 - Scheduled for Cortina d'Ampezzo, Italy*
1948 - St. Moritz, Switzerland
1952 - Oslo, Norway
1956 - Cortina d'Ampezzo, Italy
1960 - Squaw Valley, California, United States
1964 - Innsbruck, Austria
1968 - Grenoble, France
1972 - Sapporo, Japan
1976 - Innsbruck, Austria
1980 - Lake Placid, New York, United States
1984 - Sarajevo, Yugoslavia (now Bosnia and Herzegovina)
1988 - Calgary, Alberta, Canada
1992 - Albertville, France**
1994 - Lillehammer, Norway**
1998 - Nagano, Japan
2002 - Salt Lake City, Utah, United States
2006 - Torino (Turin), Italy
2010 - Vancouver, Canada
2014 - Sochi, Russia
2018 - Pyeongchang, South Korea



Saturday, November 17, 2012

Popular PC Games

Popular PC Games


SimCity™


The defining city simulation is back! Create the city you desire and make the choices that shape your city and power the Sims within it. Every decision, big or small, has real consequences.
Invest in heavy industry and your economy will soar—but at the expense of your Sims’ health as pollution spreads. Implement green technology and improve your Sims’ lives while risking higher taxes and unemployment.
Team up with your friends to solve global challenges: launch a space shuttle, reduce carbon emissions, or build magnificent wonders. Compete on global and regional leaderboards to be the richest, the dirtiest, the happiest or the best place to visit!



STAR WARS™: The Old Republic™ 



Star Wars™: The Old Republic™ is the only massively-multiplayer online game with a Free-to-Play option that puts you at the center of your own story-driven Star Wars™ saga. Play as a Jedi, a Sith, a Bounty Hunter or as one of many other Star Wars iconic roles and explore an age over three-thousand years before the classic films. Become the hero of your own Star Wars adventure as you choose your path down the Light or Dark side of the Force™.
Along the way you will befriend courageous Companions who will fight at your side or possibly betray you based on your actions. Get ready to face powerful enemies in dynamic Star Wars combat as you team up with other players to overcome incredible challenges to save or control the galaxy!



Kingdoms of Amalur: Reckoning


Kingdoms of Amalur: Reckoning is an epic, open-world role-playing game set in Amalur, a mysterious and magical new fantasy world created by New York Times best-selling author R. A. Salvatore. Brought to life  visually through the trademark visceral style of renowned artist and Spawn creator Todd McFarlane, Reckoning brings a new level of intense action combat to the RPG genre.
The game is being developed under the leadership of Ken Rolston, lead designer of the critically acclaimed RPGs Elder Scrolls III: Morrowind and Elder Scrolls IV: Oblivion.

Grand Theft Auto V 

Rockstar Games has released the second GTA V trailer,Where GTA V does seem to offer something new is in the promise of expansive outdoor environments. With the series traditionally tied to urban areas, the possibility of a little more freedom is intriguing, as is the suggestion that the main character’s hobbies include hiking. That said, Rockstar would do well to focus on fundamentals: bringing GTA’s combat up to scratch, allowing us to interact with the environment more meaningful ways, and moving from the one-employer-at-a-time structure.

Metal Gear Solid: Rising 


Genre:Action, Stealth
Publisher:Konami
Developer:PlatinumGames
Metal Gear Rising: Revengeance is multi-platform action game and part of the Metal Gear series. The stealth elements from previous games have been removed and the setting has been changed. The game now centers around swordfighting and features an advanced cutting system.


 

Call of Duty: Black Ops II

it comes a new update to the Call of Duty Elite app for iOS. In addition to support for the latest game, the app brings an “all-new iPad experience,” which includes a new feature called Elite TV that allows you to live-stream Black Ops II gameplay and multiplayer guides.
As it did for Modern Warfare 3, the Call of Duty Elite app for iOS allows you to keep track of all kinds of gameplay statistics for Black Ops II, including summary stats, recent match stats, and a challenge tracker. It also allows you to customize your classes on the go so that they’re ready and waiting for you the next time you load up the game.
The update also brings a number of new features. One is called Clan HQ, which allows you to search and apply to clans; while the other is called Call of Duty Elite TV, and allows you to live-steam Black Ops II gameplay to your iOS device. It also offers multiplayer game guides, Staff Picks, and “much more.”





Rift: Storm Legion 


It’s a pretty impressively large expansion, literally tripling the size of the game world. Other new features include four new ‘Souls’ (read: subclasses), with powers including including flame-throwing, lightning-wielding, soul-linking and battlemages; a bunch of new dungeons and 2 new raids.
Also, bizarrely, they are making the fact that you can wear capes now a pretty major feature. Anyhoo, to celebrate the release of the new expansion, here is a trailer featuring some, if not all, of these things. Capes, at least. I know that’s what’s drawing you in, right? Right. Capes.

Lara Croft’s Tomb Raider reboot pushed back to 2013 

Players will want to "protect" an increasingly-battered Lara Croft in the upcoming Tomb Raider reboot, its executive producer has said.