Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Denrile's Plogger
- Plugin URI: http://my-awesomeness-emporium.com
- description: >- a plugin to that takes the user to the Pruvan website,
- after using CURL to log them in so that the redirect doesn't hit a user authentication wall.
- Version: 1.0
- Author: John Mauran
- Author URI: http://github.com/jmauran91
- License: GPL2
- */
- function loginToJulian($url, $username, $password){
- $curl = curl_init();
- $header[0]= "Accept: application/json, text/javascript, */*; q=0.01";
- $header[] = "Cache-Control: max-age=0";
- $header[] = "Connection: keep-alive";
- $header[] = "Content-Type: application/x-www-form-urlencoded";
- $header[] = "Keep-Alive: 300";
- $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
- $header[] = "Accept-Language: en-us,en;q=0.5";
- $verbose = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
- curl_setopt($curl, CURLOPT_VERBOSE, true);
- curl_setopt($curl, CURLOPT_STDERR, $verbose);
- // Make the errors visible in a new file
- $payload_username = '"'.$username.'"';
- $payload_password = '"'.$password.'"';
- $payloadtext=urlencode('{"username":'.$payload_username.',"password":'.$payload_password.'}');
- $payload = "payload=".$payloadtext;
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
- curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_exec($curl);
- curl_close($curl);
- header("Location: https://titlereporter.direct.pruvan.com/v2/pmgr");
- }
- function default_wordpress_hook(){
- $j_username = "Denrile";
- $j_password = "***********";
- $login_url ="https://titlereporter.direct.pruvan.com/v2/login?redir=%2Fv2%2Fpmgr&m=Authentication%20Required";
- $last_url = "https://titlereporter.direct.pruvan.com/v2/pmgr";
- if(isset($_GET['prvn_login'])){
- loginToJulian($login_url, $j_username, $j_password);
- exit();
- } else {
- }
- }
- add_action("init","default_wordpress_hook");
- ?>
Add Comment
Please, Sign In to add comment