@parzibyte/

OpenCart password reset

PHP (Legacy)

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.9458698966938666","path":"main.php","file":{"path":"main.php","content":{"asEncoding":{"base64":"Izw/cGhwCmZ1bmN0aW9uIHRva2VuKCRsZW5ndGggPSAzMikgewoJLy8gQ3JlYXRlIHJhbmRvbSB0b2tlbgoJJHN0cmluZyA9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSc7CgkKCSRtYXggPSBzdHJsZW4oJHN0cmluZykgLSAxOwoJCgkkdG9rZW4gPSAnJzsKCQoJZm9yICgkaSA9IDA7ICRpIDwgJGxlbmd0aDsgJGkrKykgewoJCSR0b2tlbiAuPSAkc3RyaW5nW210X3JhbmQoMCwgJG1heCldOwoJfQkKCQoJcmV0dXJuICR0b2tlbjsKfQoKZnVuY3Rpb24gZ2VuZXJhcl9wYXNzKCRwYXNzVGV4dG9QbGFubyl7Cgkkc2FsID0gdG9rZW4oOSk7CgkkaGFzaCA9IHNoYTEoJHNhbCAuIHNoYTEoJHNhbCAuIHNoYTEoJHBhc3NUZXh0b1BsYW5vKSkpOwoJcmV0dXJuIFsKCQkic2FsIiA9PiAkc2FsLAoJCSJoYXNoIiA9PiAkaGFzaCwKCV07Cn0KCi8vIERlbW9zdHJhciB1c28KJGRhdG9zUGFzcyA9IGdlbmVyYXJfcGFzcygiaHVudGVyMiIpOwokcGFzcyA9ICRkYXRvc1Bhc3NbImhhc2giXTsgLy8gRXN0ZSB2YSBlbiBlbCBjYW1wbyBwYXNzd29yZAokc2FsID0gJGRhdG9zUGFzc1sic2FsIl07IC8vIEVzdGUgdmEgZW4gZWwgY2FtcG8gc2FsdApwcmludGYoIkxhIHNhbCBlcyAlcyB5IGxhIHBhc3MgZXMgJXMiLCAkc2FsLCAkcGFzcyk7"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#<?php
function token($length = 32) {
	// Create random token
	$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
	
	$max = strlen($string) - 1;
	
	$token = '';
	
	for ($i = 0; $i < $length; $i++) {
		$token .= $string[mt_rand(0, $max)];
	}	
	
	return $token;
}

function generar_pass($passTextoPlano){
	$sal = token(9);
	$hash = sha1($sal . sha1($sal . sha1($passTextoPlano)));
	return [
		"sal" => $sal,
		"hash" => $hash,
	];
}

// Demostrar uso
$datosPass = generar_pass("hunter2");
$pass = $datosPass["hash"]; // Este va en el campo password
$sal = $datosPass["sal"]; // Este va en el campo salt
printf("La sal es %s y la pass es %s", $sal, $pass);
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7