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