Post by Qphoria » Sat Aug 29, 2009 12:22 pm

There is no way to disable encryption since leaving the field blank causes errors.
The encrypt() and decrypt() functions need to have a key check. If key is empty, then return no encryption.
function encrypt($value) {
$output = '';
if (!$this->key) { return $value; }
for ($i = 0; $i < strlen($value); $i++) {
$char = substr($value, $i, 1);
$keychar = substr($this->key, ($i % strlen($this->key)) - 1, 1);
$char = chr(ord($char) + ord($keychar));

$output .= $char;
}

return base64_encode($output);
}
function decrypt($value) {
$output = '';
if (!$this->key) { return $value; }
$value = base64_decode($value);

for ($i = 0; $i < strlen($value); $i++) {
$char = substr($value, $i, 1);
$keychar = substr($this->key, ($i % strlen($this->key)) - 1, 1);
$char = chr(ord($char) - ord($keychar));

$output .= $char;
}

return $output;
}

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 17 guests