Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Change password form

Featured Replies

hey all

 

making progress with my site thanks for the help :)

 

come across another issue, at the moment my regisration form creates a random p.w and emails it to the user enabling them to log in,

 

my query is,

 

can i change this so that user can enter their own password? here is my registration details if it helps

 

regards

 

$pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);

 

this generates a random password and emails it to the user after they enter a username and their email address

 

1. what would i need to add to my regisration form to allow a user generated p.w

2. do i need to change anything on the sql?

3. what would the field on the form be?

 

thanks again in advance everyone

hey all

 

making progress with my site thanks for the help :)

 

come across another issue, at the moment my regisration form creates a random p.w and emails it to the user enabling them to log in,

 

my query is,

 

can i change this so that user can enter their own password? here is my registration details if it helps

 

regards

 

$pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);

 

this generates a random password and emails it to the user after they enter a username and their email address

 

1. what would i need to add to my regisration form to allow a user generated p.w

2. do i need to change anything on the sql?

3. what would the field on the form be?

 

thanks again in advance everyone

 

yes just create a password field on ur registration page,sha1 or md5 the password then insert into mysql

hey all

 

making progress with my site thanks for the help :)

 

come across another issue, at the moment my regisration form creates a random p.w and emails it to the user enabling them to log in,

 

my query is,

 

can i change this so that user can enter their own password? here is my registration details if it helps

 

regards

 

$pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);

 

this generates a random password and emails it to the user after they enter a username and their email address

 

1. what would i need to add to my regisration form to allow a user generated p.w

2. do i need to change anything on the sql?

3. what would the field on the form be?

 

thanks again in advance everyone

 

<?php


//Password generator
function genPassword($len) {

//Arrays of characters
$numbers = array(0,1,2,3,4,5,6,7,8,9);
$letters = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p', 'q', 'r','s','t','u','v','w','x','y','z');
$symbols = array('[',']','{','}','#','@',':',';','>','<','/','*','(',')','-','+','=','~','!','"','%','|','.',',');
$password = array();

//Generate password
while(count($password) <= $len) {
	$option = array(
	$password[] = $numbers[rand(0, count($numbers)-1)], 
	$password[] = $letters[rand(0, count($letters)-1)], 
	$password[] = $symbols[rand(0, count($symbols)-1)]);
	rand(0, 2);
}

//Prepare and print password
$password = implode('', $password);
print $password;

}

genPassword(20);

?>

 

I written this a while back, This is a proper password generator! :p

yes just create a password field on ur registration page,sha1 or md5 the password then insert into mysql

 

This would be a bad example for the reason that a robot could easily set its own password and use it to login therefore defeating the point of having a random password.

 

Use the script provided above or your own and as the registration is processed, generate the password within the php and store it in your password column.

This would be a bad example for the reason that a robot could easily set its own password and use it to login therefore defeating the point of having a random password.

 

Use the script provided above or your own and as the registration is processed, generate the password within the php and store it in your password column.

um no thats how majoyity of sites do it these days thats why they have captchas creating random passwords is more of a headach unless its for password recovery due to the fact they have to copy and paste the generated pass to login then go and change there password, makes no since

um no thats how majoyity of sites do it these days thats why they have captchas creating random passwords is more of a headach unless its for password recovery due to the fact they have to copy and paste the generated pass to login then go and change there password, makes no since

 

Sorry, May have a misunderstanding, I have got the impression that you are setting a random password within the actual HTML form.

 

<form>

<input type="password" value="<?php random(); ?>" />

</form>

Sorry, May have a misunderstanding, I have got the impression that you are setting a random password within the actual HTML form.

no not a randome password inside the form, just a password field where the user enters there own password

  • Author

hey guys thanks for the feedback.

so what i would be best doing is either keep the random p/w generator and then create a form to allow the user to change there password to one of their choice to prevent bots? or have the user specify a password but use a captcha to prevent bots?

 

Andy

hey guys thanks for the feedback.

so what i would be best doing is either keep the random p/w generator and then create a form to allow the user to change there password to one of their choice to prevent bots? or have the user specify a password but use a captcha to prevent bots?

 

Andy

i'd have the user specify a password, then use a captcha like recaptcha or ur own

I'd hardly say it's "proper" generator as it's very untidy how you've used 3 big arrays in my opinion - you've just set an array of standard characters too (i could kinda see your reasoning behind using 3 fixed arrays if you had some sort of password policy going on, which you don't seem to).

 

Have a read about SplFixedArray - http://www.php.net/m...y.construct.php - much neater code, but slightly slower when creating the actual object. SPL is underused so much, but is amazingly helpful - especially so for arrays.

 

It would have even been neater to use the chr function - http://php.net/manua...nction.chr.php.

 

Just my 2c :)

 

EDIT: btw shaun, there's no need to count the size of each arrays for every single iteration of the loop either ;)

 

I deff agree with this personally i should be using SPL more also but deff a good point, and also a good point that theres no need to count the size of each array

Users specyfying their owns passes? Probs best avoid that like the plague. Do it normally - store the random salted password in your database. You could even use http://www.openwall.com/phpass/

People specify there own passes all the time including on facebook,yahoo,google gmail i could go on so personally i see nothing wrong with this at all but just my 2 cents, or maybe i misunderstood what you were meaning if i did sorry :)

Edited by webdesigner93

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.