欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

如何使用腳本模仿登陸過程

 更新時間:2006年11月22日 00:00:00   作者:  
查看他的登陸頁面的代碼, 看他提交到哪個頁面, 變量是什么。
復(fù)制代碼 代碼如下:

<form method="post" action="login.jsp">
<table align="center" width="40%" style="FONT-SIZE: 12px" border="0" cellpadding="0" cellspacing="2">
  <tr>
    <td width="30%" align="right" bgcolor="#0073AA" style="FONT-SIZE: 12px;color:#ffffff">name:</td>
    <td width="70%"><input type="text" size="30" name="username"></td>
  </tr>
  <tr>
    <td width="30%" align="right" bgcolor="#0073AA" style="FONT-SIZE: 12px;color:#ffffff">password:</td>
    <td width="70%"><input type="password" size="32" name="passwd"></td>
  </tr>
  <tr>
    <td colspan="2" align="right">
      <input type="submit" name="submit" value="Login">&nbsp;
      <input type="button" name="submit" value="regest" onclick="location.href='regest.jsp'">
    </td>
  </tr>
</table>
</form>

很明顯, 如果你要登陸, 你需要把username, passwd, submit這幾個變量post到login.jsp, 而且submit=Login
用以下代碼:
復(fù)制代碼 代碼如下:

<?php
        $postData = "username=your_name&password=your_password&Submit=Login";
        $posturl = "http://......../../login.jsp";

        $postUrl = parse_url($posturl);
        $host = $postUrl[host] ? $postUrl[host] : "";
        $port = $postUrl[port] ? $postUrl[port] : 80;
        $path = $postUrl[path] ? $postUrl[path] : "/";



        $fsp = fsockopen($host, $port, &$errno, &$errstr, 30);
        if(!$fsp){
                print "\nopen socket failed\n";
        }else{
                fwrite($fsp, "POST ".$path." HTTP/1.1\r\n");
                fwrite($fsp, "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n");
                fwrite($fsp, "Accept-Language: zh-cn\r\n");
                fwrite($fsp, "Content-Type: application/x-www-form-urlencoded\r\n");
                fwrite($fsp, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)\r\n");
                fwrite($fsp, "Host:".$host."\r\n");
                fwrite($fsp, "Content-Length: ".strlen($postData)."\r\n\r\n");
                fwrite($fsp, $postData);

                $resp = "";
                do{
                        if(strlen($out=fread($fsp, 1024)) == 0) break;
                        $resp .= $out;
                }while(true);

                echo "<br><br>".nl2br($resp);

                fclose($fsp);

        }
?>

相關(guān)文章

  • php實現(xiàn)動態(tài)口令認(rèn)證的示例代碼

    php實現(xiàn)動態(tài)口令認(rèn)證的示例代碼

    這篇文章主要為大家詳細(xì)介紹了php實現(xiàn)動態(tài)口令認(rèn)證的相關(guān)知識,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-02-02
  • Laravel向公共模板賦值方法總結(jié)

    Laravel向公共模板賦值方法總結(jié)

    在本篇文章里小編給大家整理了關(guān)于Laravel向公共模板賦值方法以及相關(guān)知識點總結(jié),有興趣的朋友們學(xué)習(xí)下。
    2019-06-06
  • PHP include_path設(shè)置技巧分享

    PHP include_path設(shè)置技巧分享

    當(dāng)時候函數(shù)include(),require(),fopen_with_path()函數(shù)來尋找文件時候.在不設(shè)置include_path的情況下,這些函數(shù)打開文件時候默認(rèn)的是以web根目錄去尋找.當(dāng)設(shè)置include_path以后,這些php函數(shù)就會先在指定的include_path目錄下面去搜索尋找
    2011-07-07
  • 關(guān)于php mvc開發(fā)模式的感想

    關(guān)于php mvc開發(fā)模式的感想

    使用mvc開發(fā)已經(jīng)有一段很長時間了,發(fā)現(xiàn)了一些問題。
    2011-06-06
  • PHP程序員最常犯的11個MySQL錯誤小結(jié)

    PHP程序員最常犯的11個MySQL錯誤小結(jié)

    對于大多數(shù)web應(yīng)用來說,數(shù)據(jù)庫都是一個十分基礎(chǔ)性的部分。如果你在使用PHP,那么你很可能也在使用MySQL—LAMP系列中舉足輕重的一份子。
    2010-11-11
  • php實現(xiàn)子字符串位置相互對調(diào)互換的方法

    php實現(xiàn)子字符串位置相互對調(diào)互換的方法

    這篇文章主要介紹了php實現(xiàn)子字符串位置相互對調(diào)互換的方法,可實現(xiàn)簡單字符串中兩個子字符串互換的功能,涉及php字符串運算與插入、替換等操作的相關(guān)技巧,需要的朋友可以參考下
    2016-06-06
  • PHP獲取欄目的所有子級和孫級欄目的ID號示例

    PHP獲取欄目的所有子級和孫級欄目的ID號示例

    這篇文章主要介紹了PHP獲取欄目的所有子級和孫級欄目的ID號的具體實現(xiàn),需要的朋友可以參考下
    2014-04-04
  • PHP memcache擴展的三種安裝方法

    PHP memcache擴展的三種安裝方法

    PHP中pecl::memcache擴展的三種安裝方法 先提前說明一下還有一種是pecl::memcached,memcached會依賴于libmemcached,這種是比較新的
    2009-04-04
  • php 常用字符串函數(shù)總結(jié)

    php 常用字符串函數(shù)總結(jié)

    這篇主要為大家介紹php 常用字符串函數(shù),需要的朋友可以參考一下
    2008-03-03
  • php中二分法查找算法實例分析

    php中二分法查找算法實例分析

    這篇文章主要介紹了php中二分法查找算法,結(jié)合實例形式總結(jié)分析了二分查找算法的原理與具體實現(xiàn)技巧,需要的朋友可以參考下
    2016-09-09

最新評論