Forum Topic: Password Generator - Help Asap Plz!

(207 views • 10 replies)

This topic is 1 page long.

<< < > >>
Shouting

Masonogy1

Reply To Post Reply & Quote

Posted at: 6/14/06 04:56 AM

Masonogy1 NEUTRAL LEVEL 18

Sign-Up: 01/12/03

Posts: 577

Hey guys,

I need some sort of code or program which sets a different password for different users to get to a particular page on my website... I want this to be unique to only them though and they can use it any time they want... Does this requir something really huge or is it simplistic? Please help ASAP!!

Thanks


None

Zendra

Reply To Post Reply & Quote

Posted at: 6/14/06 05:31 AM

Zendra NEUTRAL LEVEL 38

Sign-Up: 09/07/03

Posts: 12,131

It can be really simple. :)

<?php

// The characters which will be in the passwor
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";

//The max length of the password
$length = 16;

for ($i=0; $i < $length; $i++)
{
$pass.= $pattern{rand(0,35)};
}

?>

Now $pass has stored a random password which contains 16 characters. Simple, but effective.

NG Review & BBS Moderator // PM Review & BBS Abuse to someone else


None

elbekko

Reply To Post Reply & Quote

Posted at: 6/14/06 05:42 AM

elbekko EVIL LEVEL 16

Sign-Up: 07/23/04

Posts: 6,450

<?php
$i = 0;
while($i <= 12) // Change to pass length
{
@$pass .= chr(rand(48, 122));
$i++;
}
?>

Easy enough, no?

"My software never has bugs. It just develops random features. " - Unknown

[ PHP: Main | Omigod, a blog ]

BBS Signature

None

Masonogy1

Reply To Post Reply & Quote

Posted at: 6/14/06 06:17 AM

Masonogy1 NEUTRAL LEVEL 18

Sign-Up: 01/12/03

Posts: 577

At 6/14/06 05:31 AM, Zendra wrote: It can be really simple. :)

<?php

// The characters which will be in the passwor
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";

//The max length of the password
$length = 16;

for ($i=0; $i < $length; $i++)
{
$pass.= $pattern{rand(0,35)};
}

?>

Now $pass has stored a random password which contains 16 characters. Simple, but effective.

Sorry I suck at anything to do with web design, can you tell me how this works and where I have to put it in Dreamweaver? When i put it in the HTML box and preview nothing happens...


Shouting

Masonogy1

Reply To Post Reply & Quote

Posted at: 6/14/06 06:19 AM

Masonogy1 NEUTRAL LEVEL 18

Sign-Up: 01/12/03

Posts: 577

Let me start a fresh... I have a download to a video on a page... When people purchase this download via paypal an e-mail will be sent to me and I will give them the link to the page, but to prevent sharing of the download I need a password system which is specific to each buyer... I am at a loss... Do you understand what I am asking?

Thanks for all your help so far guys! ;)


None

patheticcockroach

Reply To Post Reply & Quote

Posted at: 6/14/06 08:13 AM

patheticcockroach LIGHT LEVEL 30

Sign-Up: 07/01/03

Posts: 473

At 6/14/06 06:17 AM, Masonogy1 wrote: Sorry I suck at anything to do with web design, can you tell me how this works and where I have to put it in Dreamweaver? When i put it in the HTML box and preview nothing happens...

You'll need to learn some PHP to use this code (not much though but a little bit at least). Basically change your HTML file extension from .htm(l) to .php.


Happy

Zendra

Reply To Post Reply & Quote

Posted at: 6/14/06 08:14 AM

Zendra NEUTRAL LEVEL 38

Sign-Up: 09/07/03

Posts: 12,131

At 6/14/06 06:17 AM, Masonogy1 wrote: Sorry I suck at anything to do with web design, can you tell me how this works and where I have to put it in Dreamweaver? When i put it in the HTML box and preview nothing happens...

First you need to be sure that you have PHP installed.
If you copy and paste the code at the top of your page and put a tag (<?= $pass ?>) on the HTML code where you want the password to being outputted the randomised code will be put there.
Do note you need to re-name your page to the exstensions of PHP (.php) - instead of .html/.htm. So the server can process the code stored in the page.

At 6/14/06 06:19 AM, Masonogy1 wrote: Do you understand what I am asking?

Yes, yes. However, elbekko's code kinda does the same, but since he's using the '@', no password will be shown on the page - hint to elbekko. ;)
See what works and what you like.

NG Review & BBS Moderator // PM Review & BBS Abuse to someone else


None

elbekko

Reply To Post Reply & Quote

Posted at: 6/14/06 08:16 AM

elbekko EVIL LEVEL 16

Sign-Up: 07/23/04

Posts: 6,450

I'm using the @ to suppress warnings about vars not being set, I'm not echoing anything =p

"My software never has bugs. It just develops random features. " - Unknown

[ PHP: Main | Omigod, a blog ]

BBS Signature

None

Zendra

Reply To Post Reply & Quote

Posted at: 6/14/06 08:23 AM

Zendra NEUTRAL LEVEL 38

Sign-Up: 09/07/03

Posts: 12,131

At 6/14/06 08:16 AM, elbekko wrote: I'm using the @ to suppress warnings about vars not being set, I'm not echoing anything =p

Haha, that's a lazy excuse. ;)
It needs to be printed and you know that. :)

NG Review & BBS Moderator // PM Review & BBS Abuse to someone else


None

elbekko

Reply To Post Reply & Quote

Posted at: 6/14/06 09:03 AM

elbekko EVIL LEVEL 16

Sign-Up: 07/23/04

Posts: 6,450

You can always echo the pass... :D But preferably mail it I guess.

"My software never has bugs. It just develops random features. " - Unknown

[ PHP: Main | Omigod, a blog ]

BBS Signature

None

Zendra

Reply To Post Reply & Quote

Posted at: 6/14/06 10:29 AM

Zendra NEUTRAL LEVEL 38

Sign-Up: 09/07/03

Posts: 12,131

At 6/14/06 09:03 AM, elbekko wrote: You can always echo the pass... :D

Not if you're using '@'! ;)

:But preferably mail it I guess.

Yap, that would be a good idea, rather than print it on the screen. Though you have to remove the '@' if you want the password being visible. :)

NG Review & BBS Moderator // PM Review & BBS Abuse to someone else


All times are Eastern Standard Time (GMT -5) | Current Time: 07:57 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!