开发者

Ajax calling PHP Function

So thanks to the response to my previous question, I've tried to make a code to e-mail me if the code is on another site.

Here is my javascript which is intended for a potential code theif to take with them to their website:

<script type="text/javascript">
var mypostrequest=new ajaxRequest()
mypostrequest.onreadystatechange=function(){
 if (mypostrequest.readyState==4){
  if (mypostrequest.status==200 || window.location.href.inde开发者_C百科xOf("http")==-1){
   document.getElementById("result").innerHTML=mypostrequest.responseText
  }
  else{
   alert("An error has occured making the request")
  }
 }
}

var url = document.domain;
var joel="www.joelhoskin.net76.net";
if (url!=joel)
{
mypostrequest.open("POST", "http://www.joelhoskin.net76.net/email.php", true)   
mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
mypostrequest.send(url)
}
</script>

and here is the php at joelhoskin.net76.net/email.php

    `<?php
      $url=$_POST['url'];
      if(isset($url))
            {
            $to = 'FlexDevs@gmail.com';
            $from = 'Errors@FlexDevs.com';
            $subject = 'Stolen Page';
            $content = $url."Site Stolen";
            $result = mail($to,$subject,$content,'From: '.$from."\r\n");
                die($result);
              }

         ?>`    

It isn't emailing me like it should


mypostrequest.send(url)

You do send data, but without key. Do it this way:

mypostrequest.send('url='+url)

It should make it work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜