Curl Simulation Login

Source: Internet
Author: User

Index.html<a href= "http://adtuu-server.com/login/login.php?auth_username=admin&auth_password=admin123" >login</a>admincp.php<?php$username = $_post[' Auth_username ']; $password = $_post[' Auth_password '];if ($ Username = = ' Admin ' && $password = = ' admin123 ') {echo ' OK ';} else {echo ' error. ';} Login.php<?phpif (Isset ($_get[' auth_username ')) && isset ($_get[' Auth_password ')) {$user _agent = "Mozilla /4.0 (compatible; MSIE 6.0;     Windows NT 5.2;. NET CLR 1.1.4322) "; $header = Array ("host:www.adtuu-server.com", "referer:http://www.adtuu-server.com/login/login.php"     ,       );    $data = Array (' auth_username ' = = $_get[' auth_username '), ' auth_password ' = $_get[' Auth_password ']    );    $url = ' http://www.adtuu-server.com/login/admincp.php '; $curl = Curl_init (); Start a Curl session curl_setopt ($curl, Curlopt_url, $url); Address to access curl_setopt ($curl, Curlopt_ssl_verifypeer, 0);     Examination of the source of the certification certificatecurl_setopt ($curl, Curlopt_ssl_verifyhost, 1); Check that the SSL encryption algorithm exists from the certificate curl_setopt ($curl, curlopt_useragent, $user _agent);  Simulates the browser curl_setopt ($curl, Curlopt_httpheader, $header) used by the user; The place where the header information is set @curl_setopt ($curl, curlopt_followlocation, 1); Use Auto Jump//curl_setopt ($curl, Curlopt_httpget, 1); Send a regular GET request curl_setopt ($curl, Curlopt_post, 1); Send a regular POST request curl_setopt ($curl, Curlopt_postfields, $data); Post-Submitted packets//curl_setopt ($curl, Curlopt_cookie, $cookie); Send the cookie content directly//curl_setopt ($curl, Curlopt_cookiefile, $cookieFile); Send Cookie file curl_setopt ($curl, Curlopt_timeout, 120); Set timeout limit to prevent dead loops curl_setopt ($curl, Curlopt_header, 0); The returned header area content is not displayed curl_setopt ($curl, Curlopt_returntransfer, 1); The information obtained is returned as a file stream $res = curl_exec ($curl);     Perform the action if (Curl_errno ($curl)) {die (' Fail: errno '. Curl_error ($curl)); } curl_close ($curl); Close Curl session//header (' location:http://www.adtuu-server.com/login/admincp.php ');    Echo $res; Exit;}? ><form action= "http://www.adtuu-server.com/login/admincp.php" method= "POST" ><input type= "text" Name= " Auth_username "/><br/><input type=" password "name=" Auth_password "value=" "/><br/><input Type= "Submit" value= "Login"/><br/></form>

  

Curl Simulation Login

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.