Guest User

Untitled

a guest
Nov 28th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Plugin Name: Denrile's Plogger
  5. Plugin URI: http://my-awesomeness-emporium.com
  6. description: >- a plugin to that takes the user to the Pruvan website,
  7. after using CURL to log them in so that the redirect doesn't hit a user authentication wall.
  8. Version: 1.0
  9. Author: John Mauran
  10. Author URI: http://github.com/jmauran91
  11. License: GPL2
  12. */
  13.  
  14.  
  15.  
  16. function loginToJulian($url, $username, $password){
  17. $curl = curl_init();
  18. $header[0]= "Accept: application/json, text/javascript, */*; q=0.01";
  19. $header[] = "Cache-Control: max-age=0";
  20. $header[] = "Connection: keep-alive";
  21. $header[] = "Content-Type: application/x-www-form-urlencoded";
  22. $header[] = "Keep-Alive: 300";
  23. $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  24. $header[] = "Accept-Language: en-us,en;q=0.5";
  25. $verbose = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
  26. curl_setopt($curl, CURLOPT_VERBOSE, true);
  27. curl_setopt($curl, CURLOPT_STDERR, $verbose);
  28. // Make the errors visible in a new file
  29.  
  30. $payload_username = '"'.$username.'"';
  31. $payload_password = '"'.$password.'"';
  32. $payloadtext=urlencode('{"username":'.$payload_username.',"password":'.$payload_password.'}');
  33. $payload = "payload=".$payloadtext;
  34. curl_setopt($curl, CURLOPT_URL, $url);
  35. curl_setopt($curl, CURLOPT_POST, 1);
  36. curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
  37. curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
  38. curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
  39. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  40.  
  41. curl_exec($curl);
  42. curl_close($curl);
  43.  
  44. header("Location: https://titlereporter.direct.pruvan.com/v2/pmgr");
  45.  
  46. }
  47.  
  48. function default_wordpress_hook(){
  49. $j_username = "Denrile";
  50. $j_password = "***********";
  51. $login_url ="https://titlereporter.direct.pruvan.com/v2/login?redir=%2Fv2%2Fpmgr&m=Authentication%20Required";
  52. $last_url = "https://titlereporter.direct.pruvan.com/v2/pmgr";
  53.  
  54. if(isset($_GET['prvn_login'])){
  55. loginToJulian($login_url, $j_username, $j_password);
  56. exit();
  57. } else {
  58.  
  59. }
  60. }
  61.  
  62. add_action("init","default_wordpress_hook");
  63.  
  64. ?>
Add Comment
Please, Sign In to add comment