JavaScript is a script that runs on the client, so it is generally not possible to set a session because the session is run on the server side.
Cookies are run on the client, so you can use JS to set cookies.
Suppose there is a case in which, in a
Asp.net| Weather Forecast
Visit www.163.com, the first page of the column has the local weather forecast. It can be guessed that the weather forecast here should be based on the caller's IP to determine the location of the local weather conditions.
javascript Create and store Cookie,cookie are variables that are stored on the visitor's computer, and take a look at the example. What is a cookie? A cookie is a variable that is stored in a visitor's computer. This cookie is sent whenever the
cookie| Beginners {
var arg = name + "=";
var alen = Arg.length;
var clen = document.cookie.length;
var i = 0;
while (I var j = i + Alen;
if (Document.cookie.substring (i, j) = arg)
Return Getcookieval (j);
i = Document.cookie.indexOf ("", I) +
There are three ways to use PHP for user authentication: HTTP authentication, session usage, and use of cookies.
Using PHP for HTTP authentication:
is a basic authentication mechanism that is created by combining the header () function and the
The following error occurred at the time of Setcookie.
Cannot modify header information-headers already sent by ....
This error is very common, and if you output any text before Setcookie, you will have the error message. Because the page header
This site style switch in addition to the memory function, you can also set the retention time, such as 5 days-180 days, after the time will automatically revert to the default style sheet.
Style sheet connection, set 3 styles, and write a style
Cookie|cookies the cookies in the browser
Let's take a look at what's saved in the browser. If you are using IE5, there is a directory of cookies in the Windows directory, there are a lot of text files, the file name is similar to Wudong@15seconds[1]
The code is as follows
fdsafdsafdsafsda Set Cookie Value Get Cookie value Clear Cookie Value
Summary of calling Cookies yourself
Path= this if you don't have the settings then your cookie can only be applied to the current directory, such
Web page | source code
1, add the following code to the between Heml................................................................. 2, prohibit the view page source codeTrue to achieve the source code shielding simple. htm is impossible! To
The last time we studied the guest.php file. The specific problems also require readers to practice their own in-depth, but also need some reference books to learn, if you do not have a little knowledge of PHP, I advise you do not want to look down,
This article mainly introduces sample code that determines whether a client browser supports cookies. Need friends can come to the reference, I hope to help you. 1. Code as follows: function check () { if (window.navigator.cookieEnabled)
?
/*
* Name: cnkknd PHP Login Class
* Description: PHP for login class, based on MySQL
* Author: Daniel king,cnkknd@163.com
* Date: 2003/8/25
*/
Class Login
{
var $username; User name
var $userpass; Password
var $userid; User ID
var $userlevel;
Using return is more efficient than using global to pass an array, such as:
function Userloginfo ($usertemp) {
$detail =explode ("", $usertemp);
return $detail;
}
$login =userloginfo ($USERDB);
Than
function Userloginfo ($usertemp) {
Global $detail;
A problem was found when writing a script that was not complex. To start with the code, its main function is to use PHP to determine whether to generate a section of Javascript, and use cookies to record state
/* PHP Code * *
Header
This article discusses how to completely eliminate the Warning:cannot add header information-headers already sent in ... This is a puzzling mistake.
As long as you have written PHP code, I believe you have encountered this most of the time is not
When using Sdmenu.js in a project, you need to clear cookies at logon, and Sdmenu will save cookies by default
Here's how to save cookies sdmenu.js
Document.cookie = "Sdmenu_" + encodeuricomponent (this.menu.id) + "=" + States.join ("") + ";
Tips | People want their home page to be lively and have more interaction with their visitors. Do the following tips make you feel a bit more colorful on your Web page?
1. A record of the number of visitors visited
A visitor saw that I was able to
You can use cookies to record whether your site is being collected
Do not have to ask visitors after confirming that they are set as a home page or a collection
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.