| 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 |
|
|
| Computer Basics |
|
|
|
|
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 |
|
|
| Computer Basics Quizes |
|
|
|