亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用 php 搜索加密的 txt 文件

如何使用 php 搜索加密的 txt 文件

PHP
九州編程 2022-07-09 09:58:28
對于一個簡單的郵件列表,我將數據存儲在.txt文件中。在 txt 文件中有 5 行。其中 2 個(包含姓名和電子郵件)已加密。出于安全原因,我存儲了加密的姓名和電子郵件。這就是我搜索文件的方式:/* EMAIL SEARCH */$email_search = $_GET['email_search']; // get string from url for searchif (isset($email_search)) {    $searchthis = strtolower($email_search);        $email_matches = array();    $files = glob("subscribers/*.txt"); // Specify the file directory by extension (.txt)    foreach($files as $file) { // Loop the files in the directory   {        $handle = @fopen($file, "r");        if ($handle) {            $lines = file($file);                       $grab_email = strtolower($lines[3]); // for sorting only            while (!feof($handle)) {                $buffer = fgets($handle);                if(strpos(strtolower($buffer), $searchthis) !== FALSE) // strtolower; search word not case sensitive                        $email_matches[$file] = $grab_email; // put all lines in array  indexed by email            }            fclose($handle);        }    }}asort($email_matches);<!-- search form --><form class="search-form form-inline" action="admin.php" method="GET">      <div class="input-group mb-3">        <input class="form-control" type="text" name="email_search" placeholder="Search for..." />        <div class="input-group-append">                            <button class="btn btn-primary" type="submit">Search</button>        </div>    </div>                          </form>這是一個txt文件的樣子:id-5e0786c07c802 // idFriends //categoryygkKcL/jz9U= // name (encrypted)6gkKcL/jz9XuVRNayyIVcFbLw3ord0nc7IJj // email (encrypted)902d95a9bf1c3f59a3996e4e7b4dec79 // token以前,當數據未加密時,此搜索確實可以正常工作!但是,當每個文件中的名稱和電子郵件行被加密時,我現在如何搜索?
查看完整描述

1 回答

?
FFIVE

TA貢獻1797條經驗 獲得超6個贊

使用加密值搜索呢?

在您的代碼中,$_GET['email_search']包含您要搜索的單詞或值。我不知道您的加密方式如何,但您可以加密您正在搜索的單詞,例如:

$email_search = openssl_encrypt($_GET['email_search'], $ciphering, $encryption_key, $options, $encryption_iv); // get string from url for search


查看完整回答
反對 回復 2022-07-09
  • 1 回答
  • 0 關注
  • 119 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號