elijahpaul Posted August 25, 2013 Share Posted August 25, 2013 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.? 0 Quote Link to comment Share on other sites More sharing options...
elijahpaul Posted November 16, 2013 Author Share Posted November 16, 2013 (edited) 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 November 16, 2013 by elijahpaul 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.