summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/string_helper.php9
-rw-r--r--user_guide/changelog.html3
-rw-r--r--user_guide/helpers/form_helper.html6
3 files changed, 8 insertions, 10 deletions
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 9fa69f46c..dd8ffaddb 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -215,12 +215,9 @@ if ( ! function_exists('random_string'))
case 'nozero' : $pool = '123456789';
break;
}
-
- $str = '';
- for ($i=0; $i < $len; $i++)
- {
- $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
- }
+
+ $str = substr(str_shuffle(str_repeat($pool, ceil($len/strlen($pool)))),0,$len);
+
return $str;
break;
case 'unique' :
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 5f0276137..def5a5788 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -75,8 +75,9 @@ Change Log
<li>Helpers
<ul>
<li>Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li>
- <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
+ <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
<li><samp>url_title()</samp> will now trim extra dashes from beginning and end.</li>
+ <li>Improved speed of <a href="helpers/string_helper.html">String Helper</a>'s <b>random_string()</b> method</li>
</ul>
</li>
<li>Database
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index dd935ebd9..0afe0eb53 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -84,7 +84,7 @@ in the event your URLs ever change.</p>
<p>The above example would create a form that points to your base URL plus the "email/send" URI segments, like this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send" /></code>
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" /></code>
<h4>Adding Attributes</h4>
@@ -97,7 +97,7 @@ echo form_open('email/send', $attributes);</code>
<p>The above example would create a form similar to this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send" &nbsp;class="email" &nbsp;id="myform" /></code>
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" &nbsp;class="email" &nbsp;id="myform" /></code>
<h4>Adding Hidden Input Fields</h4>
@@ -110,7 +110,7 @@ echo form_open('email/send', '', $hidden);</code>
<p>The above example would create a form similar to this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send"><br />
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"><br />
&lt;input type="hidden" name="username" value="Joe" /><br />
&lt;input type="hidden" name="member_id" value="234" /></code>