Functiile openssl_encrypt() si openssl_decrypt() pot fi utilizate pentru a cripta si decripta text in PHP.
Pot fi utile la criptarea si decriptarea parolei intr-un script de inregistrare /logare.

- Iata un exemplu simplu cu functiile openssl_encrypt() si openssl_decrypt().
<?php
$password = 'user_pass'; //password added by user $_POST['password']
$key_enc = '1234'; //key for encrypt
$met_enc = 'aes256'; //method to encrypt: aes128, aes192, aes256, blowfish, cast-cbc
$iv = '16_characters_ok'; //a random string with 16 characters

//encrypts the password
$pass_enc = openssl_encrypt($password, $met_enc, $key_enc, 0, $iv);
echo $pass_enc; // "uw4QKRUsG+l17w5epb7nKw=="

//decrypts the encrypted password, it uses the same arguments: $met_enc, $key_enc, $opt=0, $iv
$pass_enc ='uw4QKRUsG+l17w5epb7nKw=='; //the encrypted password
$pass = openssl_decrypt($pass_enc, $met_enc, $key_enc, 0, $iv);
echo '<br>'.$pass; // "user_pass"
?>

Observati ca functia openssl_decrypt() trebuie sa foloseasca aceleasi argumente (aici: $met_enc, $key_enc, $opt=0, $iv) pentru decriptarea sirului criptat cu openssl_encrypt().

Un Test simplu in fiecare zi

HTML
CSS
JavaScript
PHP-MySQL
Engleza
Spaniola
Care tag este element de tip bloc?
<div> <img> <span>
<div>Web Programming and Development</div>
Care cod CSS afiseaza textul subliniat?
font-style: italic; text-decoration: underline; font-weight: 500;
h2 {
  text-decoration: underline;
}
Clic pe functia JavaScript care apeleaza o alta functie dupa un anumit timp.
insertBefore() setTimeout() querySelector()
function someFunction() { alert("CoursesWeb.net"); }
setTimeout("someFunction()", 2000);
Clic pe instructiunea care returneaza numarul total de elemente dintr-un array asociativ.
count($array) count($array, 1) strlen()
$food =["fruits" =>["banana", "mar"), "veggie" =>["ceapa", "rosie"));
$nr_food = count($food, 1);
echo $nr_food;       // 6
Indicati Viitorul Perfect la negativ al verbului din paranteze, in propozitia: "The child (to not play) by Sunday".
has't played haven't been playing will haven't played
The child will haven't played by Sunday.
- Copilul nu s-ar fi jucat pana duminica.
Indicati Viitorul Perfect pentru verbul "contar" (a povesti) la forma "Él".
habrá contado va a contar contaba
Él no habrá contado el cuento.
- El nu ar fi spus povestea.
Utilizare openssl_encrypt si openssl_decrypt in PHP

Last accessed pages

  1. Formatare text in pagina html (10379)
  2. Coduri pt culori (19725)
  3. Introducere in HTML (6374)
  4. Conditional IF in Limba Engleza - Fraze Conditionale (26514)
  5. Demonstrative (319)

Popular pages this month

  1. Gramatica limbii engleze - Prezentare Generala (3159)
  2. Conditional IF in Limba Engleza - Fraze Conditionale (2347)
  3. Cursuri si Tutoriale: Engleza, Spaniola, HTML, CSS, Php-Mysql, JavaScript, Ajax (2127)
  4. Curs HTML gratuit Tutoriale HTML5 (1433)
  5. Prezentul simplu si continuu - Present Tense Simple and Continuous (1410)