Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/157287-simple-php-question/
Share on other sites

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 :)

Link to comment
https://forums.phpfreaks.com/topic/157287-simple-php-question/#findComment-828999
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.