Jump to content


Photo

Ch 11 - Captcha


  • Please log in to reply
3 replies to this topic

#1 Violetta Rose

Violetta Rose

    New Member

  • Members
  • Pip
  • 2 posts

Posted 11 March 2011 - 02:32 AM

Hey there,

I could need some help with my very first captcha I ever tried to make.

I just tried to make running the code that's given in chapter 11, page 623, in the php and mysql book. But there's an error occurring. This is the feedback I get:


Fatal error: Call to undefined function SHA() in C:\Programme\xampp\htdocs\tom_2011-03-08\captcha.php on line 16


Line 16 is this one in the code:

$_SESSION['pass_phrase'] = SHA($pass_phrase);

Please ask me if you need the entire code from this lesson to find out where the problem is.

It would be great to get help.

Violetta

#2 drewdin

drewdin

    Super Veteran Member

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 608 posts
  • Gender:Male
  • Location:Boston

Posted 11 March 2011 - 06:12 AM

i used the following in my script, I thought the book had the same. How old is your book?

$_SESSION['pass_phrase'] = sha1($pass_phrase);

#3 lemuel

lemuel

    Super Veteran Member

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 577 posts

Posted 11 March 2011 - 12:00 PM

Sounds like Violetta is using the download version of the book, which is in error as per the errata:
http://oreilly.com/c...n=9780596006303

The correct function is "sha1".

#4 RobinClark007

RobinClark007

    New Member

  • Members
  • Pip
  • 1 posts

Posted 24 September 2014 - 09:02 PM

It's an error,you should see the book.
the book tells us we should use sha1 not sha

$_SESSION['pass_phrase'] = SHA1($pass_phrase);

btw. if you have a high gd version..you should use a relative path for the fonts.

// Draw the pass-phrase string
imagettftext($img, 18, 0, 5, CAPTCHA_HEIGHT - 5, $text_color, './Courier New Bold.ttf', $pass_phrase);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users