echo $response;
    ?>
").fadeIn().delay(3000).fadeOut(4000);
       });
</script><?php 
}
// Adding API Key by Pop UP into our wp database
if (isset($_POST['add_apiKey']) || isset($_POST['laid_save'])) {
    global $wpdb;
    if (!empty($_POST['apikey'])) {
        //  $query = mysql_query("SELECT api_key FROM " . $wpdb->prefix . "linksync_laidKey WHERE api_key='" . $_POST['apikey'] . "'");
        //  if (0 == mysql_num_rows($query)) {
        $query_api_key = mysql_query("SELECT api_key  FROM " . $wpdb->prefix . "linksync_laidKey");
        if (0 == mysql_num_rows($query_api_key)) {
            if ($wpdb->insert($wpdb->prefix . 'linksync_laidKey', array('api_key' => trim($_POST['apikey']), 'status' => 'Under Process', 'date_add' => date('Y/m/d')))) {
                $result = linksync::checkForConnection($_POST['apikey']);
                if (get_option('linksync_laid') == '') {
                    update_option('linksync_laid', trim($_POST['apikey']));
                }
                $class1 = 'error';
                $class2 = 'updated';
                linksync_class::add('Manage API Keys', 'success', 'API Key Added Successfully', $_POST['apikey']);
                $response = 'API Key has been added successfully.!';
            } else {
                linksync_class::add('Manage API Keys', 'fail', 'Unable to Insert', $_POST['apikey']);
            }
            if (isset($result['success'])) {
                //If Connection is established than save to database:
                $response = $result['success'];
                $class1 = 'error';
                $class2 = 'updated';