WAMP上的登录系统 [英] Login System on WAMP
问题描述
我将以前在不同网站上运行的一堆网站文件转移到 WAMP,一切正常,但现在由于我将其转移到 WAMP,一些登录 php 的东西根本不起作用.session_destroy()
的东西甚至不起作用,我也尝试了 session_unset()
.我在 WAMP 上遇到的另一件事是 unset($_SESSION);
.似乎它甚至不起作用.任何帮助都会很好.
I transferred a bunch of website files that I used to run on a different website to WAMP, and it all worked fine, but now since I transferred it to WAMP, some of the login php stuff doesn't work at all. The session_destroy()
stuff doesn't even work, I tried session_unset()
too. Another thing I have trouble with on WAMP is unset($_SESSION);
. It seems as if it's not even working. Any help would be nice.
这里是注销脚本
<?php
session_start();
session_destroy();
header('Location:login.php');
?>
这里是登录脚本的一部分(会话注册部分)
And here is part of the login script(The session register part)
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_start('myusername');
session_start('mypassword');
$_SESSION['F_name'] = $row['First Name'];
$_SESSION['L_name'] = $row['Last Name'];
$_SESSION['Email'] = $row['Email'];
$_SESSION['Password'] = $row['_password'];
$_SESSION['id'] = $row['id'];
我不知道该怎么做.我尝试了一些东西,有些东西有点奏效,但是所有这些代码过去都可以在不同的服务器上运行,而且都是相同的文件和所有内容.
I am confused on what to do. I have tried some things, and some things have somewhat worked, but all this code used to work on a different server, and it's all the same files and everything.
推荐答案
我找到了答案.是的,我的原始代码变得有点糟糕,所以我回到了默认文件,答案很简单.我发现我只需要调用会话然后像这样设置变量:
I found the answer. Yes my original code was getting a little crappy, so i went back to a default file, and the answer was pretty simple. I found that i just needed to call the session and then set variables like this:
session_start();
$_SESSION[SomeName'] = $SomeValue;
当我想检查它是否已设置
And When i wanted to check if it was set
if(!isset($_SESSION['SomeName'])){}
这对我来说效果很好,也感谢大家的帮助.
That Has worked out perfectly for me, Thanks Everyone for all the help too.
这篇关于WAMP上的登录系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!