Jump to content

Search the Community

Showing results for tags 'generator'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Struggling with creating the following: a. The authorized user can select one or both of the two available lottery services (in form of checkboxes) provided by your website. Generate six sets of LOTTO 6/49 numbers (sorted in ascending order) when option one, labeled as “LOTTO 6/49”, is checked. One set of “LOTTO 6/49” numbers consists of 6 unique numbers between 1 and 49 inclusively. Generate six sets of LOTTO MAX numbers (sorted in ascending order) when option two, labeled as “LOTTO MAX”, is checked. One set of “LOTTO MAX” numbers consists of 7 unique numbers between 1 and 49 inclusively. b. When the authorized user submits the form with one or both of the two available services checked, your web server will generate six sets of lottery numbers for each type accordingly and display these numbers of each type of lotteries to the user. Code so far: <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors','1'); if(!isset($_SESSION)){ session_start(); } ?> <html> <head> <title> Choose Tickets</title> </head> <body> <h2> Choose your tickets</h2> <?php if (filter_input(INPUT_POST,'form_tickets')){ if(!empty($_SESSION["tickets"])){ $tickets = array_unique( array_merge(unserialize($_SESSION["tickets"]), filter_input(INPUT_POST, 'form_tickets'))); $_SESSION["tickets"] = serialize($tickets); } else { $_SESSION["tickets"] = serialize(filter_input(INPUT_POST, 'form_tickets')); } echo "<p> Your tickets have been selected!</p>"; } ?> <form method="POST" action=""> <p><strong>Select your ticket(s):</strong><br> Lotto 6/49: <input type="checkbox" value="Lotto 6/49"><br /> Lotto Max: <input type="checkbox" value="Lotto Max"><br /> <p><input type="submit" value="submit"/></p> </form> </body> </html> I honestly don't really know what I'm doing.. This class isn't specifically php so he's going through it too quick for me to grasp/learn. I'm sort of going off examples he's given us but I can't seem to fit the pieces together to make this thing. Again, any help is greatly appreciated I have a vague idea of how it's all supposed to work but not sure of the commands to do it or how to structure it.
  2. As a part of a project I'm working on, I just updated an old function of mine. Seeing as a lot of people still keep using time-based[1] techniques for generating password, I thought I should share this one with you all. Hopefully someone will find it useful. /** * Generates and returns a random password, of a random length between min and max. * * Hard limits are minimum 10 chars and maximum 72. * * @author Christian Fagerheim (Fagerheim Software) * @link www.fagsoft.no * @license Creative Commons Attribution-ShareAlike 3.0. http://creativecommons.org/licenses/by-sa/3.0/. * * @param int[optional] $minLen = 10 * @param int[optional] $maxLen = 14 * @return string */ function generatePassword ($minLen = 10, $maxLen = 14) { if ($minLen < 10) { $minLen = 10; } // Discard everything above 72 characters for the password (bcrypt limitation). if ($maxLen > 72) { $maxLen = 72; } $numChars = mt_rand ($minLen, $maxLen); // Create an secure random password, and cut it down to length. $password = base64_encode (mcrypt_create_iv (256, MCRYPT_DEV_URANDOM)); $password = substr ($password, 0, $numChars); // Define the replacements sets and values for strtr (). $find = "10lIO"; $replace = "_-*!?"; // Replace the similar-looking characters with special characters. $password = strtr ($password, $find, $replace); // Save the hashed password in the object, and return it to calling method. return $password; } A copy can be found here: http://pastebin.com/se0YfEx1 [1]Time-based techniques are bad because they are very easy to predict, meaning that an attacked can quite easily guess the generated value as long as he knows the time of a request. Something which completely invalidates the point of having it be random in the first place.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.