Results 1 to 5 of 5

Thread: Can't find Security Questions

  1. #1
    Join Date
    Oct 2008
    Posts
    46

    Default Can't find Security Questions

    Can someone tell me how I can display what question a user has selected as their security question? I know how to retrieve the securityqid but I cannot find the actual question in the database anywhere. Is the actual question encrypted? How can I display the question if I know the ID?

    Thanks

  2. #2
    Join Date
    Jan 2010
    Location
    Toronto, Canada
    Posts
    413

    Default

    From what I can tell the security questions are encrypted for whatever reason. WHMCS seems to have a decrypt function to decrypt the questions.

    Though I am not sure exactly how to decrypt them. Maybe this API function can decrypt the security questions?
    http://wiki.whmcs.com/APIecrypt_Password
    OAuth for WHMCS: A revolution to your API that will rock your world.
    Get It NOW! | Read More About It!

  3. #3
    Join Date
    Mar 2008
    Posts
    142

    Default

    Try this:
    Code:
    $result = mysql_query("SELECT question,securityqans FROM tblclients,tbladminsecurityquestions WHERE tblclients.id=".$_SESSION["uid"]." AND tblclients.securityqid = tbladminsecurityquestions.id");
    while($row = @mysql_fetch_array( $result )) {
      $question = decrypt($row['question']);
    }
    if (!$question) {
      echo 'No question set';
    }else{
      echo $question;
    }
    Last edited by robb3369; 04-24-10 at 04:45 PM. Reason: fixed query
    Thanx!
    Rob

  4. #4
    Join Date
    Oct 2008
    Posts
    46

    Default

    For some reason this did not work, I even hard coded the userID and this didn't show a question. No matter what 'no question set' was displayed.

    Since I do all my own coding etc I just decided to hard code the question selections in an array and used securityqid to select the correct question from the array. Works as well with only one obvious drawback.

  5. #5
    Join Date
    Mar 2008
    Posts
    142

    Default

    You are running that query within the context of the whmcs system correct? I just re-verified the folliwng snippet of code by appending it to the bottom of the clientareadetails.tpl template and it worked like a champ:
    Code:
    {php}
    $result = mysql_query("SELECT question,securityqans FROM tblclients,tbladminsecurityquestions WHERE tblclients.id=".$_SESSION["uid"]." AND tblclients.securityqid = tbladminsecurityquestions.id");
    while($row = @mysql_fetch_array( $result )) {
      $question = decrypt($row['question']);
    }
    if (!$question) {
      echo 'No question set';
    }else{
      echo $question;
    }
    {/php}
    And just for a sanity check, does the whmcs admin page for the client (Clients Profile -> Profile Tab) show a security question set?
    Thanx!
    Rob

Similar Threads

  1. Newby questions I can't find answers to!
    By steveharman in forum Pre-Sales Questions
    Replies: 1
    Last Post: 05-20-12, 04:22 PM