This script hashes a list of words with MD5 and stores it in the database along with its plain text:
<?php
$dict = $_POST["dict"];
if (!isset($_POST['submit'])){
echo "<form method=\"post\" action=\"\">";
echo "Wordlist: <input type=\"text\" name=\"dict\"><br>";
echo "<input type=\"submit\" value=\"GET DIC\" name=\"submit\">";
echo "</form>";
}else{
$file = fopen($dict, "r");
while (!feof ($file)){
$load[$i] = fgets($file, 1024);
mysql_connect("xxx","xxx","xxx");
mysql_select_db("xxx");
$word = $load[$i];
$md5 = md5($word);
$lastid=mysql_insert_id();
$lastid=$lastid+1;
mysql_query("INSERT INTO md5 VALUES ('$lastid', '$md5', '$word');");
$i++;
$limit = count($load);
$width2 = $limit;
}
fclose($file);
echo "[+]Loaded ".$limit." word.";
echo "<br>Done.";
}
?>
I'm having troubles generating the ID for each row. I want the script to begin the number of ID from the last number that is stored in the database.
for example:
ID : MD5 : Country
1 : HASH: Africa
2 : HASH: Russia
When I execute the script I want it to start from ID number 3 and carries on until the list is finished. What's wrong with my script?