php - Can't insert value to table using PDO & MSSQL -


I have this php function that encrypts the password provided by a form: 0xb539dbae17ef3d7c49d0f6f63ba18787 .

Function Encrypt ($ str) {$ key = array (); $ Dst = array (); $ I = 0; $ NBytes = strlen ($ str); While ($ i & lt; $ nBytes) {$ i ++; $ [$ I] = ord (substrate ($ str, $ i - 1, 1)); $ Dst [$ i] = $ of [$ i]; } $ Rslt = $ Key of [1] + $ Key [2] * Key of $ 256 + $ [3] * Key of 65536 + $ [4] * 16777216; $ One = $ rslt * 21311 9 + 252977; $ One = $ one - interval ($ one / 429, 97272) * 42 9 4967296; $ 5 $ + $ key [6] * Key of $ 256 + $ [7] * Key of $ 65536 + $ [8] * 16777216; $ 2 = $ rslt * 213247 + 252 9 9 9; $ 2 = $ two - interval ($ 2/42 9, 97272) * 42 9 4967296; $ 9 = $ Key of [9] + $ Key [10] * Key of 256 + $ [11] * 65536 + $ Key [12] * 16777216; $ 3 = $ RSLT * 213203 + 252958 9; $ 3 = $ three - interval ($ 3/42 9, 97272) * 42 9 4967296; $ $ L for $ = $ [13] + $ key [14] * Key of 256 + $ [15] * 65536 + $ key [16] * 16777216; $ 4 = $ RSLT * 213821 + 2529997; $ 4 = $ 4 - Interval ($ 4/42 9, 97272) * 42 9 4967296; $ Of [4] = interval ($ one / 16777216); $ Of [3] = interval (($ one - $ key [4] * 16777216) / 65535); $ Of [2] = interval (($ one - $ of [4] * 16777216 - $ key [3] * 65536) / 256); $ [= 1] = interval of $ (($ one - $ key [4] * 16777216 - $ key [3] * 65536 - $ key [2] * 256); $ Of [8] = interval ($ 2/16777216); $ Of [7] = interval (($ $ two - $ key [8] * 16777216) / 65535); $ [= 6] = interval (($ 2 - $ of [8] * 16777216 - $ of [7] * 65536) / 256); $ [= 5] = interval (($ $ 2 - $ key [8] * 16777216 - $ key [7] * 65536 - $ key [6] * 256)); $ Of [12] = interval ($ 3/16777216); $ Of [11] = interval (($ three - $ key [12] * 16777216) / 65535); $ Of [10] = interval (($ three - $ key [12] * 16777216 - $ of [11] * 65536) / 256); $ Of [9] = interval (($ 3 - $ key [12] * 16777216 - $ key [11] * 65536 - $ of [10] * 256)); $ Of [16] = interval ($ 4/16777216); $ Of [15] = interval (($ 4 - $ of [16] * 16777216) / 65535); $ Of [14] = interval (($ 4 - $ of [16] * 16777216 - $ of [15] * 65536) / 256); $ Of [13] = interval (($ 4 - $ key [16] * 16777216 - $ key [15] * 65536 - $ of [14] * 256)); $ Dst [1] = $ dst [1] ^ $ of [1]; $ I = 1; While ($ i & lt; 16) {$ i ++; $ Dst [$ i] = $ dst [$ i] ^ $ dst [$ i-1] ^ $ of [$ i]; } $ I = 0; While ($ i & lt; 16) {$ i ++; If ($ dst [$ i] == 0] {$ dst [$ i] = 102; }} $ Encrypt = "0x"; $ I = =; While ($ i & lt; 16) {$ i ++; If ($ dst [$ i] & lt; 16) {$ encrypt = $ encrypt "0" dechex ($ DST [$ i]); } And {$ encrypt = $ encrypt dechex ($ DST [$ i]); }} $ Encrypt; }

The column in the database is [password] [binary] (16) no null

the query is:

  $ query = $ this- & gt; Db- & gt; Prepare ("user_ths (values ​​in account, password) value (?,?)"); $ Query-> Bind value (1, $ accname); $ Query-> Bind value (2, $ password); {$ Query-> carry about (); .................  

but it gives: indirect conversion of binary to data types varchar is not allowed when i Mssql_query , the w / o problems are executed to put you have tried convert (binary) but the data is not readable from that program Who uses them. Apart from this, the column was tried to change, but due to leopard this happened. Maybe I am doing wrong with the PDO statement?

Thanks in advance.


Comments