Georgio
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by Georgio
-
-
Hi everyone!
I am new in language programming so your assistance would be highly appreciated. I learning PHP programming and now on a script with the usage of Mcrypt which seems not to be working well. The error message I receive when I run the script is it cannot decode as required and further get the following error:
Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorrect; supplied length: 0, needed: 8 in c:\Inetpub\wwwroot\php\phpadv_scripts\4\Script4_6Admn\see_users.php on line 25
1George $1$9J..cg2.$F8Ob4lssAWBzq2xViPDr31 pTzSswVo/NZhfZq1asYfQC8P0lefe91/TBWrFZ93nXyes+eggjqzS+RNxt1zyqBY 5Fl6lc4xjwA=
ÊqÈá?·´
Here is the script:
<?php # Script 4.6
if ($file_array = @file ("../../users.txt")) { // Read the file into an array.
// **** Mcrypt *****
// Create a key.
$key = "Hey! Here's the KEY.1776";
// Open and initialize Mcrypt.
$module = mcrypt_module_open (tripledes, '', ecb, '');
foreach ($file_array as $key => $value) { // Loop through each line.
$line = explode ("\t", $value);
// Decrypt the data.
$iv = base64_decode(trim($line[3]));
mcrypt_generic_init ($module, $key, $iv);
$data = mdecrypt_generic ($module, base64_decode($line[2]));
echo "<pre>$line[0] $line[1] $data</pre><p></p>\n"; // Print the data.
}
// Close Mcrypt.
mcrypt_generic_deinit ($module);
} else { // If it couldn't read the file, print an error message.
echo "Could not read the users file!<br />";
}
?>
What could be the cause for the error?
I am using the following on my system:
Windows XP - Home Edition
IIS 5
PHP 5.1.2.
MySQL 5.0.19-nt
Thanks for any help that solve this problem for me.
here2learn [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
Any good books on PHP?
in PHP Coding Help
Posted
[img src=\"http://images.amazon.com/images/P/0321245652.01._AA240_SCLZZZZZZZ_.jpg\" border=\"0\" alt=\"IPB Image\" /]
great book.
[/quote]
Can't agree more. Larry's books are good. You can find the basic edition, Advanced Edition and a combined PHP and MySQL. Much as I agree with AndyB that many books contain outdated code which is more likely to frustrate than educate, there are, however, forums for these books that answer questions posed from the them.
here2learn