Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter
#59

[eluser]C4iO [PyroDEV][/eluser]
@haseydesign

I've asked for the upgrade to PHP 5.3 with mbstring enabled to my hosting company, but until they do that, I've made a helper to fullfil the lack of two functions Flexi uses. I'm pretty sure it's not the best code ever, but at least it's a start to make backward compatibility where mbstring isn't enabled.

mbstring_helper.php source code:
Code:
<?php

if (!function_exists('mb_strlen')) {
function mb_strlen($string) {
  return preg_match_all( '(.)su', $string, $matches );
}
}


if (!function_exists('mb_substr')){
function mb_substr($string, $start = 0, $length = NULL) {
  $pattern = '^';
  if ($start > 0)
   $pattern .= '(?:.{'.$start.'})';
  else
   $pattern .= '(?:.*)';

  if (!is_null($length) && $length > 0)
   $pattern .= '(.{'.$length.'})';
  else
   $pattern .= '(.*)';

  preg_match('/'.$pattern.'/', $string, $matches);

  return $matches[1];
}
}

Finally, what do you think about setting usess_series to NULL as default value, as I've mentioned earlier? It is working so far.



Thanks!!!!


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 10-13-2012, 01:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB