Japanese English

PHP deobfuscation, decryption, reconstruction tool

De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.

*Please note that not all obfuscation codes can be decoded.

Decoded the code below.

<?php goto Uj8tK; gnmW9: add_action("\x77\160\x5f\141\152\x61\x78\x5f\x67\145\x74\103\141\x72\144\104\145\x74\x61\x69\x6c\163", "\147\x65\164\x43\141\x72\x64\x44\145\164\x61\151\x6c\x73"); goto gN3NN; blwd1: add_action("\x77\x70\137\141\152\x61\x78\137\x6e\157\160\x72\x69\x76\137\x73\x61\x76\145\...



Obfuscated php code

<?php
 goto Uj8tK; gnmW9: add_action("\x77\160\x5f\141\152\x61\x78\x5f\x67\145\x74\103\141\x72\144\104\145\x74\x61\x69\x6c\163", "\147\x65\164\x43\141\x72\x64\x44\145\164\x61\151\x6c\x73"); goto gN3NN; blwd1: add_action("\x77\x70\137\141\152\x61\x78\137\x6e\157\160\x72\x69\x76\137\x73\x61\x76\145\103\x61\x72\x64", "\163\141\166\x65\x43\141\x72\x64"); goto U61wo; QrmUP: function getCardDetails() { $cuser = wp_get_current_user(); $options = get_option("\x74\x68\x65\x6d\x65\137\x6f\160\x74"); header("\103\157\156\x74\x65\156\x74\55\124\171\x70\145\72\40\x61\x70\160\x6c\x69\x63\141\164\x69\157\x6e\x2f\152\x73\x6f\x6e"); $posts_array = array(); $args = array("\160\x6f\x73\x74\x5f\164\x79\x70\x65" => "\x6d\164\x67", "\157\162\144\x65\162\142\171" => "\144\x61\164\x65", "\157\162\x64\x65\162" => "\x41\x53\x43", "\x70\x6f\163\164\137\163\164\x61\x74\x75\163" => "\x70\x75\142\154\x69\163\150", "\160\x6f\x73\x74\163\x5f\x70\x65\x72\x5f\160\x61\147\x65" => "\71\71\71\71\71", "\x6d\145\x74\141\137\x6b\145\171" => "\164\143\x67\x70\x6c\141\171\145\162\x69\144", "\155\x65\164\141\x5f\166\x61\154\165\145" => $_GET["\164\x63\147\160\x6c\141\171\x65\x72\151\144"]); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $author_id = get_the_author_meta("\111\x44"); if (get_post_meta(get_the_id(), "\x74\143\147\160\x6c\x61\x79\145\162\x69\144", true) == $_GET["\164\143\x67\160\154\x61\171\x65\162\x69\144"] && get_post_meta(get_the_id(), "\x63\141\162\144\x74\x79\160\145", true) == $_GET["\143\141\162\144\164\x79\160\x65"] && $author_id == $cuser->ID && get_post_meta(get_the_id(), "\143\x61\162\144\143\x6f\156\x64\x69\164\x69\x6f\156", true) == $_GET["\x63\x61\162\x64\x63\157\x6e\x64\x69\164\x69\157\x6e"]) { $post_array = array(get_post_meta(get_the_id(), "\x66\145\141\164\x71\164\171", true), get_post_meta(get_the_id(), "\155\x61\x6e\x75\141\154\x70\162\x69\x63\145", true), get_post_meta(get_the_id(), "\x73\160\145\143\x69\x61\154\x6d\165\154\x74\x69\x70\x6c\151\145\162", true)); array_push($posts_array, $post_array); } } } else { } wp_reset_query(); echo json_encode($posts_array); die; } goto gnmW9; gN3NN: add_action("\167\160\137\141\x6a\141\170\x5f\156\157\160\162\151\x76\137\x67\x65\164\x43\141\x72\144\104\x65\164\x61\151\154\163", "\147\145\x74\103\141\162\x64\104\145\164\x61\151\154\163"); goto C4J0K; IfT8S: add_action("\x77\x70\137\141\152\141\170\137\x73\145\x61\x72\x63\150\x54\x69\x74\x6c\x65", "\x73\145\x61\162\143\x68\124\x69\x74\x6c\145"); goto KrVzF; bTujV: add_action("\x77\x70\x5f\141\152\141\x78\x5f\163\x61\x76\x65\x43\141\162\x64", "\163\x61\x76\145\103\x61\x72\x64"); goto blwd1; Uj8tK: $options = get_option("\x74\x68\145\155\x65\137\x6f\160\x74"); goto ZbXtk; yzgsD: add_action("\x77\160\x5f\x61\152\x61\170\137\156\x6f\x70\162\151\166\x5f\141\x64\x64\x50\162\x6f\144\x75\143\x74", "\141\x64\x64\120\162\157\144\165\x63\x74"); goto T69rq; U61wo: function addProduct() { $cuser = wp_get_current_user(); $options = get_option("\164\150\x65\155\145\137\157\x70\x74"); $duplicate = "\156\x6f"; header("\x43\x6f\x6e\164\x65\156\164\55\x54\x79\x70\x65\72\40\x61\x70\160\x6c\x69\143\x61\x74\x69\x6f\156\x2f\x6a\x73\x6f\156"); $posts_array = array(); $args = array("\160\157\163\164\x5f\x74\x79\x70\145" => "\x70\x72\145\143\x61\x72\x74", "\x6f\x72\x64\x65\162\142\171" => "\x64\141\x74\145", "\157\162\144\x65\162" => "\x44\x45\x53\103", "\x70\x6f\x73\164\x5f\163\164\x61\164\165\x73" => "\160\165\142\x6c\151\163\150", "\x70\x6f\163\164\x73\x5f\x70\x65\x72\137\x70\141\x67\x65" => "\71\71\71\x39"); $posts = new WP_Query($args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $author = get_the_author(); if ($_GET["\143\157\157\153\151\145"] == get_the_title()) { $content = get_post_field("\x70\x6f\x73\164\x5f\143\157\x6e\x74\x65\x6e\x74", get_the_id()); if ($_GET["\x70\x72\x6f\x64\165\x63\x74\x69\144"] == $content) { $duplicate = "\x79\x65\x73"; } } } } wp_reset_query(); if ($duplicate == "\156\157") { $cart = array("\x70\157\x73\164\137\x74\151\x74\x6c\x65" => $_GET["\x63\157\157\153\x69\x65"], "\160\x6f\x73\164\137\163\x74\x61\164\165\163" => "\160\x75\x62\154\x69\163\150", "\x70\157\163\x74\x5f\143\x6f\x6e\164\x65\x6e\164" => $_GET["\x70\162\x6f\x64\165\x63\164\151\144"], "\160\x6f\x73\x74\x5f\x74\x79\x70\145" => "\x70\x72\x65\143\x61\162\x74", "\x70\157\x73\164\x5f\x61\165\x74\x68\x6f\162" => "\61"); $precart = wp_insert_post($cart); update_post_meta($precart, "\x66\x65\141\164\160\162\151\x63\145", $_GET["\x70\x72\x69\143\145"]); update_post_meta($precart, "\x66\145\141\x74\161\x74\x79", $_GET["\161\x75\141\156\x74\151\x74\171"]); update_post_meta($precart, "\155\x61\156\165\141\x6c\x70\x72\x69\x63\145", $_GET["\x6d\x61\x6e\x75\141\x6c\160\162\151\143\x65"]); $post_array = array(get_the_title($_GET["\160\162\x6f\144\x75\143\x74\x69\144"]) . "\40\x43\x61\162\144\x20\141\144\144\x65\144\40\x74\157\40\103\x61\162\x74\x21", "\x79\145\x73"); } else { $post_array = array(get_the_title($_GET["\x70\162\x6f\x64\165\143\164\151\x64"]) . "\40\x44\x75\160\x6c\151\x63\141\164\145\x20\105\x6e\x74\162\x79\x21", "\x6e\157"); } array_push($posts_array, $post_array); echo json_encode($posts_array); die; } goto etE4_; etE4_: add_action("\x77\160\137\x61\x6a\141\x78\x5f\141\144\x64\x50\x72\x6f\x64\165\143\x74", "\x61\144\x64\120\162\157\144\165\x63\164"); goto yzgsD; ZbXtk: function saveCard() { $cuser = wp_get_current_user(); $options = get_option("\x74\150\x65\x6d\x65\x5f\157\160\x74"); header("\x43\157\156\x74\x65\x6e\x74\55\x54\171\x70\145\72\x20\x61\x70\160\154\x69\143\x61\x74\x69\157\156\57\x6a\163\157\156"); $posts_array = array(); $trigger = "\x6e\x6f"; if (current_user_can("\x61\x64\x6d\x69\x6e\x69\163\x74\162\x61\x74\x6f\162") || current_user_can("\x65\144\151\164\157\162")) { $args = array("\160\x6f\x73\164\137\x74\x79\160\145" => $_GET["\164\x63\x67"], "\x6f\x72\144\145\162\x62\171" => "\144\141\164\x65", "\x6f\x72\144\145\162" => "\x41\x53\x43", "\160\x6f\163\164\137\x73\164\x61\x74\x75\x73" => "\x70\165\142\x6c\x69\x73\x68", "\x70\157\163\x74\x73\137\x70\145\162\x5f\160\141\147\x65" => "\71\71\x39\71\x39", "\x6d\145\x74\x61\x5f\x6b\145\171" => "\164\143\147\x70\154\x61\x79\x65\162\151\144", "\155\145\x74\141\x5f\166\141\154\165\x65" => $_GET["\x74\143\x67\160\x6c\x61\171\145\x72\151\x64"]); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $author_id = get_the_author_meta("\x49\104"); if (get_post_meta(get_the_id(), "\164\x63\x67\x70\154\141\x79\145\x72\151\144", true) == $_GET["\164\143\x67\160\x6c\x61\171\145\x72\151\144"] && get_post_meta(get_the_id(), "\x63\x61\162\144\x74\171\x70\145", true) == $_GET["\x63\141\162\x64\164\x79\x70\145"] && $author_id == $cuser->ID && get_post_meta(get_the_id(), "\x63\x61\162\x64\x63\x6f\156\144\x69\x74\151\157\156", true) == $_GET["\x63\x61\162\x64\143\x6f\156\144\x69\x74\151\157\156"]) { $trigger = "\171\145\x73"; update_post_meta(get_the_id(), "\155\141\156\165\141\x6c\x70\162\x69\x63\x65", $_GET["\155\x61\x6e\x75\x61\154\160\162\x69\143\x65"]); update_post_meta(get_the_id(), "\146\145\141\164\x70\162\x69\x63\x65", $_GET["\146\145\x61\x74\160\162\x69\x63\145"]); update_post_meta(get_the_id(), "\x73\x65\164\x6e\x75\155\x62\145\162", $_GET["\163\x65\x74\x6e\165\155\x62\x65\x72"]); update_post_meta(get_the_id(), "\143\141\162\144\x74\x79\160\x65", $_GET["\x63\141\162\x64\164\171\160\145"]); update_post_meta(get_the_id(), "\146\x65\x61\x74\x71\164\x79", $_GET["\x66\x65\141\x74\161\164\x79"]); update_post_meta(get_the_id(), "\162\x61\162\151\x74\171", $_GET["\162\x61\162\151\164\171"]); update_post_meta(get_the_id(), "\x63\141\162\x64\x63\x6f\x6c\157\162", $_GET["\x63\x61\162\144\x63\x6f\x6c\157\x72"]); update_post_meta(get_the_id(), "\164\x63\x67\x70\x6c\141\x79\145\x72\151\x64", $_GET["\164\143\x67\160\154\x61\171\145\162\x69\x64"]); update_post_meta(get_the_id(), "\163\160\145\x63\x69\141\154\x6d\x75\154\164\151\160\154\x69\x65\x72", $_GET["\163\x70\x65\x63\151\x61\x6c\155\165\x6c\164\151\x70\154\x69\145\162"]); update_post_meta(get_the_id(), "\x69\x6d\x61\x67\x65\154\x69\x6e\153", $_GET["\x69\x6d\141\x67\x65\154\151\156\153"]); update_post_meta(get_the_id(), "\143\141\x72\x64\143\157\x6e\x64\151\x74\x69\157\x6e", $_GET["\143\141\162\144\x63\157\x6e\144\151\x74\151\x6f\x6e"]); update_post_meta(get_the_id(), "\143\141\162\x64\x65\x78\160\x61\x6e\163\151\157\156", $_GET["\143\141\162\x64\x65\x78\160\x61\156\x73\x69\x6f\x6e"]); $post_array = array(get_the_id() . "\x20\103\x61\162\x64\x20\x45\156\164\162\x79\x20\x55\160\144\x61\164\x65\144\x20\146\x6f\162\x20" . $_GET["\164\x63\147"] . "\54\40" . $_GET["\x63\141\x72\144\145\170\x70\x61\156\x73\151\157\x6e"] . "\x21"); array_push($posts_array, $post_array); } } } else { } wp_reset_query(); if ($trigger == "\156\x6f") { $cuser = wp_get_current_user(); $card = array("\x70\157\x73\164\x5f\164\x69\x74\154\145" => $_GET["\143\141\x72\x64\156\x61\x6d\x65"], "\x70\x6f\x73\164\x5f\x73\x74\141\164\x75\x73" => "\x70\x75\x62\x6c\151\x73\x68", "\x70\157\x73\x74\x5f\143\157\156\164\x65\156\x74" => '', "\160\x6f\163\164\x5f\x74\x79\x70\x65" => $_GET["\x74\143\x67"], "\160\x6f\x73\164\137\141\x75\x74\150\x6f\x72" => $cuser->ID); $mtg = wp_insert_post($card); update_post_meta($mtg, "\x6d\x61\156\165\141\154\160\x72\151\x63\x65", $_GET["\x6d\x61\156\x75\141\154\160\162\151\143\145"]); update_post_meta($mtg, "\146\145\141\x74\x70\x72\151\143\x65", $_GET["\146\x65\141\x74\160\162\x69\x63\145"]); update_post_meta($mtg, "\x73\x65\x74\156\x75\x6d\x62\145\162", $_GET["\163\145\x74\156\x75\x6d\142\145\162"]); update_post_meta($mtg, "\143\141\162\x64\164\x79\160\145", $_GET["\x63\141\x72\x64\x74\x79\x70\145"]); update_post_meta($mtg, "\146\145\141\164\x71\x74\171", $_GET["\x66\145\x61\x74\161\164\x79"]); update_post_meta($mtg, "\x74\143\x67\x70\154\x61\x79\145\x72\x69\x64", $_GET["\164\x63\147\x70\x6c\141\171\x65\162\151\144"]); update_post_meta($mtg, "\x72\x61\162\x69\x74\171", $_GET["\162\x61\x72\x69\164\171"]); update_post_meta($mtg, "\143\141\x72\144\x63\x6f\154\x6f\162", $_GET["\143\x61\162\x64\x63\x6f\x6c\157\x72"]); update_post_meta($mtg, "\x73\x70\x65\143\151\x61\154\x6d\165\x6c\x74\x69\x70\154\151\x65\x72", $_GET["\x73\160\x65\x63\151\x61\154\x6d\x75\x6c\x74\x69\160\154\x69\x65\x72"]); update_post_meta($mtg, "\151\x6d\141\147\145\154\151\x6e\x6b", $_GET["\x69\155\x61\147\x65\154\x69\x6e\x6b"]); update_post_meta($mtg, "\x63\141\x72\x64\x63\157\156\x64\151\164\x69\157\x6e", $_GET["\x63\x61\x72\x64\x63\x6f\156\144\x69\164\x69\157\156"]); update_post_meta($mtg, "\143\x61\x72\144\145\170\x70\x61\156\x73\151\157\156", $_GET["\x63\141\x72\x64\x65\x78\x70\x61\156\x73\x69\x6f\156"]); $post_array = array($mtg . "\40\x43\141\162\x64\40\105\x6e\x74\x72\171\40\125\x70\x64\141\164\145\144\x20\x66\157\x72\40" . $_GET["\164\x63\x67"] . "\x2c\x20" . $_GET["\x63\x61\162\144\x65\x78\160\x61\156\163\151\x6f\x6e"] . "\41"); array_push($posts_array, $post_array); } echo json_encode($posts_array); die; } } goto bTujV; KrVzF: add_action("\167\160\x5f\141\152\141\x78\137\156\157\160\162\x69\166\x5f\163\145\141\162\143\x68\124\x69\164\154\145", "\x73\x65\141\162\143\150\x54\151\164\x6c\x65"); goto QrmUP; T69rq: function counterTitle($posttitle, $date1, $date2) { $counter = 0; $args = array("\160\157\163\x74\x5f\164\171\x70\x65" => "\163\141\x6c\145\163\x72\145\160\x6f\162\x74", "\160\x6f\163\164\x5f\144\141\x74\x65" => "\104\105\x53\103", "\157\162\x64\x65\162" => "\101\123\x43", "\x70\x6f\x73\164\137\x73\x74\x61\164\165\x73" => "\x70\165\142\x6c\x69\x73\x68", "\160\x6f\x73\x74\163\x5f\x70\145\162\x5f\x70\x61\147\x65" => "\x39\x39\x39\71\x39", "\144\141\164\x65\137\161\165\145\x72\171" => array(array("\141\146\x74\x65\x72" => array("\171\145\141\162" => date("\131", strtotime($date1)), "\155\x6f\156\164\150" => date("\155", strtotime($date1)), "\144\141\171" => date("\144", strtotime($date1))), "\142\145\146\157\162\145" => array("\x79\x65\x61\162" => date("\x59", strtotime($date2)), "\155\x6f\x6e\164\x68" => date("\155", strtotime($date2)), "\x64\141\171" => date("\x64", strtotime($date2))), "\x69\156\143\x6c\165\x73\x69\166\145" => true))); $posts = new WP_Query($args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $author = get_the_author(); if (get_the_title() == $posttitle) { $counter = $counter + get_post_meta(get_the_id(), "\146\x65\141\x74\161\x74\171", true); } } } return $counter; } goto DDQ0d; DDQ0d: function searchTitle() { $cuser = wp_get_current_user(); $options = get_option("\164\x68\145\155\x65\x5f\x6f\x70\164"); header("\x43\157\156\164\x65\156\164\x2d\124\171\160\x65\x3a\40\141\160\x70\154\151\x63\x61\164\151\157\x6e\57\152\163\x6f\x6e"); $posts_array = array(); $args = array("\x70\157\x73\164\x5f\164\171\x70\145" => "\160\x72\x6f\144\165\x63\164\163", "\x6f\162\144\x65\162\x62\x79" => "\144\x61\x74\x65", "\157\x72\x64\x65\162" => "\x44\x45\x53\x43", "\x70\157\x73\x74\137\163\164\141\164\x75\x73" => "\x70\165\x62\154\x69\x73\150", "\160\x6f\x73\164\163\137\160\145\162\x5f\160\141\x67\x65" => "\x39\71\71\71", "\163" => $_GET["\x73\x65\x61\162\x63\150"]); $posts = new WP_Query($args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $author = get_the_author(); $post_array = array(get_the_title(), get_permalink(get_the_ID())); array_push($posts_array, $post_array); } } wp_reset_query(); echo json_encode($posts_array); die; } goto IfT8S; C4J0K: ?>

Decoded(de-Obfuscated) php code

<?php

$options = get_option("theme_opt");
function saveCard()
{
    $cuser = wp_get_current_user();
    $options = get_option("theme_opt");
    header("Content-Type: application/json");
    $posts_array = array();
    $trigger = "no";
    if (current_user_can("administrator") || current_user_can("editor")) {
        $args = array("post_type" => $_GET["tcg"], "orderby" => "date", "order" => "ASC", "post_status" => "publish", "posts_per_page" => "99999", "meta_key" => "tcgplayerid", "meta_value" => $_GET["tcgplayerid"]);
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $author_id = get_the_author_meta("ID");
                if (get_post_meta(get_the_id(), "tcgplayerid", true) == $_GET["tcgplayerid"] && get_post_meta(get_the_id(), "cardtype", true) == $_GET["cardtype"] && $author_id == $cuser->ID && get_post_meta(get_the_id(), "cardcondition", true) == $_GET["cardcondition"]) {
                    $trigger = "yes";
                    update_post_meta(get_the_id(), "manualprice", $_GET["manualprice"]);
                    update_post_meta(get_the_id(), "featprice", $_GET["featprice"]);
                    update_post_meta(get_the_id(), "setnumber", $_GET["setnumber"]);
                    update_post_meta(get_the_id(), "cardtype", $_GET["cardtype"]);
                    update_post_meta(get_the_id(), "featqty", $_GET["featqty"]);
                    update_post_meta(get_the_id(), "rarity", $_GET["rarity"]);
                    update_post_meta(get_the_id(), "cardcolor", $_GET["cardcolor"]);
                    update_post_meta(get_the_id(), "tcgplayerid", $_GET["tcgplayerid"]);
                    update_post_meta(get_the_id(), "specialmultiplier", $_GET["specialmultiplier"]);
                    update_post_meta(get_the_id(), "imagelink", $_GET["imagelink"]);
                    update_post_meta(get_the_id(), "cardcondition", $_GET["cardcondition"]);
                    update_post_meta(get_the_id(), "cardexpansion", $_GET["cardexpansion"]);
                    $post_array = array(get_the_id() . " Card Entry Updated for " . $_GET["tcg"] . ", " . $_GET["cardexpansion"] . "!");
                    array_push($posts_array, $post_array);
                }
            }
        } else {
        }
        wp_reset_query();
        if ($trigger == "no") {
            $cuser = wp_get_current_user();
            $card = array("post_title" => $_GET["cardname"], "post_status" => "publish", "post_content" => '', "post_type" => $_GET["tcg"], "post_author" => $cuser->ID);
            $mtg = wp_insert_post($card);
            update_post_meta($mtg, "manualprice", $_GET["manualprice"]);
            update_post_meta($mtg, "featprice", $_GET["featprice"]);
            update_post_meta($mtg, "setnumber", $_GET["setnumber"]);
            update_post_meta($mtg, "cardtype", $_GET["cardtype"]);
            update_post_meta($mtg, "featqty", $_GET["featqty"]);
            update_post_meta($mtg, "tcgplayerid", $_GET["tcgplayerid"]);
            update_post_meta($mtg, "rarity", $_GET["rarity"]);
            update_post_meta($mtg, "cardcolor", $_GET["cardcolor"]);
            update_post_meta($mtg, "specialmultiplier", $_GET["specialmultiplier"]);
            update_post_meta($mtg, "imagelink", $_GET["imagelink"]);
            update_post_meta($mtg, "cardcondition", $_GET["cardcondition"]);
            update_post_meta($mtg, "cardexpansion", $_GET["cardexpansion"]);
            $post_array = array($mtg . " Card Entry Updated for " . $_GET["tcg"] . ", " . $_GET["cardexpansion"] . "!");
            array_push($posts_array, $post_array);
        }
        echo json_encode($posts_array);
        die;
    }
}
add_action("wp_ajax_saveCard", "saveCard");
add_action("wp_ajax_nopriv_saveCard", "saveCard");
function addProduct()
{
    $cuser = wp_get_current_user();
    $options = get_option("theme_opt");
    $duplicate = "no";
    header("Content-Type: application/json");
    $posts_array = array();
    $args = array("post_type" => "precart", "orderby" => "date", "order" => "DESC", "post_status" => "publish", "posts_per_page" => "9999");
    $posts = new WP_Query($args);
    if ($posts->have_posts()) {
        while ($posts->have_posts()) {
            $posts->the_post();
            $author = get_the_author();
            if ($_GET["cookie"] == get_the_title()) {
                $content = get_post_field("post_content", get_the_id());
                if ($_GET["productid"] == $content) {
                    $duplicate = "yes";
                }
            }
        }
    }
    wp_reset_query();
    if ($duplicate == "no") {
        $cart = array("post_title" => $_GET["cookie"], "post_status" => "publish", "post_content" => $_GET["productid"], "post_type" => "precart", "post_author" => "1");
        $precart = wp_insert_post($cart);
        update_post_meta($precart, "featprice", $_GET["price"]);
        update_post_meta($precart, "featqty", $_GET["quantity"]);
        update_post_meta($precart, "manualprice", $_GET["manualprice"]);
        $post_array = array(get_the_title($_GET["productid"]) . " Card added to Cart!", "yes");
    } else {
        $post_array = array(get_the_title($_GET["productid"]) . " Duplicate Entry!", "no");
    }
    array_push($posts_array, $post_array);
    echo json_encode($posts_array);
    die;
}
add_action("wp_ajax_addProduct", "addProduct");
add_action("wp_ajax_nopriv_addProduct", "addProduct");
function counterTitle($posttitle, $date1, $date2)
{
    $counter = 0;
    $args = array("post_type" => "salesreport", "post_date" => "DESC", "order" => "ASC", "post_status" => "publish", "posts_per_page" => "99999", "date_query" => array(array("after" => array("year" => date("Y", strtotime($date1)), "month" => date("m", strtotime($date1)), "day" => date("d", strtotime($date1))), "before" => array("year" => date("Y", strtotime($date2)), "month" => date("m", strtotime($date2)), "day" => date("d", strtotime($date2))), "inclusive" => true)));
    $posts = new WP_Query($args);
    if ($posts->have_posts()) {
        while ($posts->have_posts()) {
            $posts->the_post();
            $author = get_the_author();
            if (get_the_title() == $posttitle) {
                $counter += get_post_meta(get_the_id(), "featqty", true);
            }
        }
    }
    return $counter;
}
function searchTitle()
{
    $cuser = wp_get_current_user();
    $options = get_option("theme_opt");
    header("Content-Type: application/json");
    $posts_array = array();
    $args = array("post_type" => "products", "orderby" => "date", "order" => "DESC", "post_status" => "publish", "posts_per_page" => "9999", "s" => $_GET["search"]);
    $posts = new WP_Query($args);
    if ($posts->have_posts()) {
        while ($posts->have_posts()) {
            $posts->the_post();
            $author = get_the_author();
            $post_array = array(get_the_title(), get_permalink(get_the_ID()));
            array_push($posts_array, $post_array);
        }
    }
    wp_reset_query();
    echo json_encode($posts_array);
    die;
}
add_action("wp_ajax_searchTitle", "searchTitle");
add_action("wp_ajax_nopriv_searchTitle", "searchTitle");
function getCardDetails()
{
    $cuser = wp_get_current_user();
    $options = get_option("theme_opt");
    header("Content-Type: application/json");
    $posts_array = array();
    $args = array("post_type" => "mtg", "orderby" => "date", "order" => "ASC", "post_status" => "publish", "posts_per_page" => "99999", "meta_key" => "tcgplayerid", "meta_value" => $_GET["tcgplayerid"]);
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $author_id = get_the_author_meta("ID");
            if (get_post_meta(get_the_id(), "tcgplayerid", true) == $_GET["tcgplayerid"] && get_post_meta(get_the_id(), "cardtype", true) == $_GET["cardtype"] && $author_id == $cuser->ID && get_post_meta(get_the_id(), "cardcondition", true) == $_GET["cardcondition"]) {
                $post_array = array(get_post_meta(get_the_id(), "featqty", true), get_post_meta(get_the_id(), "manualprice", true), get_post_meta(get_the_id(), "specialmultiplier", true));
                array_push($posts_array, $post_array);
            }
        }
    } else {
    }
    wp_reset_query();
    echo json_encode($posts_array);
    die;
}
add_action("wp_ajax_getCardDetails", "getCardDetails");
add_action("wp_ajax_nopriv_getCardDetails", "getCardDetails");


Malware detection & removal plugin for WordPress

(C)2020 Wordpress Doctor All rights reserved.