Random Code Generator PHP Scripta


Random Code Generator PHP Scripta

In this tutorial we are going to learn how to make a random code generator. You may download this file and use it to your projects or systems.

Creating Our Form
1. We need to create our form tag and the method is post..
2. Create our button, name it generate and the type is submit

 

Code:
 
  1. <form method="POST">
  2. <button name="generate" type="submit">Generate Code</button>
  3. </form>

 

Creating Our PHP Script
1. create a variable named today, it is the date today. We should include this to our script so that we can ensure that we are generating a unique random code.
2. create a variable name rand.
3. the name of the button should be the same in isset function.
4. Display the random code using the variable unique with the value of today and rand.

 

Code:
 
  1. <?php
  2. $today = date("Ymd");
  3. $rand = strtoupper(substr(uniqid(sha1(time())),0,6));
  4. if (isset($_POST['generate']))
  5. {
  6. echo $unique = $today . $rand;
  7. }
  8. ?>

 

That’s it, you have successfully created a random code generator. Feel free to comment your suggestions below or email me at [email protected]

 

 


Related Post


osCmax E-Commerce PHP Script Free Download osCmax E-Commerce PHP Script Free Download   osCmax is a powerful e-commerce/shopping cart web application. osCmax has all the features nee...
AdiWap Ad NetWork PHP Script AdiWap Ad NetWork PHP Script. This is an Ad Network PHP Script by which you can start your ad network site.   Download File  
PinScriptPro – Pinterest Like Website PHP Sc... PinScriptPro - Pinterest Like Website PinScriptPro - Pinterest Like Website We are proud to announce one of the best Pinterest type script. This is...
All in One Video Downloader v1.3 – Youtube a... All in One Video Downloader v1.3 - Youtube and more - nulled PHP Script   Automatic installation Detailed statistics in dashboard Admin panel...
HESK Customer Support PHP Script HESK Customer Support PHP Script   Hesk is Free PHP Help Desk Software that runs with a MySQL database. It allows you to setup a web based ...

Read Me

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

"