I currently have one program(perl) that uses a txt file to verify the username and password when loggin into that function.
I also have many php pages, that have user tables in MYSQL. When loggin into these pages, it just looks at the user table to verify that the user is who he says he is. Simple.
My problem is I want to insert all of the users in the cgi created txt file, into my 3 database user tables.
You may ask..well why don't you just do it with perl? Well that part is simple..I can actually do the inserts with perl, BUT one of the program uses an encrypted password which was encrypted using php. So this means I have to insert the password using php and using the md5() function to encrypt the password.
So while I'm at it, I might as well just do everything in php.
Here's the game plan.
open the file which is formatted like this
username|password - email
connect to db1
select to see if the username exists in the usertable.
If it doesn't exist then
encrypt password
insert username,password,email into the usertable
insert the username,password,email into the 2 other db usertables
end if.
SO I know how to do everything except how to open this file and grab the username, the password and the email
Remember. the format of the data file is like this
user|pass - email
I assume there's some function I can use to say grab everything on the line from starting point to the line "|". That's the username!
Then grab everything from after the line "|" to a space. That's the password
Then grab everthing from 2 after the dash "-" to a space or CR. That's the email!
Any help would be appriciated. Not looking for someone to write my code, just if you know how to open a file (fopen maybe) then how to say "grab these values and assign them as variable X,Y,Z"
Petey