Manusia Tak Sempurna
 Understanding Cookies
Cookies are data files written to your hard disk by a Web server computer that is used to identify itself so that users on the site when the user re-visiting the site, the site will be able to recognize it.
Functions of cookies:
1. Helping the web site to "remember" who we are and set the appropriate preferences so that when the user re-visiting this web site will be instantly recognizable.
2. Eliminating the need to re-register on the web site again when accessing the (site only), cookies help the user logged into the web server.
3. Allows web site to browse the web surfing patterns of users and to know your favorite sites are frequently visited.
Types of Cookies
1. Non-persistent (session) cookies. A cookie that will disappear when users close the browser and is usually used on the 'shopping carts' in the online shopping store to browse the items purchased,
2. Persistent cookies. Arranged by portal sites, banner / ad sites and other media who want to know when users return to visit their site. (Eg by providing the option "Remember Me" when logging in). These files are stored on the user's hard drive.
Both types of these cookies store information about a URL or domain name of a user visited the site and several codes indicating what pages you have visited. Cookies may contain personal information of users, such as name and email address, but can also provide information to website users through the registration process. In other words, the cookies will not be able to "steal" the name and email address unless provided by the user. However, there is a specific code (malicious code) that is made for example by an ActiveX control, which can retrieve information from a PC without user's knowledge.
Cookies are generally less than 100 bytes so it will not affect the browsing speed. but because in most cases the browser is set by default to accept cookies then the user will not know that cookies are already on the computer. Cookies can be useful especially on sites that require registration, so each time you visit the site, cookies are going to log a user without having to enter a user name and password again.


Overview of the Session
In general, the session is used to store information between processes a request, whether the request in the form POST or GET. Session is a variable that can maintain its contents within a specified time period (can be set) and stored in server. Although moving the page (in 1 website) variable still survive. So the session is simply a variable with certain characteristics.


PHP has a session (note the activity) that is used to keep / maintain access information from an accessor / user web application. Session tracking allows the user access, application usage by user pangaturan and improve the website services. Each visitor will be given a unique id, called a session id (session_id). This ID can be stored in a cookie on the user side or is included in the URL. Session connection between the client and the server will be lost or broken if the browser is closed. If the browser is run back and connect to the server is then considered a new connection.
One example that illustrates the use of session is the login process. In this case the user will enter a username via the login form. After successful login, the user is faced with the navigation menu links that led to several web pages. when users enter a username it will always appear or are listed on these web pages, then the username must be stored in the session.


Basic Concept Session
Session works just like daycare goods in supermarkets. Buyer came, left luggage, and the officer will provide identification. At the time the buyer will take the goods, the buyer gives the sign on the officers, and officers will be able to take the goods are entrusted with no mixed up with the goods of others. The problem that happens is, how "identification" will be stored on each user accessed the page, so it can be accessed by the system each time a user clicks on a link.


There are three alternatives that can be used to store session data:
• Cookies
• Hidden Form
• Embedding URLs

In general, how the session can be described as When visitors access a page, visitors are starting the session (used in function session_start ()). When the php configuration, session.auto_start is set to 1 then php will conduct sessions start automatically.


Visitors were then given an identity in the form session id, session id is a unique character sets, for example 12345678xx .. Simultaneously, on the server side is also made ses_12345678xx file containing session variables belonging to the visitors. Variables are registered with the function session_register () will be stored in this file.


The method above is the default. But it can determine the location of shelters jug own session variables, such as in a database. When visitors start or continue a session (through session_start ()) then the visitor session id send her to regain her own session variables that have been stored on the server.


Shipping session id to the server could be in 2 ways. The first, which is the default way, transmitted through cookies. PHPSESSID Session id of the cookie (default). There are times when for some reason, visitors to disable cookies (can be done through the browser settings). When this happens, the sending of the session id is done by both, namely through the query string (the string that is added to the URL, like the example at the beginning of the article).


Session will end when the function session_destroy () is called or when the user closes the web browser. From the way the work session earlier, it appears that the key to handle the visitors (on the client side) is just the session id variable, while his other variables on the server. The existence of facilities in the PHP session handling to make the above process becomes simple and easy because PHP do it automatically.


So, the session is of sufficient importance in web-based applications. With the session allows the programmer stores user information in a semi-permanent, meaning that during certain information will be stored. Storage of content resides on a server session variable, so can not be accessed directly by the client.


In web-based application, the session is widely used as an authentication login. With the session allows the programmer to set who can access a page. For example, to view the page in an email mailbox, you must login first. In the login process, among others, will be making a session that will be taken by the user on every page. On the mailbox page, the session is checked. If true then the user session are welcome to open the mailbox page, but if it is wrong then the user can not open the mailbox page, and usually will be asked to log in first. That is why, the user can not access the page directly to your mailbox without logging.
0 Responses

Post a Comment