HTML Tutorials |
|
XML Tutorials |
|
Browser Scripting |
|
Server Scripting |
|
.NET (dotnet) |
|
Multimedia |
|
Web Building |
|
Java Tutorials |
|
Programming Langauges |
|
Soft Skills |
|
Database Tutorials |
|
Operating System |
|
Software Testing |
|
SAP Module |
|
Networking Programming |
|
Microsoft Office |
|
Accounting |
|
|
After a request from script or a server user's browser stores small amount of data, This data is called cookie.
|
Cookies kann in drei M�glichkeiten durch einen PHP Index erreicht werden:
|
In einem Cookies gibt es Informationen �ber einen Namen, Wert, Verfallsdatum, Wirt und Weg. W�hrend Cookies vom Bediener durch HTTP �berschrift gesendet werden, beenden sie bis zum Benutzer. Sind hier die 3 Weisen, Cookies zug�nglich zu machen:
- using �$HTTP-COOKIE� which is the environmental variable, all cookie names
and values are present in this variable.
-
using global variable �$cookie_name�, here the name should be replaced
- using �HTTP_COOKIE_VARS [�cookie_name�]� which is a global array variable.
(here replace the �cookie_name� by actual name of the cookie).
|
print $HTTP_COOKIE; //outputs �visits=23�
print getenv(�HTTP_COOKIER�); //outputs �visits=23�
print $visits; //outputs �23�
print $HTTP_COOKIE_VARS[visits]; //outputs �23�
|
|
How to Set a Cookie with PHP
|
�header()� function, or �setcookie()� function can be used to set cookie with PHP.
The main purpose of �header()� function is not to set a cookie, and works
just like �setcookie()�. Cookie header is written by ourself by using �header()� funtion, but �setcookie()� is much automated.
|
//don�t output anything before this...
header(�visits=23; expires=Friday, 15-Nov-06 03:27:21 GMT; path=/;
domain=softwareprojects.org�);
setcookie(�hits�, 23, time() + 3600, �/�, �softwareprojects.org�, 0);
//notice this last extra argument
|
|
Weather the cookies will be send over a secure connection or not is denoted
by the last argument to "setcookie()" function. Here "0" means no and "1" means yes.
|
How to Retrieve a Cookie Value
|
To retrieve a cookie value, PHP $_COOKIE variable is used.
In the following example the value of cookie named "user" is retrieved and displayed on the page.
|
<?php
// Print a cookie
echo $_COOKIE["user"];
// A way to view all cookies
print_r($_COOKIE);
?>
|
|
How to Delete a cookies
|
Um ein Cookies zu l�schen sollten wir das Cookies EINSTELLEN, das wir mit dem Datum l�schen m�chten das bereits abgelaufen ist. W�hrend uns so tun den gleichen Weg mit einschlie�en sollte, Parameter und Gebiet sichern, das urspr�nglich verwendet wurde, um das Cookies einzustellen.
|
setcookie(�visits�, 23, time() - 60, �/�,�vyom.co.in�, 0)
|
|
Weather the cookies will be send over a secure connection or not is denoted
by the last argument to "setcookie()" function. Here "0" means no and "1" means yes.
|
Beschr�nkungen der Cookies
|
Abgesehen von dem Vorteil des F�hrens von Informationen von einer Seite zu einer anderen Seite oder zu Besuch, um zu besuchen, haben Cookies etwas Beschr�nkungen. Die H�chstzahl der Cookies , die durch die Datenbanksuchroutine gespeichert werden k�nnen, ist 20.And, das maximale Gr��e des Cookies s 4KB ist. Das Privatleben des Benutzers wird beibehalten, da nur der Entstehenwirt die Daten lesen kann, die gespeichert worden ist.
|
Keywords:php tutorial, php scripts, php nuke, php download, php editor, php mysql, php forum,
php add link, learn php, php code
|
|
HTML Quizes |
|
XML Quizes |
|
Browser Scripting Quizes |
|
Server Scripting Quizes |
|
.NET (dotnet) Quizes |
|
Multimedia Quizes |
|
Web Building Quizes |
|
Java Quizes |
|
Programming Langauges Quizes |
|
Soft Skills Quizes |
|
Database Quizes |
|
Operating System Quizes |
|
Software Testing Quizes |
|
SAP Module Quizes |
|
Networking Programming Quizes |
|
Microsoft Office Quizes |
|
Accounting Quizes |
|
|