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

Link to comment
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.