* The Initial Developer of the Original Code is Cognizo Technologies, Inc.
* Portions created by the Initial Developer are Copyright (C) 2005 - 2007
* (or from the year in which this file was created to the year 2007) by
* Cognizo Technologies, Inc. All Rights Reserved.
*
*
* $Id: getCandidateIdByPhone.php 3078 2007-09-21 20:25:28Z will $
*/
$interface = new SecureAJAXInterface();
include 'lib/Candidates.php';
if (!isset($_REQUEST['phone'])) {
    die('Invalid E-Mail address.');
}
$siteID = $interface->getSiteID();
$phone = $_REQUEST['phone'];
$candidates = new Candidates($siteID);
$output = "<data>\n";
$candidateID = $candidates->getIDByPhone($phone);
if ($candidateID == -1) {
    $output .= "    <candidate>\n" . "        <id>-1</id>\n" . "    </candidate>\n";
} else {
    $candidateRS = $candidates->get($candidateID);
    $output .= "    <candidate>\n" . "        <id>" . $candidateID . "</id>\n" . "        <name>" . $candidateRS['candidateFullName'] . "</name>\n" . "    </candidate>\n";
}
$output .= "</data>\n";
/* Send back the XML data. */
$interface->outputXMLPage($output);
?>