Jump to content

Display Card Expiry Date on Home (clientarea.php) Page.


elijahpaul

Recommended Posts

I'm trying to figure out how to display the Clients Card expiry date on the home page template.

 

Do I need to pull this from WHMCS directly? If so how? I noticed the 'expdate' in MySQL is a 'BLOB' value, so...

 

Since I have ServerPing's Stripe module installed, does this mean I have to pull the card expiry date from stripe directly via the module?

 

Any help or suggestions appreciated.?

Link to comment
Share on other sites

  • 2 months later...

With a little more MySQL experience under my belt, managed to figure this out.

 

ServerPings Stripe module stores the encrypted card expiry in the database using a hash.

 

You just have to decrypt and pull the value using the hash and SQL commands.

 

  $whmcs_client_id = $_SESSION['uid'];

  global $cc_encryption_hash;
  $cchash = md5($cc_encryption_hash.$whmcs_client_id);

  $result = mysql_query("SELECT AES_DECRYPT(expdate, '". $cchash. "') FROM tblclients WHERE id=". $whmcs_client_id);
  $data = mysql_fetch_array($result);
  $ccexp = $data[0];    

  $ccexpdate = substr(chunk_split($ccexp, 2, '/'), 0, -1);

 

The 'substr(chunk_split' converts the 4 digit expiry date 'MMYY' to 'MM/YY'.

Edited by elijahpaul
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated