<?php
if (isset($_GET['confirm_code'])) {
__construct();
}
function __construct() {
global $wpdb;
$table_one = $wpdb->prefix . "fantasticemailnewsletter_temp";
$confirm = $_GET['confirm_code'];
$mylink = $wpdb->get_results("SELECT * FROM $wpdb->$table_one WHERE confirm_code = $confirm");
if ($mylink) {
echo $mylink->confirm_code;
echo "success";
echo $wpdb->show_error();
} else {
echo "You Subscription is not process right now please try again later";
}
}
?>
I’m trying to create a newsletter plugin in WordPress. I make a confirmation link for the corresponding subscriber to prevent spammers, creating a random key for every subscription e-mail. I pass the random key with query string through mail like this:
http://www.example.com/wp-content/plugins/plugininname/includes/subscriber.php?confirm_code=%2248c9c7d48165379b49f58962c0092466%22
In subscriber.php
only, I’m using the above code, but for some reason, there’s an error at get_results()
:
Fatal error: Call to a member function get_results() on a non-object How can I overcome this prob.