1

I am trying to create a system which allows for authorizing a transaction via a Admin ID. I wish to have multiple Admin ID's, to track which user made the transaction.

$txtKnownAdminHash = "c0b71d437b9138ce3c1860b09b8923ebed6f8aeb3db4093458f38300f6f24eaa";     

$txtHashedAdminID = hash('sha256', $txtAdminID);
  if ($txtKnownAdminHash != $txtHashedAdminID) {

I want to allow for $txtKnownAdminHash to have multiple values, which is then checked.

Thank you for your help in advance

1 Answer 1

2

You can store all the Admin IDs in an array.

$txtKnownAdminHash = array("hash1", "hash2", "hash3", "hash4");

To check if the $txtHashedAdminID is in the array, you can use in_array(). This will check if $txtHashedAdminID is in $txtKnownAdminHash array:

<?php

    if (in_array($txtHashedAdminID, $txtKnownAdminHash)) {
        // the hash is in the array
    } else {
        // the hash is not in the array
    }

?>

Read more about:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.