Hi - I'm new here and would like to ask a couple of questions:
I have a list of 400 people and passwords on a spreadsheet - is there an easy way of transferring these to the htpasswd file?
Also - is there a way I can secure areas of my website using a mysql database of user ID's and Passwords? I have seen a php script and class but obviously this would not protect binary files in the area (as they wouldn't be parsed).
Any help greatly appreciated.
Thanks in advance,
impossible, exel,word should use a XML standart encoding type, if so you could with sed'n awk but heh its microsoft :eek:
We dont live in a perfect world! Specialy not with m$ around. For ya php i see you draw conclusions befor being guru in it.
send a header to the doc and include("/out/of/httpd/directory"); also you could use php with htpasswd linked to a mysql db. Would need a little work but google is your friend (phpbuiler too).
Anyway i wont 1kg of sweeties last nigth, i have to run see ya!! :o
Has anyone got an answer to this that I can actually understand?
I think what he was trying to say was that an excel sheet is a binary Microsoft format. To generate the passwd file you will need it in plain text.
One way to do this is to open the excel sheet and then use the save as to something like a comma seperated text file. You can then easily parse the file with a simple script and use it as input to create the passwd file.
For authentication using a database try reading the following for some more information:
Thanks for the reply - I'm sure I can get round tosaving them as a text file ;)
Would you be able to give me any pointers to a script that could parse this information to me?
From XML :
sed -e 's/<XMLFIELD>/INSERT INTO TABLE (ID,FIELD) VALUES ('\''NULL'\'','\''/g' |sed -e 's/<field>/'\'');/g' > output1
and you can get a Proper file full of sql queryes
Try top open the .exel with koffice or star, open office and save as "real format" and run a sed command.
Read this from my book heh our book a community one :
stream editor. Sed is a steam editor, it means that if you some really nice file talking about windows and you just realized that the file wasnt appropriat for windows and you want to transform it into linux you would simple issue :
sed 's/windows/linux/g' oldfile > newfile
Sed will "cat" the "oldfile" and replace all the "windows" by "linux" its very simple, it becomes very handy for coding and hacking other peoples code, here is an other example :
sed 's/copyright/CopyRights_Suck/g' index.php > index2.php
Thats would exchange all the copyright in index.php to CopyRights_Suck and make a new file named index2.php.
Sed is a very complicated tool to use and i would strongly suggest thats you read the manual (man sed).
In action :
geekland:/home/oliver# echo "foobar" > test
geekland:/home/oliver# sed 's/foobar/sed_works/g' test |more
There is didnt send all the output (>) to a diferent file but i told it to print it in the terminal with "|more" so if the file to too long i can still read it all. The reason i did that was to be shour of what i was doing, mistype, problemes, faulty commands... can happen and i want sed to help me, not detroy my work.
(Im shure even you can understand that (flamebait!!) j/k )
I think I'll just input them manually - thanks all the same.
Well if you get the excel file in the following format
Then something like the following script should work:
for line in `cat textfiletoparse`
name=`echo $line | cut -f 1 -d ';'`
password=`echo $line | cut -f 2 -d ';'`
htpasswd -b passwordfile $name $password
Thats more like it ;)
Booooo ;( You prefer to copy past than learn? How crazy ;)
Eternal - Only been using for about 3 weeks now - I started by trying to configure sendmail which nearly pushed me over the edge! :rolleyes:
I'm sure that in a few weeks I'll come back to this forum and understand exactly what you said!
|All times are GMT -5. The time now is 01:54 AM.|