search

unset($_SESSION['user']);
火狐无效,谷歌是OK的,不知道为啥,火狐是不是有什么特别要求
还有用火狐F12,会有安全问题,提示“密码字段出现在一个不安全的页面(http://)中。这是一个导致用户的登陆凭据可被窃取的安全风险。”
使用POST提交的用户名和密码,但是用了iframe来获取处理登陆的php的内容,是不是这样做不安全


回复讨论(解决方案)

提示“密码字段出现在一个不安全的页面(http://)中。这是一个导致用户的登陆凭据可被窃取的安全风险。”
意思就是你的密??出去?是明文,?有加密,容易被?取。用https就不?提示的。?句?可以不理的。

是用?名和密?post到iframe ?面做???? 不?不安全啊。

unset($_SESSION['user']) 不行?? ?句是在iframe?面?

unset($_SESSION['user']) 
这句直接写在一个logout.php里,
点击“退出”就会连接到这个文件,火狐里没法注销这个session,谷歌和360是正常的

用firefox测试了一下。
a.php

<?phpsession_start();$_SESSION['user'] = 'fdipzone';?>


b.php
<?phpsession_start();if(isset($_SESSION['user'])){    unset($_SESSION['user']);    var_dump($_SESSION['user']);}?>


var_dump NULL 很正常。

如果真的不能unset,可以执行$_SESSION['user'] = NULL;

var_dump  输出是NULL
找到原因了,原来是火狐回退不会刷新页面,判断登陆状态的js没有执行
logout.php 里是这么写的
unset($_SESSION['user']);
echo "<script> history.go(-1)</script>";

火狐回退,$(document).ready(function(){}里的函数为啥不会运行呢
谷歌是会运行的

看?是你的firefox有??了。???了,一切正常。

重新下了个火狐,还是一样,这情况是在太怪了

以前写验证码类的时候碰到过这个问题
window.onload的时候,我刷新了验证码图片
火狐提交表单再后退验证码不变,IE刷新
当时查了下资料,火狐的内核会为所有选项卡各自在内存中保存历史记录,当发生回退时其实仅仅读取了内存,js运行状态也就保存了下来。而IE内核的回退就好像是直接输入地址一样

 echo "<script> history.go(-1)</script>"; 
改成跳转header("Location:xx.php");试试

session 是存放在服务器上的
只要浏览器能传递正确的 sessionid ,其他的就与浏览器无关了

unset($_SESSION['user']);
并不能注销 session,而只是从 session中删去了 uesr 项
显然这句是有条件执行的,所以你应检查删除的条件是否成立
而传递删除条件就与浏览器有关了

以前写验证码类的时候碰到过这个问题
window.onload的时候,我刷新了验证码图片
火狐提交表单再后退验证码不变,IE刷新
当时查了下资料,火狐的内核会为所有选项卡各自在内存中保存历史记录,当发生回退时其实仅仅读取了内存,js运行状态也就保存了下来。而IE内核的回退就好像是直接输入地址一样


那这个问题有啥办法解决不

 echo "<script> history.go(-1)</script>"; 
改成跳转header("Location:xx.php");试试


改成这个就正常了。。

session 是存放在服务器上的
只要浏览器能传递正确的 sessionid ,其他的就与浏览器无关了

unset($_SESSION['user']);
并不能注销 session,而只是从 session中删去了 uesr 项
显然这句是有条件执行的,所以你应检查删除的条件是否成立
而传递删除条件就与浏览器有关了


删除应该是成功的,因为火狐回退没效果,但是刷新一下就好了

那这个问题有啥办法解决不



像9楼那样,用php的header Location 或者window.location.href 避免程序中后退
用户自己按后退那就是他的问题了

 用header('location: '.$_SERVER['HTTP_REFERER']);解决了,多谢大家

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain how load balancing affects session management and how to address it.Explain how load balancing affects session management and how to address it.Apr 29, 2025 am 12:42 AM

Load balancing affects session management, but can be resolved with session replication, session stickiness, and centralized session storage. 1. Session Replication Copy session data between servers. 2. Session stickiness directs user requests to the same server. 3. Centralized session storage uses independent servers such as Redis to store session data to ensure data sharing.

Explain the concept of session locking.Explain the concept of session locking.Apr 29, 2025 am 12:39 AM

Sessionlockingisatechniqueusedtoensureauser'ssessionremainsexclusivetooneuseratatime.Itiscrucialforpreventingdatacorruptionandsecuritybreachesinmulti-userapplications.Sessionlockingisimplementedusingserver-sidelockingmechanisms,suchasReentrantLockinJ

Are there any alternatives to PHP sessions?Are there any alternatives to PHP sessions?Apr 29, 2025 am 12:36 AM

Alternatives to PHP sessions include Cookies, Token-based Authentication, Database-based Sessions, and Redis/Memcached. 1.Cookies manage sessions by storing data on the client, which is simple but low in security. 2.Token-based Authentication uses tokens to verify users, which is highly secure but requires additional logic. 3.Database-basedSessions stores data in the database, which has good scalability but may affect performance. 4. Redis/Memcached uses distributed cache to improve performance and scalability, but requires additional matching

Define the term 'session hijacking' in the context of PHP.Define the term 'session hijacking' in the context of PHP.Apr 29, 2025 am 12:33 AM

Sessionhijacking refers to an attacker impersonating a user by obtaining the user's sessionID. Prevention methods include: 1) encrypting communication using HTTPS; 2) verifying the source of the sessionID; 3) using a secure sessionID generation algorithm; 4) regularly updating the sessionID.

What is the full form of PHP?What is the full form of PHP?Apr 28, 2025 pm 04:58 PM

The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

How does PHP handle form data?How does PHP handle form data?Apr 28, 2025 pm 04:57 PM

PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

What is the difference between PHP and ASP.NET?What is the difference between PHP and ASP.NET?Apr 28, 2025 pm 04:56 PM

The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

Is PHP a case-sensitive language?Is PHP a case-sensitive language?Apr 28, 2025 pm 04:55 PM

PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools