Jump to content

Simple PHP Question


tech929rr

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

Archived

This topic is now archived and is closed to further replies.

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