} } if($passwordlength != ''){ type(); } echo("<form action=\"password.php\" method=\"post\">pass length: <input name=\"length\" maxlength=\"4\" value=\""."$passwordlength"."\" /><br />pass type: <select name=\"type\"><option value=\"all\">all</option><option value=\"letters\">a-z(caps and lower)</option><option value=\"caps\">Letters a-z (caps)</option><option value=\"low\">letters a-z(lower)</option><option value=\"numbers\">numbers 0-9</option><option value=\"symbols\">All symbols on keyboard</option><option value=\"extreme\">extreme*</option></select><br /><input type=\"submit\" /></form>"); echo("$password"); ?> <p> <br /><br /> * extreme is longer in length than what you input and is heavily encrypted letters and numbers.! </p> </body> </html>
I know I could have used a for each statement and all those goodies but I did it the long way since it is easier to update in the future. post feedback!
Thanks,
~p4plus2~
Last edited by Inigoesdr; 03-04-2008 at 12:57 AM..
I know I could have used a for each statement and all those goodies but I did it the long way since it is easier to update in the future. post feedback!
You could have used a for() loop for the password generation instead of a while(), too. What is going to be easier to update later using this method? Also the global keyword isn't needed since you can pass the values as arguments to the function, or pass them by reference if you intend to modify them.
I use global since when I deal with phpbb(2.0.*) a lot. we are supposed to use global in our functions for variables. old habits. for and while loops do just about the same thing only real difference is syntax I didn't see any real benefit for a for statement here.
For updating I plan on adding special characters to the array and if I used for each it just becomes a mess since I'll need to redo my loop. Call me crazy as well but I tend to like doing things the hard way gives more satisfaction than a short cut.
Back to my point though what are the real benefits thats what I questioned since they still do the same thing. yah they are small, but do they effect anything, since I never noticed a diff when I used em....and shouldn't the code be:
Back to my point though what are the real benefits thats what I questioned since they still do the same thing. yah they are small, but do they effect anything, since I never noticed a diff when I used em
Well, the for() loop is slightly faster(~0.006 secs), and the syntax is better suited for this type of loop, but other than that they're functionally equivalent in this case.
ah....well I may convert it later when I'm not so busy then but it is lower on my to-do list since it is already working. I have a lot of things I am working on atm so I'd like to get em working first.