使用mysqli / PHP加密/解密

时间:2018-01-03 16:21:34

标签: php encryption mysqli

我需要加密下一页中字段中的数据,以便加密存储。在第二页上,我需要从表中提取数据并再次显示它解密。

由于医学原因,我在学习和/或修改解决方案时遇到了一些问题,但是,我能够看到一个有效的例子,然后从那里开始工作。

文件1

Sub twoDBOneOracleOneAccess()
Dim con As ADODB.Connection
Dim strDB2 As String
Dim rs As ADODB.Recordset

Set con = New ADODB.Connection

strDB2 = "....\daotest2.accdb"

mysql = "select MUSTERI_ID,MUSTERI_BAGLI_OLDUGU_SUBE_ID from OracleTable a inner join [" & strDB2 & "].şb on (şb.şb=a.MUSTERI_BAGLI_OLDUGU_SUBE_ID) where A.MESLEK_KODU=2041"

With con
    .ConnectionString = "Provider=OraOLEDB.Oracle;Data Source........;"
    .Open
End With

Set rs = New ADODB.Recordset
rs.Open mysql, con, adOpenKeyset, adLockOptimistic

ActiveCell.CopyFromRecordset rs

End Sub

文件2

<?php
    require_once('../../Connections/Mysqli.php');
    require_once('../../webassist/mysqli/queryobj.php');

    if($_SERVER["REQUEST_METHOD"] == "POST") {
        $InsertQuery = new WA_MySQLi_Query($Mysqli);
        $InsertQuery->Action = "insert";
        $InsertQuery->Table = "Kryptest";
        $InsertQuery->bindColumn("Navn", "s", "" . ((isset($_POST["Navn"])) ? $_POST["Navn"] : "") . "", "WA_DEFAULT");
        $InsertQuery->bindColumn("Password", "s", "" . ((isset($_POST["Password"])) ? $_POST["Password"] : "") . "", "WA_DEFAULT");
        $InsertQuery->bindColumn("CPR", "s", "" . ((isset($_POST["CPR"])) ? $_POST["CPR"] : "") . "", "WA_DEFAULT");
        $InsertQuery->saveInSession("");
        $InsertQuery->execute();
        $InsertGoTo = "index.php";
        if(function_exists("rel2abs"))
            $InsertGoTo = $InsertGoTo ? rel2abs($InsertGoTo, dirname(__FILE__)) : "";
        $InsertQuery->redirect($InsertGoTo);
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Krypterede data ind</title>
    </head>
    <body>
        <p>Sæt data ind</p>
        <form id="form1" name="form1" method="post" action="">
            <p>
                <label for="Navn">Navn</label>
                <input type="text" name="Navn" id="Navn" />
            </p>
            <p>
                <label for="Password">Password</label>
                <input type="text" name="Password" id="Password" />
            </p>
            <p>
                <label for="CPR">CPR</label>
                <input type="text" name="CPR" id="CPR" />
            </p>
            <p>
                <input type="submit" name="Submit" id="Submit" value="Submit" />
            </p>
        </form>
        <p>&nbsp;</p>
    </body>
</html>

0 个答案:

没有答案