| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Plugin Name: Debug Ajax Referer 1
|
|---|
| 4 | Pluign Description: just one urldecode
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | function 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 | ?>
|
|---|