Curs Php-mysql

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 HTML5 defineste un text marcat, evidentiat?
<mark> <embed> <span>
<p>Cursuri graruite: <mark>MarPlo.net</mark> , jocuri, anime.</p>
Ce pseudo-clasa CSS defineste un stil la element cand mouse-ul e deasupra lui?
:focus :hover :active
a:hover {
  font-weight: bold;
  color: #00da01;
}
Clic pe functia ce returneaza un sir cu un numar rotunjit la x decimale.
toPrecision(x) toFixed(x) floor(x)
var num = 12.34567;
num = num.toFixed(2);
alert(num);       // 12.35
Indicati functia PHP care adauga continutul unui fisier intr-un array.
[) file() readfile()
$arr = file("a_file.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
var_export($arr);
Clic pe raspunsul potrivit la intrebarea: "What time is it?"
On the 7th of July 1996 It is a quarter to 5. Nice weather.
What time is it? It is a quarter to 5.
- Cat este ora? E 5 fara un sfert.
Indicati raspunsul potrivit la intrebarea: "¿Qué hora es?"
Hace buen tiempo. En el 7 de julio de 1996 Son las tres menos cuarto.
¿Qué hora es? Son las tres menos cuarto.
- Cat este ora? E 3 fara un sfert.
Utilizare openssl_encrypt si openssl_decrypt in PHP

Last accessed pages

  1. Adverbele in limba engleza - Adverbs (33780)
  2. Prepozitii - Prepositions (34145)
  3. Scoala zeilor (5964)
  4. Diferenta dintre Like si As (12264)
  5. Cursuri Limba Rusa (6201)

Popular pages this month

  1. Cursuri si Tutoriale: Engleza, Spaniola, HTML, CSS, Php-Mysql, JavaScript, Ajax (214)
  2. Gramatica limbii spaniole. Indrumator si prezentare generala (154)
  3. Limba spaniola curs online incepatori si avansati (80)
  4. Teste spaniola - Tests y ejercicios de Español - Gramática (78)
  5. Gramatica limbii engleze - Prezentare Generala (73)