The session is use to store user information for use later.Normally the information that store are username and password.The information is temporary and will be deleted when user close the browser or left the website
Example of session:
session_start(); // start up your PHP session!
$_SESSION[username]=$_POST[username]; //stored the username session from the form
Use isset to check the session:
if (isset($_SESSION[username])){
header ('Location: home.php');
}
Destroy session:
session_destroy();
Ads
Create array
Posted by
breheng
on Wednesday, August 26, 2009
/
Comments: (0)
An array can store multiple values in one variable..
Below is the example of array in php
$days = array("sun","mon","tue","wed","thur","fri","sat"); //array declaration
we also can declare an array like this
$days[1] = "sun";
$days[2] = "mon";
$days[3] = "tue";
the following example is to print the value in array
echo "Today is:".days[1];
the output is
sun
Below is the example of array in php
$days = array("sun","mon","tue","wed","thur","fri","sat"); //array declaration
we also can declare an array like this
$days[1] = "sun";
$days[2] = "mon";
$days[3] = "tue";
the following example is to print the value in array
echo "Today is:".days[1];
the output is
sun
encrypt text
Posted by
breheng
on Monday, August 24, 2009
/
Comments: (0)
we use md5 method in php to ecript text.
$text = "something";
$enc_text= md5($text);
echo "ecript text": $enc_text;
$text = "something";
$enc_text= md5($text);
echo "ecript text": $enc_text;