PHP script to generate a random string of AplhaNumeric values of given length

Script: <?php function generateRandomString($length = 64) {     $characters = ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;     $randomString = ”;     for ($i = 0; $i < $length; $i++) {         $randomString .= $characters[rand(0, strlen($characters) – 1)];     }     return $randomString; } echo generateRandomString(); ?>   Output: < p>

Read more

Integrating PHP into HTML Form pages.

The login pages of a web site are usually HTML forms. The HTML forms will be linked to a script to process the data received via form from the user.   This linking is performed by HTM Form Attribute called  “Action” (HTML <form> action Attribute).  Syntax:  <form action="<scriptname>" method="<post/get>"> Example: Save below content as “Form-Example.php” <form action="login.php" method="post">   First name: <input type="text" name="fname"><br>   Last name: <input type="text" name="lname"><br>   <input type="submit" value="Submit"> </form> The page would look like below form for the end user:   Upon user clicks “Submit” button the respective login.php script gets invoked.  Let’s say you’ve […]

Read more

Executing JavaScript .JS file

About JavaScript: is a Server side scripting language (as similar to php) files are saved with .js extension (which is ) is a Sun MicroSystems (and later Oracles) and NetScape team developed system Microsoft’s developed compatible version is called JScript   Executing JavaScript: You a browser to execute the JavaScript code That is, you can NOT directly execute a JavaScript .js file instead you need to embed it in HTA/HTML pages. In a browser, you can run a JavaScript Onliners in the address bars example: JavaScript: alert("it ran in browser address bar");

Read more