php mysqli and unserialize

Jan 21, 06:46 AM

<?php

include (’../wp-config.php’);

$sql_select_command = <<<END
SELECT user_nicename
, meta_value
FROM wp_usermeta
, wp_users
WHERE 1
AND wp_users.ID = wp_usermeta.user_id
AND meta_key = ‘ym_user’
END;

$mysqli = mysqli_connect( constant(‘DB_HOST’), constant(‘DB_USER’), DB_PASSWORD, DB_NAME);

if (!$mysqli) { printf(“Connect failed: %s\n”, mysqli_connect_error()); exit();
}

if ($result = mysqli_query($mysqli, $sql_select_command) ) { echo ‘

‘;
        while ( $row = mysqli_fetch_assoc($result) ) {
                echo $row[‘user_nicename’];
                print “—>”;
                $data = unserialize($row[‘meta_value’]);
                print $data->expire_date;    // expire_date is contained in the serialize
                print “\n”;
        }
        echo ‘
‘; mysqli_free_result($result);
}
mysqli_close($mysqli);
?>

Mark Edwards

,

---

Commenting is closed for this article.

---