Algo estoy hacendo mal / me dan una mano
Publicado por Edu (9 intervenciones) el 10/03/2017 18:47:50
por aqui entro los datos:
Ingreso de las variables key y string
y luego viene el proceso de encriptación:
El Problema es que el $output_data = me devuelve $encripted como resultado y no el encriptado de las variables.
Ingreso de las variables key y string
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//
// ENC
//
if ($_CONFIG['enc'] == true) { ?>
<div class="tab-pane <?php if ($getsection === "#enc") echo "active"; ?>" id="enc">
<div class="row form-group">
<div class="col-xs-6">
<label><?php echo getString('key'); ?></label>
<input type="text" name="key" placeholder="Entre el password" class="form-control">
</div>
<div class="col-xs-12">
<label><?php echo getString('string'); ?></label>
<textarea name="string" placeholder="Entre el contenido a codificar" class="form- control"></textarea>
</div>
</div>
</div>
<?php
y luego viene el proceso de encriptación:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
elseif ($getsection === "#enc") {
$key = filter_input(INPUT_POST, "key", FILTER_SANITIZE_STRING);
$string = filter_input(INPUT_POST, "string", FILTER_SANITIZE_STRING);
$iv = mcrypt_create_iv(
mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC),
MCRYPT_DEV_URANDOM
);
$encrypted = base64_encode(
$iv .
mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
hash('sha256', $key, true),
$string,
MCRYPT_MODE_CBC,
$iv
)
);
if ($encrypted) {
$output_data = '$encrypted';
}
El Problema es que el $output_data = me devuelve $encripted como resultado y no el encriptado de las variables.
Valora esta pregunta


0