Monday 22 September 2014

Automatic Logout after 15 minutes of inactive

<?php
     session_start
();
     
$_SESSION['session_time'] = time(); //got the login time for user in second
     
$session_logout 900//it means 15 minutes.
     //and then cek the time session
    
if($session_logout >= $_SESSION('session_time']){
        
//user session time is up
       //destroy the session
      
session_destroy();
     
//redirect to login page
     
header("Location:the-path-your-login-page.php");
    }
?>



















 

Saturday 13 September 2014

multiple textbox if click the button database based

multiple textbox if click the button database based

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Add input</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
function addInput(f) {
var aInputs=f.getElementsByTagName('input');
for(var i=0; i<aInputs.length; i++) {
    if(aInputs[i].className=='hide') {
        aInputs[i].className='';
        break;
        }
    }
}
</script>

<style type="text/css">
input {display:block;}
.hide {display:none;}
</style>

</head>
<body>
<form action="#" name="form1">
<div>
<input type="text" name="txt1">
<input class="hide" type="text" name="product1">
<input class="hide" type="text" name="product2">
<input class="hide" type="text" name="product3">
<input class="hide" type="text" name="product4">
<button type="button" onclick="addInput(this.form);">plus</button>
</div>
</form>
</body>
</html>

demo: Add input