Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Closed Thread
 
Thread Tools
  #1  
Old 08-11-2010, 03:06 PM
dezagus dezagus is offline
Hatchling Croc
 
Join Date: Aug 2010
Posts: 5
Default Captcha no Found

Hi Ali-Gators.

I wanna put on my code (Captcha code) but I cant.
The code sample a lot errors.
I change the permissions 755 (max on php file), but nothing...

The code is very simple:

PHP Code:
#create image and set background color
 
$captcha imagecreatetruecolor(120,35);
 
$background_color imagecolorallocate($captcha255255255);
 
imagefill($captcha00$background_color);
 
 
#generate a random string of 5 characters
 
$string substr(md5(rand()*time()),0,5);
 
#make string uppercase and replace "O" and "0" to avoid mistakes
 
$string strtoupper($string);
 
$string str_replace("O","B"$string);
 
$string str_replace("0","C"$string);
 
#save string in session "captcha" key
 
session_start();
 
$_SESSION["captcha"]=$string;
 
#place each character in a random position
 
$font 'arial.ttf';
 for(
$i=0;$i<5;$i++){
  
$color rand(0,32);
  if(
file_exists($font)){
   
$x=4+$i*23+rand(0,6);
   
$y=rand(18,28);
   
imagettftext  ($captcha15rand(-25,25), $x$yimagecolorallocate($captcha$color$color$color), $font$string[$i]);
  }else{
   
$x=5+$i*24+rand(0,6);
   
$y=rand(1,18);
   
imagestring($captcha5$x$y$string[$i], imagecolorallocate($captcha$color$color$color));
  }
 }
 
 
#applies distorsion to image
 
$matrix = array(array(111), array(1.071.0), array(111));
 
imageconvolution($captcha$matrix1632);
 
#avoids catching
 
header("Expires: 0");
 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 
header("Cache-Control: private",false); 
 
#return the image
 
header("Content-type: image/gif");
 
imagejpeg($captcha); 
Thank u so much from Argentina
  #2  
Old 08-11-2010, 04:18 PM
dezagus dezagus is offline
Hatchling Croc
 
Join Date: Aug 2010
Posts: 5
Default Re: Captcha no Found

someone help me?
  #3  
Old 08-11-2010, 04:22 PM
GatorSteveN's Avatar
GatorSteveN GatorSteveN is offline
HostGator Staff
 
Join Date: Dec 2006
Location: h-town
Posts: 510
Default Re: Captcha no Found

What errors are you getting?
__________________
Cheers,

Steve N
SEO/Senior Billing Administrator
HostGator.com LLC
http://support.hostgator.com

Houston Music Museum
The Birthplace of Rock and Roll


  #4  
Old 08-11-2010, 04:38 PM
dezagus dezagus is offline
Hatchling Croc
 
Join Date: Aug 2010
Posts: 5
Default Re: Captcha no Found

When I run the code first time, it works, but when reloading it, stop doing it

Quote:
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 66

Warning: imageconvolution() expects parameter 1 to be resource, string given in /home/myweb/public_html/sp/captcha/captcha.php on line 76

Warning: Cannot modify header information - headers already sent by (output started at /home/kimmego/public_html/sp/captcha/captcha.php:66) in /home/myweb/public_html/sp/captcha/captcha.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/kimmego/public_html/sp/captcha/captcha.php:66) in /home/myweb/public_html/sp/captcha/captcha.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /home/kimmego/public_html/sp/captcha/captcha.php:66) in /home/myweb/public_html/sp/captcha/captcha.php on line 81

Warning: Cannot modify header information - headers already sent by (output started at /home/kimmego/public_html/sp/captcha/captcha.php:66) in /home/myweb/public_html/sp/captcha/captcha.php on line 84

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/myweb/public_html/sp/captcha/captcha.php on line 85
  #5  
Old 08-11-2010, 06:16 PM
dezagus dezagus is offline
Hatchling Croc
 
Join Date: Aug 2010
Posts: 5
Default Re: Captcha no Found

Any idea?
In my localhost these script found good.
  #6  
Old 08-11-2010, 08:52 PM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,093
Default Re: Captcha no Found

Quote:
Originally Posted by dezagus View Post
Any idea?
In my localhost these script found good.
You have posted in the pre-sales questions forum, and this is hardly a pre-sales question.

You might get more help by posting in the shared hosting forum (if that's the plan you have, or submitting a ticket to HG.

Files should be chmod 0644.
__________________
- David
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Captcha? Anyone?? Pazeh Off-Topic 12 11-30-2009 05:08 PM
captcha issue krike Shared Hosting Support 3 05-08-2008 07:51 PM
Look what i found Sam Webhosting 19 04-27-2008 03:49 AM

All times are GMT -5. The time now is 11:38 PM.