/* $id author Puddled Internet - http://www.puddled.co.uk email support@puddled.co.uk osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ function tep_create_rma_value($length, $type = 'digits') { if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false; $rand_value = ''; while (strlen($rand_value)<$length) { if ($type == 'digits') { $char = tep_rand(0,9); } else { $char = chr(tep_rand(0,255)); } if ($type == 'mixed') { if (eregi('^[a-z0-9]$', $char)) $rand_value .= $char; } elseif ($type == 'chars') { if (eregi('^[a-z]$', $char)) $rand_value .= $char; } else if ($type == 'digits') { if (ereg('^[0-9]$', $char)) $rand_value .= $char; } } return $rand_value; } ?>