在我的协议中,我需要使用javascript和php写入我的htaccess文件的帮助! [英] I need help writng to a my htaccess file using javascript and php in my agreement!

查看:54
本文介绍了在我的协议中,我需要使用javascript和php写入我的htaccess文件的帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是代码:

<form name=Agreement method=get action=#>
<td><input type="radio" id="examtype" name="examtype" value="agree" /> : I agree!<br />
<td><input type="radio" id="examtype" name="examtype" value="disagree" /> : I disagree!<br />
<input type="submit" name="Chat" value="Let's Chat!" onclick="return validateForm();" />

<script>
function validateForm(){
var checked = null;
var inputs = document.getElementsByName('examtype');
for (var i = 0; i < inputs.length; i++) {

          if (inputs[i].checked) {

           checked = inputs[i];

   }

}

if(checked==null)

{

    alert('Please choose an option');

}

if(checked.value=="agree"){

    var a=confirm('You have chosen to '+checked.value+' with the rules is this correct?')

if(a){alert("You will now be redirected to the chat page!");}

else{alert("Please agree to the rules as disagreeing to them leaves you permanently banned from our site!")

;}}

else if(checked.value=="disagree"){

    var d=confirm('You have chosen to '+checked.value+' with the rules is this correct?');

if(d){alert("You will now be permanently banned from this site!");

}}

else if(checked==null)

{

    alert('Please choose an option');

    return false;

}}

</script>



我希望它能写入我的.htacce ss文件拒绝来自不同意规则的人员IP地址

推荐答案

相当大的废话。你做不到,你不应该这样做。



1)首先,您如何识别未接受协议的用户?通过IP?好吧,如果他使用DHCP怎么办?几个小时后,他将拥有另一个IP - 你可能会阻止其他人。最后,您将获得数百个列入黑名单的IP。



2)你不应该从php修改htaccess文件,你不能用javascript(如果可以的话,那就完全不用了)



但你可以使用cookie来做,但最好还使用某种形式的身份验证。
Quite a big nonsense. You can't do and you should not do that.

1) First of all, how do you want to identify the user who has not accepted the agreement? By IP? Well, what if he is using DHCP? Several hours later he will have an other IP - and you will probably block somebody else. And at the end you will end up with hundreds of blacklisted IPs.

2) You should not modify htaccess file from php, and you can not do that from javascript (if you could, than it would have no use at all)

But you could do it using a cookie, but better use some form of authentication too.


需要2个文件1:
If you disagree to the rules it <b>will</b> lead to an immediate <b>permanent ban!!!</b><br/>
<td><input type="radio" id="agreement" name="agreement" value="agree" /> : I agree!<br/>
<td><input type="radio" id="agreement" name="agreement" value="disagree" /> : I disagree!<br/>
<input type="submit" name="Chat" value="Let's Chat!" onclick="return validateForm();" />

<script>
function validateForm(){
var myip = '<%= Request.UserHostAddress %>';
var checked = null;
var inputs = document.getElementsByName('agreement');
for (var i = 0; i < inputs.length; i++) {

          if (inputs[i].checked) {

           checked = inputs[i];

   }

}

if(checked==null)

{

    alert('Please choose an option');

}

if(checked.value=="agree"){

    var a=confirm('You have chosen to '+checked.value+' with the rules is this correct?')

if(a){alert("You will now be redirected to the chat page!");

window.location.assign("http://3dsemolga.3owl.com/chat/");}

else{alert("Please agree to the rules as disagreeing to them leaves you permanently banned from our site!")

;

}}

else if(checked.value=="disagree"){var a=confirm('You have chosen to '+checked.value+' with the rules is this correct?')

if(a){alert("You will now be permanently banned from this site!");

window.location.assign("http://3dsemolga.3owl.com/disagree.php");

}}

else if(checked==null)

{

    alert('Please choose an option');

    return false;

}}

</script>

















和另一个:



"







and another with:

"

<?php

  


file =
file =


这篇关于在我的协议中,我需要使用javascript和php写入我的htaccess文件的帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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