[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/install/includes/functions/ -> general.php (source)

   1  <?php
   2  /*

   3  $Id: general.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  ////

  14  // Sets timeout for the current script.

  15  // Cant be used in safe mode.

  16    function osc_set_time_limit($limit) {
  17      if (!get_cfg_var('safe_mode')) {
  18        set_time_limit($limit);
  19      }
  20    }
  21  
  22    function osc_realpath($directory) {
  23      return str_replace('\\', '/', realpath($directory));
  24    }
  25  
  26    function osc_rand($min = null, $max = null) {
  27      static $seeded;
  28  
  29      if (!isset($seeded)) {
  30        mt_srand((double)microtime()*1000000);
  31        $seeded = true;
  32      }
  33  
  34      if (isset($min) && isset($max)) {
  35        if ($min >= $max) {
  36          return $min;
  37        } else {
  38          return mt_rand($min, $max);
  39        }
  40      } else {
  41        return mt_rand();
  42      }
  43    }
  44  
  45    function osc_encrypt_string($plain) {
  46      $password = '';
  47  
  48      for ($i=0; $i<10; $i++) {
  49        $password .= osc_rand();
  50      }
  51  
  52      $salt = substr(md5($password), 0, 2);
  53  
  54      $password = md5($salt . $plain) . ':' . $salt;
  55  
  56      return $password;
  57    }
  58  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7