其他分享
首页 > 其他分享> > 生成新站点

生成新站点

作者:互联网

<?php 
 

if($_POST){
    $r=range(100, 999);
    shuffle($r);

 

    $r1=$r[0];
    $r1=$_POST['do'];
    $do_more=$_POST['do_more']?$_POST['do_more']:'';
    $r11=$r1;
    $web="www.".$r1.".com";
    $web2="http://www.".$r1.".com";
    // var_dump($r);die;
    $str2="127.0.0.1        ".$web."\n";
    $file = 'C:\Windows\System32\drivers\etc\hosts';
    $file2 = 'D:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf';
    // $file2 = 'D:\AppServ\Apache24\conf\extra\httpd-vhosts.conf';
    file_put_contents($file, $str2, FILE_APPEND);
    if($_POST['do_more']){
        $r11=$r1."\\".$do_more;
    }


    $str = file_get_contents($file);
    


    $str3="<VirtualHost *:80>\n";
      $str3.="  DocumentRoot \"D:\\admin\\".$r11."\"\n";
      $str3.="  ServerName www.".$r1.".com\n";
      $str3.="  ServerAlias www.".$r1.".com\n";
      $str3.="  <Directory \"D:\admin\\".$r11."\">\n";
      $str3.="   Options FollowSymLinks ExecCGI\n";
      $str3.="   AllowOverride All\n";
      $str3.="   Order allow,deny\n";
      $str3.="   Allow from all\n";
      $str3.="   Require all granted\n";
      $str3.=" </Directory>\n";
      
      $str3.="</VirtualHost>\n";

      
     
    file_put_contents($file2, $str3, FILE_APPEND);
    $res = file_get_contents($file2);
    echo "<a href='".$web2."'>$web2</a>";echo "<a href='javascript:history.go(-1);'>    返回</a>";
    // echo $res;
 }
/*
最简单的爬网页程序
*/
?>
<html lang="zh" dir="ltr">

<head>

  <meta charset="utf-8">
  <meta name="google" value="notranslate">
  <meta name="referrer" content="strict-origin">
</head>
<body>
    <div style="width:980px; margin:0 auto">
        <form action="" method="post">


        <table border=1>
            
                <td>domain</td><td><input type="text" name='do'/></td><td><input type="text" name='do_more'/></td><td><input type="submit" name='submit'/></td>
                
        </table>
        </form>
    </div>

</body>
</html>

标签:do,r1,str3,生成,站点,file,POST,more
来源: https://www.cnblogs.com/csjoz/p/15201762.html