How to check existing client in WHMCS by email

Native WHMCS API allows us to register clients, but not to check if certain email is already in use. So this tiny function will help you to determine do you already have this client in your DB.

Save this file into whmcs_folder/includes/api/clientexist.php

if (!defined("WHMCS")) die("This file cannot be accessed directly");

$result = select_query("tblclients", "id", array("email" => $_POST['email']));
$data = mysql_fetch_assoc($result);

$result = array();
if (isset($data['id']) && $data['id'] != '')
    $result["result"] = TRUE;
    $result["result"] = FALSE;
echo json_encode($result);

It returns JSON encoded answer, so dont forget to decode it back when you check the result.

Little about me:

Im professional web developer. Love to work with PHP-driven projects. WHMCS seems to me the way to share my knowledges. Some of you may be interested in hiring me - drop me a line or take a look at my Odesk profile

1 Comment + Add Comment

  • I want to add some “part” of the email for registered clients only, it’s possible?
    {if $variblethat takeclientemailforclients eq $client_email}
    content for registred customers only

Leave a comment