You are here

constant_contact.ajax.php in Constant Contact 6.2

Same filename and directory in other branches
  1. 6.3 constant_contact.ajax.php

File

constant_contact.ajax.php
View source
<?php

/**
 * @file
 */

/**
 * Authenticates with the API
 * This is used for the admin settins page to check the details they entered
 */
function constant_contact_auth($username, $password, $api_key) {
  if ($username && $password && $api_key) {
    require_once './class.cc.php';
    $cc = new cc($username, $password, $api_key);
    if ($cc
      ->get_service_description()) {
      return $cc;
    }
  }
  return false;
}
$username = $_GET['username'] ? strip_tags($_GET['username']) : '';
$password = $_GET['password'] ? strip_tags($_GET['password']) : '';
$api_key = $_GET['apikey'] ? strip_tags($_GET['apikey']) : '';
$result = constant_contact_auth($username, $password, $api_key);
if ($result) {
  echo '<div class="cc_auth_res" style="color:green;">Authenticated OK, please click the "Save configuration" button below before changing any other settings on this page</div>';
}
else {
  echo '<div class="cc_auth_res" style="color:red;">Authenticated Failed, please check your account details are entered correctly</div>';
}

Functions

Namesort descending Description
constant_contact_auth Authenticates with the API This is used for the admin settins page to check the details they entered