Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted

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)

Posted

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

Posted

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.

Posted

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)

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...