Jump to content

[SOLVED] Uninitialized string offset issue


gamerx

Recommended Posts

Hi guys,

i am having this issue wheras php outputs this error:

 

Notice: Uninitialized string offset: 36 in C:\Program Files\EasyPHP 3.0\www\register.php on line 73

 

now this is my code around line 73:

 

$captchars = '0123456789abcdefghijklmnopqrstuvwxyz';
$captchalength = rand(3, 5);
    $characters = $captchars;
//captcha string
$captstring = ""; 
    for ($p = 0; $p < $captchalength; $p++) {
        $captstring .= $characters[mt_rand(0, strlen($characters))];
    }
   $captchatext = $captstring;

 

i then have a captcha image generation scriptthat takes the variable "$captchatext" and makes it an image,

 

now this error only happens at some times and takes one letter off the string, it can also happen twice and take 2 letters, kinda annoying :(

 

thanks heaps :)

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.