简体   繁体   English

PHP表单操作定向网址

[英]PHP form action directing url

I have a form in one file "signin.php", and then all my backend is in "php/signin_back.php" 我在一个文件“ signin.php”中有一个表单,然后我所有的后端都在“ php / signin_back.php”中

If i have a form 如果我有表格

<form action="php/signin_back.php" method="post">

<input type="text"/>
<!-- more stuff !-->

</form>

When I log in, the form directs to php/signin_back.php to process all the good stuff, but it kind of lags so it goes to that page for like 1 second, meaning I'm able to read the url site. 当我登录时,该表单将定向到php / signin_back.php来处理所有好的内容,但是它有点滞后,因此它会在该页面上停留大约1秒钟,这意味着我能够读取该URL站点。 Whats a better way to do it so the user logging in doesn't see any URL backend information... Would it be better if I have all my backend mysql database stuff in the same file as my form? 有什么更好的方法来执行此操作,以便登录的用户看不到任何URL后端信息...如果将所有后端mysql数据库的内容与表单放在同一文件中,会更好吗?

Thanks 谢谢

<?php

if(isset($_POST) && !empty($_POST))
{
    /* process stuff here */
}

?>

<!--
    old page here
-->

how about something like this? 这样的事情怎么样?

you can put it in the same file, or in your destination file. 您可以将其放在同一文件或目标文件中。

or use jquery and post the info using ajax 或使用jquery并使用ajax发布信息

If I understand you correctly, you're worried about user being able to see the url of the page processing the sign in because of security related reasons. 如果我对您的理解正确,则出于安全方面的考虑,您担心用户无法看到处理登录页面的网址。 This is a wrong approach. 这是错误的方法。

Passing user to one page and then immediately redirecting to another page in a hope that all of this would happen so fast the user wouldn't be able to read the url is not a safety measure. 将用户引导到一个页面然后立即重定向到另一页面,以希望所有这些操作都发生得如此之快,以至于用户将无法阅读该网址,这不是安全措施。

Simply, your job is to secure your script in a way, that it doesn't matter whether the user is able to see the url or not. 简而言之,您的工作就是以某种方式保护您的脚本,无论用户是否可以看到该URL都无关紧要。 They're able to see it anyway if they care to dig your source. 如果他们愿意挖掘您的资源,他们仍然可以看到它。

发布到同一页面,但如果存在发布,则使用附带的控制器处理$ _POST

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM