tech929rr Posted May 7, 2009 Share Posted May 7, 2009 I am getting a error Notice: Uninitialized string offset: 16 in C:\wamp\www\projectdecode\decoder\upload.php on line 191 Here is a part of the code where the error is. // decrypt chunk $j = 0 ; for ( $i = 0 ; $i < strlen ( $chunk ); $i ++) { // Here is where the error is $chunk [ $i ]= chr ( ord ( $chunk [ $i ]) ^mt_rand (0 , 0xff ) ^ ord ( $chunk_md5 [ $j ])); if ( $j < strlen ( $chunk_md5 )) { $j ++; } else { $j = 0 ; } } echo "Dumping decrypted header: <b>header.dat</b><br>\n" ; $f = fopen ( "header.dat" , "wb" ); fwrite ( $f , $chunk ); fclose ( $f ); print file_get_contents( 'header.dat' ); ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/157287-simple-php-question/ Share on other sites More sharing options...
premiso Posted May 7, 2009 Share Posted May 7, 2009 It is funny what people think is "simple". I mean honestly if it was really simple, I would hope that you could figure it out. Change this part: for ( $i = 0 ; $i < (strlen ( $chunk ) - 1); $i ++) { And this: if ( $j < (strlen ( $chunk_md5 )-1)) { The issue is your increment is probably going 1 too high since you are starting at a 0-base and strlen returns the length starting at 1 not 0. EDIT: Strike the edit Quote Link to comment https://forums.phpfreaks.com/topic/157287-simple-php-question/#findComment-828999 Share on other sites More sharing options...
tech929rr Posted May 7, 2009 Author Share Posted May 7, 2009 Thanks for that. I found out that the Mersenne-Twister random generator is not used by php5 no more. There is another random generator used now. What is it? And how would I convert this script to use the new random generator? Quote Link to comment https://forums.phpfreaks.com/topic/157287-simple-php-question/#findComment-829022 Share on other sites More sharing options...
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.