Will Posted May 30, 2007 Posted May 30, 2007 I have a text file which is single words separated by a new line; www.thecrimelife.com/files/dic.txt I have a database with 4 columns; id(auto_increment), text, md5, done. Is there any way to import the text file into the database in the column 'text'? Any help would be appreciated. Quote
Decepti0n Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database Did you want the whole file in one row, or each line of that file in a different row? Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database I want the whole file on different rows (as many rows in database as the rows of the text file) but only entered into the 'text' column. Quote
Decepti0n Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database <?php $file = file('http://www.thecrimelife.com/files/dic.txt'); $sql = 'insert into `table` (`text`) VALUES '; foreach ($file as $line => $value) { $sql1 .= ', ("'.trim($value).'")'; } $q = $sql.substr($sql1,2); mysql_query($q) or die(mysql_error()); ?> Try that Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database I get the following error Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/thecrime/public_html/md5/import.php on line 13 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/thecrime/public_html/md5/import.php on line 13 Access denied for user 'nobody'@'localhost' (using password: NO) I need to be able to enter a username and password on the query. Quote
Decepti0n Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database oh right, you'll have to include your connection file in there as well... Or at the top, add: mysql_connect('localhost','sql_user','sql_pass'); mysql_select_db('dbname'); (changing the values for yours) Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database Thanks. It worked. I now have to run a large query to md5 encrypt everything (Don't worry I have already made this script). Anyway thanks again. :-D :-D Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database Another question, is it possible to create a code which cretes a text file (of direcently to database) which counts up letters? e.g a c ..... z aa ab ac ad ........... ba bc etc etc. Quote
Decepti0n Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database probably but i dont understand :p Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database I mean like this www.thecrimelife.com/files/example.txt NOTE: I typed this up manually, I would like a code which makes a file like this which goes to around 10 digits. Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database Well not really a passowrd file more a large databse of word and phraes for my md5 decryption database. Although that file sound usefull. Could you send to [email protected] Quote
hamster01 Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database ill upload it >.> http://www.deathstarhq.info/Password.txt Quote
Decepti0n Posted May 30, 2007 Posted May 30, 2007 Re: Text file into database I can't think of anything off the top of my head for that, but probably a few loops will do it If you really want a thorough md5 decryption db, you'll need probably multiple supercomputers to get it up to 10 characters 1 character = 62 possibilities 2 chars = 62 ^ 2 = 3844 3 chars = 62 ^ 3 = 238,328 4 chars = 62 ^ 4 = 14,776,336 ... 10 chars = 8.39299366 × 1017 possible combinations Thats all without using *(!@&%(!*& etc (i think) Quote
Will Posted May 30, 2007 Author Posted May 30, 2007 Re: Text file into database Hmm yeah. 839,299,366,000,000,000 is alot. I'm just using a password generator to generate random passwords and putting them on the database. It is using a lot of space thought. At time of print there are 329,616 using 23.9 MiB of space. If your interested the site which this is for is; www.thecrimelife.com/md5 Anyway one day I will do that. I have a dream that one day md5 encryptions will be useless. :-D :-D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.