Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password Generator

    This is supposed to display microtime number in md5 encryption but only 8 letters of it but all it displays is $mc

    heres code
    <?php
    $mc=microtime();
    $mc=md5($mc);
    $e= substr('$mc', 0,8);
    echo $e;
    ?>

  • #2
    New Coder
    Join Date
    Apr 2005
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change
    PHP Code:
    $esubstr('$mc'0,8); 
    to
    PHP Code:
    $e substr($mc0 8); 
    notice the lack of single quotes. The single quotes tell PHP you're giving it a string, so its treats it as one. Not as a variable.

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is my code now

    <?php
    $mc=microtime();
    $mc=md5($mc);
    $e = substr($mc, 0 8);
    echo $e;
    ?>
    it errors still saying;
    Parse error: parse error, unexpected T_LNUMBER in /home/newage/public_html/lewis/test2.php on line 13

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    still the beginner. parameters of the function must be separated with commas.

    your
    PHP Code:
     $e substr($mc0 8); 
    suffers a lack of them.

    PHP Code:
     $e substr($mc08); 

  • #5
    New Coder
    Join Date
    Sep 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I had em in first place, but other guy took em out didnt notice thanks for help though and of course im a beginner...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •