Random Number generator in php - Mostlikers

09 August, 2013

Random Number generator in php

Generally the Random number is used for some authentication purpose.In most of the websites like gmail ,just dial the users while login the security code will be send to the mobile for the secure purpose.


What is mean by random number ?

Random number is nothing but a unique code that automatically create some unique code numbers. It is used to generate a random number within a specific range of numbers.

Where we use this coding ?

This coding is used in sms verification codes , captcha , forget password, comments verification for the purpose of authentications to check the user. 


echo $Random_code;

Sample Program

$msg="Invalide code";
$msg="Your code is correct";
<form name="form" method="post">
<p>Type Below this code <?php $Random_code=rand(); echo $Random_code; ?> </p><br />
<p>Enter the random code<br />
<input type="text" name="code1" title="random code" />
<input type="hidden" name="code" value="<?php echo $Random_code; ?>" />
<p><input type="submit" value="check" title="code check" name="submit" /></p>
<p><?php if(isset($_POST['submit']))
{ echo $msg; } ?>

No comments:

Post a Comment