注销后保存USER首选项变量

时间:2022-11-15 01:17:59

In my project I need to save the information about the user if he has submitted the form. What i am doing is saving it in $_SESSION[] variable when the user submit the form it is saved in session variable and by writing if(!isset($_SESSION['page'])) i restrict the user from visiting that page but when i logout the whole session is destroyed. I once again is able to register but the user has already register, how to block the user from re-registering This is the form

在我的项目中,如果他提交了表单,我需要保存有关用户的信息。我正在做的是将$ _SESSION []变量保存在$ _SESSION []变量中,当用户提交保存在会话变量中的表单并写入if(!isset($ _ SESSION ['page']))时,我限制用户访问该页面但是当我退出时,整个会话都被破坏了。我再次能够注册但是用户已经注册,如何阻止用户重新注册这是表单

注销后保存USER首选项变量 when the form is submitted successfully I set $_SESSION['personal_datas']=1;

当表单成功提交时,我设置$ _SESSION ['personal_datas'] = 1;

when user revisit his form after submitting注销后保存USER首选项变量

当用户在提交后重新访问其表单时

i check

 <?php if(!isset($_SESSION['personal_datas'])): ?>
      //display the form
  <?php else: ?>

   <div class="well">
     YOU HAVE SUCCESSFULLY SUBMITTED THE FORM
   </div>
  <?php endif; ?>

But when i logout I revisit the page it displays the same unfilled form注销后保存USER首选项变量

但是当我退出时,我重新访问该页面,它显示相同的未填写表格

how to block the user from re-registering after re-login?

重新登录后如何阻止用户重新注册?

2 个解决方案

#1


0  

If there is something unique to that the user enters into the form (such as a username or a personal identification number) you could store that in a database and every time the form is submitted check that the username (or whatever) provided is not already in the database.

如果用户输入表单中有一些独特的内容(例如用户名或个人识别码),您可以将其存储在数据库中,并且每次提交表单时检查提供的用户名(或其他)是否已经存在在数据库中。

Otherwise there is no way of permanently blocking a user from submitting the form again. Coockies can be deleted (and are browser specific). IP-adresses are not constant and many users can have the same IP.

否则,无法永久阻止用户再次提交表单。可以删除Coockies(并且是特定于浏览器的)。 IP地址不是固定的,许多用户可以拥有相同的IP。

#2


1  

Use a cookie or some other form of semi-persistent storage. Session data expires anyway when you close the browser.

使用cookie或其他形式的半持久存储。关闭浏览器时,会话数据无论如何都会过期。

#1


0  

If there is something unique to that the user enters into the form (such as a username or a personal identification number) you could store that in a database and every time the form is submitted check that the username (or whatever) provided is not already in the database.

如果用户输入表单中有一些独特的内容(例如用户名或个人识别码),您可以将其存储在数据库中,并且每次提交表单时检查提供的用户名(或其他)是否已经存在在数据库中。

Otherwise there is no way of permanently blocking a user from submitting the form again. Coockies can be deleted (and are browser specific). IP-adresses are not constant and many users can have the same IP.

否则,无法永久阻止用户再次提交表单。可以删除Coockies(并且是特定于浏览器的)。 IP地址不是固定的,许多用户可以拥有相同的IP。

#2


1  

Use a cookie or some other form of semi-persistent storage. Session data expires anyway when you close the browser.

使用cookie或其他形式的半持久存储。关闭浏览器时,会话数据无论如何都会过期。