如何为网页增加安全性? [英] How to add security to a web page?

查看:109
本文介绍了如何为网页增加安全性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个用户和密码验证页面,我有3个页面
index.php

I am trying to make a User and Password validation page, i have 3 pages
index.php

<<pre lang="xml">form ONSUBMIT="return validacion(this)" action="validation.php" method="post" name="form">
<center>
<table border="0">
<tr>
    <td>
    User:
    </td>
    <td>
<input name="login" type="text" id="login" />
    </td>
</tr>
<tr>
    <td>
    Password:
    </td>
    <td>
<input name="password" type="password" id="password" />
    </td>
</tr>
<tr>
    <td>
    <input type="submit" value="Enviar" />
    </td>
    <td>
    <input type="reset" value="Borrar" />
    </td>
</tr>
</table>
</center>
</form



validation.php



validation.php

if ($_REQUEST[''login'']!="" and $_REQUEST[''password'']!="")
{
$table = "users";
require(''conect.php'');
$link=conect();
$consult = "select active from $table where login=''$_REQUEST[login]'' and password=''$_REQUEST[password]''";
$result=mysql_query($consult,$link);
$numreg=mysql_numrows($result);
 	if($numregi!=0)
    {
    	$_REQUEST[''active'']=mysql_result($result,$i,''active'');
        if ($_REQUEST[''active'']==''1'')
        {
        	echo "Admin";
            ?>&nbsp;&nbsp;&nbsp;
             <A href=''menuadmin.php''>Continue</a>
             <?php
        }
		else
		{
		echo "User";
		   ?>
           &nbsp;&nbsp;&nbsp;
             <A href=''coment.php''>Continue</a>
		  
         <?php
		}
	}
	else
    {
		echo "Login or password incorrect";
    	echo "&nbsp;&nbsp;<a href=''index.php''>Try again";
	}
}
else
   {
    	echo "Login or password incorrect";
    	echo "&nbsp;&nbsp;<a href=''index.php''>Try again";
    }
 ?>


和coment.php
这是一种提交评论的表单,它确实有很多,问题是,当我转到coment.php时,我可以看到该表单并提交,即使我还没有登录,我如何显示一条消息,说我没有loggen如果我直接进入coment.php?


and coment.php
which is a form to submit a comment it does have much, the thing is that when i go to coment.php i can see the form and submit even do i havent logged in, how can i show a message that says that i havent loggen in if i go directly to coment.php?
Thanks!!

推荐答案

_REQUEST [''login'']!="和
_REQUEST[''login'']!="" and


_REQUEST [''password' ']!=") {
_REQUEST[''password'']!="") {


table ="users"; require(''conect.php'');
table = "users"; require(''conect.php'');


这篇关于如何为网页增加安全性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆