This is can be simple or complex depending on how complex you get. Here is an example that should work.
function getRandString()
{
$NumOfElements = 5; // Chooses that number of elements from the Element Array
$ElementArray = array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z);
$Total = count($ElementArray);
$String = "";
for ($C=0; $C<$NumOfElements; $C++) { $RNum = rand(0, $Total); $String .= $ElementArray[$RNum]; } return $String; }
With the settings this functions loops through and creates a string that is 5 elements in length. You can tell it to add or subtract numbers by changing the value of NumOfElements or change the elements that are returned by changing the value of ElementArray.
I hope this helped.
Jonathan Pitcher
On Wednesday, March 12, 2003, at 12:49 PM, Mike Walth wrote:
Hello:
What I am trying to do is to create a email verification routine with PHP.
When people register on the site they will get an email sent to them with a
link such as http://mysite.com/activation.php?ID=ghjghjg367ghjlkj9hjlkjhn0
That way when they click on the link it will verify the code against the
database and activate their account. Does anyone know an easy way to create
this string?
Thank you,
Mike Walth CinoFusion
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php