Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Quick Formating Question
Old 10-03-2004, 01:19 AM Quick Formating Question
someotherguy582's Avatar
Average Talker

Posts: 21
Trades: 0
I have a password generator that generates a password baes on content you submited. It generates using stuff like sha1, md5, etc. I have it echo the new pass but of course its huge. If want to make it only 10 characters. So how would I make it echo only 10 characters?

Thanks
someotherguy582 is offline
Reply With Quote
View Public Profile Visit someotherguy582's homepage!
 
 
Register now for full access!
Old 10-03-2004, 01:26 AM
Unknown.

Posts: 1,693
Trades: 0
It can be done using substr...

Example..
PHP Code:
$password '11223344556677889900';
echo 
substr($password0,10); 
The output would be '1122334455'.. Displaying the first 10 characters

--James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2004, 01:30 AM
kisk's Avatar
Extreme Talker

Posts: 161
Location: skynet
Trades: 0
probably not the most efficiant method, but why not just cut off all chars except the first or last 10?

with php; first 10:
$myPass = substr($myPass, 0, 10);


with php; last 10:
if (strlen($myPass) > 10) {
$myPass = substr($myPass, strlen($myPass)-10, strlen($myPass));
}



since a sha1 or md5 string is pretty random based on the input you should get a pretty secure pw

Edit: Dark-Skys beat me
kisk is offline
Reply With Quote
View Public Profile Visit kisk's homepage!
 
Old 10-03-2004, 01:39 AM
someotherguy582's Avatar
Average Talker

Posts: 21
Trades: 0
LoL... thanks everyone . I looked at PHP.net but there are just so many functions i cant find the right one. *remembers what substr does :P*
someotherguy582 is offline
Reply With Quote
View Public Profile Visit someotherguy582's homepage!
 
Reply     « Reply to Quick Formating Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12635 seconds with 12 queries