jquery ajax printa index on screen

0

I am having problems with jquery because it invests of printar on the screen only the echo of my php it is printing all index on the screen how to solve this?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><script>functionenviar(){varbin=$("#bin_id").val();
        var linhaenviar = bin.split("\n");
        var index = 0;
        linhaenviar.forEach(function(value){

          setTimeout(

            function(){
              $.ajax({
                url: 'index.php',
                type: 'POST',
                dataType: 'html',
                data: "bin=" + value,
                success: function(resultado){
                  document.write(resultado + "<br>");
              }
            })

          }, 10 * index);

        index = index + 3;

        })
      }
  </script>



<?php





error_reporting(0);

 if ($_POST['ip']) {
$bin = substr($_POST['ip'], 0, 90);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "fonte dps testes");
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt( $ch, CURLOPT_POSTFIELDS, "fonte dos testes" );
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        $s = curl_exec($ch);
        $pop = preg_match( '/<p>(.*)<\/p>/si' , $s , $match);


$vdd = ' ';

if($pop >= "1") 

{ $vdd = "<b><font color='red'>#DIE_IPS </font></b>"; } 

else { $vdd = "<b><font color='green'>#LIVE_IPS </font></b>"; }


 $tudo = " [".$ip." ".$vdd."] ";


 echo "<br><br><center>".$vdd." ".$ip."</center>";
   }else{}
?>
    
asked by anonymous 07.07.2017 / 17:47

1 answer

1

Separate the files, create a file for PHP only. Ex:

IP.php

<?php

$bin = substr($_POST['ip'], 0, 90);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "fonte dps testes");
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt( $ch, CURLOPT_POSTFIELDS, "era um garoto=que como eu" );
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        $s = curl_exec($ch);
        $pop = preg_match( '/<p>(.*)<\/p>/si' , $s , $match);


$vdd = ' ';

if($pop >= "1") 

{ $vdd = "<b><font color='red'>#DIE_IPS </font></b>"; } 

else { $vdd = "<b><font color='green'>#LIVE_IPS </font></b>"; }


 $tudo = " [".$ip." ".$vdd."] ";


 echo "<br><br><center>".$vdd." ".$ip."</center>";
   }else{}
?>

OtherFile.html

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><script>functionenviar(){varbin=$("#bin_id").val();
        var linhaenviar = bin.split("\n");
        var index = 0;
        linhaenviar.forEach(function(value){

        setTimeout(
            function(){
                $.ajax({
                url: 'IP.php',
                type: 'POST',
                dataType: 'html',
                data: "bin=" + value,
                success: function(resultado){
                    document.write(resultado + "<br>");
                }
            })

      }, 10 * index);

    index = index + 3;

    })
  }
    
07.07.2017 / 17:58