Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

September 27, 2022, 02:54:35 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 193513
  • Total Topics: 21092
  • Online today: 68
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 1
Guests: 56
Total: 57

Author Topic: random password  (Read 9363 times)

0 Members and 1 Guest are viewing this topic.

superQ

  • Guest
random password
« on: February 25, 2006, 08:48:46 AM »
I found ths snippert and was wondering if it can be used in a php block. I have it here ,but it don't work right.

http://www.therockpile.zeeblo.com/smf/index.php

the code in the block is.

<?php
/** * The letter l (lowercase L) and the number 1
* have been removed, as they can be mistaken
* for each other. */
function createRandomPassword()
{    $chars = "abcdefghijkmnopqrstuvwxyz023456789";    srand((double)microtime()
*1000000);    $i = 0;    $pass = '' ;   
while ($i <= 7) {        $num = rand() % 33;       
$tmp = substr($chars, $num, 1);       
$pass = $pass . $tmp;        $i++;    }   
return $pass;
}
// Usage$password = createRandomPassword();
echo "Your random password is: $password";
?>

you can see this eror right on the page.

Parse error: parse error, unexpected '<' in /home/rockstar/public_html/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 1



Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: random password
« Reply #1 on: February 25, 2006, 09:49:30 AM »
Ranodom password in a Block ?

Isent that mod made for users that have forgotten their passwords and need to be sended one trough email?

If im wrong there my apologys.

The first thought when i saw your code was if you try that in a Block. remove the php tags <?php and ?> in the start and end of the code then paste it in a PHP block

superQ

  • Guest
Re: random password
« Reply #2 on: February 25, 2006, 10:05:06 AM »
this is what it said.Random password generator.

http://www.php.happycodings.com/code_snippets/code112.html

I didn't write that :uglystupid2:Will remove the tags.Thanks.

superQ

  • Guest
Re: random password
« Reply #3 on: February 25, 2006, 10:07:40 AM »
works better but where is the pw.

borgBOB

  • Guest
Re: random password
« Reply #4 on: February 25, 2006, 11:04:52 AM »
make sure the variable $pass is not used in SMF. Also I do not see $password defined.

Change
Code: [Select]
// Usage$password = createRandomPassword();
echo "Your random password is: $password";

TO
Code: [Select]
// Usage
$password = createRandomPassword();
echo "Your random password is: $password";

And see if that helps.

superQ

  • Guest
Re: random password
« Reply #5 on: February 25, 2006, 11:41:37 AM »
That's the ticket. Thanks

crip

  • Guest
Re: random password
« Reply #6 on: February 25, 2006, 12:59:08 PM »
Must be for a Guestbook.. yes?

superQ

  • Guest
Re: random password
« Reply #7 on: February 25, 2006, 01:23:47 PM »
I don't know.I guess it is not to usefull. I personally use Password scrambler. I just found that place and it looks like a lot of stuff that may be useful to go into blocks.  I am interested in that flashchat in articles thing though.Soon as I save up $5.00. ;)

http://www.onepassword.com/1p/

crip

  • Guest
Re: random password
« Reply #8 on: February 25, 2006, 01:35:48 PM »
There is a Free one also..

forgot the link..it's in here someplace..

Simply search?