<?php
 $ID=$_GET['id'];
 if ($ID==""){
              echo "Error: No ID;";
              exit();
             }
require_once("../../../wp-load.php");
global $wpdb; 
$PGPath=plugins_url()."/clickbar_gold/";
$re=" SELECT * FROM ".$wpdb->prefix . "clickbar WHERE C_ID='$ID' ";
$row = $wpdb -> get_results($re);
foreach( $row as $rows ) {
                         $RedirectURL=$rows->RedirectURL;
                         }
$DateX=date('m/d/Y');
$wpdb->insert( 
	            $wpdb->prefix . "clickbar_clicks", 
	                                            array( 
		                                                'DateX' => $DateX,
                                                    'ForBar'=>$ID 
	                                                 ));
header('location: '.$RedirectURL);                                                                              
?>