Created
June 4, 2012 15:13
-
-
Save rcstr/2868987 to your computer and use it in GitHub Desktop.
PrestaShop 1.3 password generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string')); | |
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc()); | |
/** | |
* Convert \n to | |
* @param string $string String to transform | |
* @return string New string | |
*/ | |
function nl2br2($string) | |
{ | |
return str_replace(array("\r\n", "\r", "\n"), '<br />', $string); | |
} | |
/* Sanitize data which will be injected into SQL query | |
* | |
* @param string $string SQL data which will be injected into SQL query | |
* @param boolean $htmlOK Does data contain HTML code ? (optional) | |
* @return string Sanitized data | |
*/ | |
function pSQL($string, $htmlOK = false) | |
{ | |
if (_PS_MAGIC_QUOTES_GPC_) | |
$string = stripslashes($string); | |
if (!is_numeric($string)) | |
{ | |
$string = _PS_MYSQL_REAL_ESCAPE_STRING_ ? mysql_real_escape_string($string) : addslashes($string); | |
if (!$htmlOK) | |
$string = strip_tags(nl2br2($string)); | |
} | |
echo "->".$string." | |
"; | |
return $string; | |
} | |
/** | |
* Encrypt password | |
* | |
* @param object $object Object to display | |
*/ | |
function encrypt($passwd) | |
{ | |
return md5(pSQL($passwd)); | |
} | |
/*Ngk2AO1iQSjZDC9MbUpEYmn0Za13swCcJHO7Bek3UL0MrjKZFizE9Rxy -> Defined in /config/settings.inc.php _COOKIE_KEY_ constant*/ | |
echo encrypt("5GQ6dTInCcQFNHqJioQxazd8tzFjC5QDO55btTumwVtkBPp9USnfDH6D"."localhost"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment