Page 1 of 1
Password
Posted: Tue Jun 24, 2008 11:16 pm
by alex_cunningham
i need a php code that will read all the usernames and passwords out of a txt file
for example:
User name:password
Re: Password
Posted: Tue Jun 24, 2008 11:17 pm
by alex_cunningham
but i also need a sign up how do i edit the text file in a php code
Re: Password
Posted: Tue Jun 24, 2008 11:18 pm
by John Cartwright
use
file() to load each line into an array,
foreach() to traverse the array, and
explode() to seperate the elements on the colon.
Also, please read our forum descriptions. This is the second time you've posted in the wrong forum.
Moved to PHP-Code.
Re: Password
Posted: Tue Jun 24, 2008 11:21 pm
by alex_cunningham
???

can i get the code in English please
Re: Password
Posted: Tue Jun 24, 2008 11:22 pm
by John Cartwright
alex_cunningham wrote:???

can i get that in English please
You got it in english. I'm not here to write the code for you, I'm here to offer assistance. Try reading the links I provided first.
Re: Password
Posted: Tue Jun 24, 2008 11:29 pm
by alex_cunningham
you know hes the kind of people who drive people away from the forum
Re: Password
Posted: Wed Jun 25, 2008 12:05 am
by John Cartwright
alex_cunningham wrote:you know hes the kind of people who drive people away from the forum
I'm sorry you feel that way. I don't think it's fair of you to not demonstrate any effort and expect us to do the work. I'm happy to explain it furthur if you need.
What have you tried so far?
Re: Password
Posted: Wed Jun 25, 2008 1:34 am
by Stryks
Actually, He's the kind of person who makes this site so worthwhile.
He *could* just give you the code ... you'd go away happy for five minutes, then want to get it to work slightly differently, and then realize that you had no understanding of how the code actually worked. Then you'd come back, and someone would fix it. All the while, you'd be going nowhere with PHP.
Seriously, take a look at the manual pages ... have a read and then make up a few test files and get a feel for how things work. See if you can tell how the commands would work together. It'll be sooooo worth your while.
And if you try and fail, come back and post your code. There are hundreds of people here, JCart included I'm sure, who would bend over backwards to help you understand where your code was going wrong.
We're here to help.
Re: Password
Posted: Wed Jun 25, 2008 2:00 am
by Jasheppard
its easy. but there is no point in learning or using php if you don't know how to create forums and read data out of a file!
look in google... always help for me

but why go that far? i have seen examples in other topics on this forum.
Re: Password
Posted: Wed Jun 25, 2008 2:04 am
by Jasheppard
There are many ways on how to make a password/login system.
1. Databases...
2. Text files...
3. could even use session which is quite pointless.
But i would go for text files, for which i use on my website.
As Jcart said...
use file() to load each line into an array, foreach() to traverse the array, and explode() to seperate the elements on the colon.
Simple, I would post the code but i am afraid its a bit too big.
Re: Password
Posted: Wed Jun 25, 2008 2:06 am
by Stryks
How did you go with those examples you found?
How did they not do what you want? Did you test them?