Make WordPress Core

Ticket #3370: 3370-plugin.php

File 3370-plugin.php, 557 bytes (added by mdawaffe, 20 years ago)
Line 
1<?php
2/*
3Plugin Name: Debug Ajax Referer 1
4Pluign Description: just one urldecode
5*/
6
7function check_ajax_referer() {
8 $cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
9 foreach ( $cookie as $tasty ) {
10 if ( false !== strpos($tasty, USER_COOKIE) )
11 $user = substr(strstr($tasty, '='), 1);
12 if ( false !== strpos($tasty, PASS_COOKIE) )
13 $pass = substr(strstr($tasty, '='), 1);
14 }
15 if ( wp_login( $user, $pass, true ) )
16 return true;
17 return false;
18}
19
20?>