Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:52:04+00:00 2026-06-12T11:52:04+00:00

I have an old image captcha generator written in PHP4 that i need to

  • 0

I have an old image captcha generator written in PHP4 that i need to convert to PHP5
Any suggestions for what I need to change to get it to start working? The main error I’m getting reads “Resource interpreted as Image but transferred with MIME type text/html” Which I already told it to have a MIME type of image throough the code below when I said header(‘Content-type: image/jpeg’);

<?php
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);

session_start(); 

$alphanum  = "ABGKLMNPRSTUXZ"; 
$rand = substr(str_shuffle($alphanum), 0, 5); 
$image = imagecreatetruecolor(65,25);
$background = imagecolorallocate($image, 255, 255, 255);
$border = imagecolorallocate($image, 128, 128, 128);
$colors[] = imagecolorallocate($image, 128, 64, 192);
$colors[] = imagecolorallocate($image, 192, 64, 128);
$colors[] = imagecolorallocate($image, 108, 192, 64);

imagefilledrectangle($image, 1, 1, 65 - 2, 25 - 2, $background);
imagerectangle($image, 0, 0, 65 - 1, 25 - 1, $border);

for ($i = 0; $i < 5; $i++){
    $x1 = rand(0, 65 - 5);
    $y1 = rand(0, 25 - 5);
    $x2 = $x1 - 4 + rand(2, 8);
    $y2 = $y1 - 4 + rand(2, 8);
    imageline($image, $x1, $y1, $x2, $y2,$colors[rand(0, count($colors) - 1)]);
}

$textColor = imagecolorallocate ($image, 30, 30, 30); 

imagestring ($image, 8, rand(8,10), rand(1,8),  $rand, $textColor); 

$_SESSION['image_random_value'] = md5($rand); 

header("Expires: Mon, 26 Jul 1998 06:00:00 GMT");  
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
header("Cache-Control: no-store, no-cache, must-revalidate");  
header("Cache-Control: post-check=0, pre-check=0", false);  
header("Pragma: no-cache");
header('Content-type: image/jpeg');

imagejpeg($image); 
imagedestroy($image); 
?>

This image loads into the page here if its at all helpful:



    
    function textCounter(field, countfield, maxlimit) {
    if (field.value.length > maxlimit)
    field.value = field.value.substring(0, maxlimit);
    else
    countfield.value = maxlimit - field.value.length;
    }
    function form_visible(){
    var el = document.getElementById('sf');
    if(el.style.display == 'inline'){
    el.style.display = 'none';
    }else{
    el.style.display = 'inline';
    }
    }
    var shows = 0;
    var lc;
    var i;
    var image;
    var ny;
    function show(star_img,rnid) 
    {
    if (shows){
    if(rnid==lc){
    return;
    }
    }

    for (i=1; i");
    for (var i=1; i");
    }
    document.write("Please Select");
    }
    
     $value) {
    ${$key} = $value;
    } 
    foreach($_POST AS $key => $value) {
    ${$key} = $value;
    } 

    $db=mysql_connect($db_host,$database_user,$database_pass) or die("MySQL Error: Unable to connect to database please check that you have provided the correct 
  • Database Login username
  • Database Login Password"); mysql_select_db($db_name,$db)or die("MySQL Error: Unable to select database please check that you have provided the correct
  • Database name"); echo "


    "; $day =date("D d"); $month =date("M"); $year =date("Y"); $dt="$year-$month-$day"; $ent=mysql_query("SELECT * FROM ez_ccomment_opt"); $rowi=@mysql_fetch_array($ent); if($do=="do_sign" && $id=="$mid"){ if ($comment !="" && $email !="" && $name !="" && $rating!=""){ if(md5($_POST['security']) == $_SESSION['image_random_value']){ $comment = str_replace ("",">", $comment); $name = str_replace ("",">", $name); $email = str_replace ("",">", $email); $website = str_replace ("", $comment); $comment = str_replace ("

    ", "
    ", $comment); $name = stripslashes ($name); $comment = stripslashes ($comment); $lis="0"; if($rowi[filter]=="y"){ $user=file("badwords.txt"); for($x=0;$xPlease enter valid security image."; } }else{ $w="1"; echo "Please fill in the required fields.";} } ob_start(); echo ""; echo "Rating*"; ?> showform(1); "; echo "Comments* Name* Email* (Will not be shown) Security Image*make sure to type security image in ALL CAPITAL characters!
    * = Required


    "; echo ""; ob_end_flush(); if($w=="1"){ ?> var el = document.getElementById('sf'); el.style.display = 'inline'; "; $list = ("SELECT * FROM ez_ccomment WHERE status='confirmed' AND ccid='$id' ORDER BY op DESC"); $row_num1= @mysql_num_rows(mysql_query($list)); $list_per_page=$rowi['limit_pp']; if($row_num1>0){ echo "Comments"; }else{ echo "No ratings yet. Be the first to add a rating!"; } if($start==""){ $start=1; } if($start==""||$start==1){ $sfrom=0; }else{ $sfrom=(($start-1)*$list_per_page); } $end=$list_per_page; $gr=0; $list.= (" LIMIT $sfrom,$end"); $blist=(mysql_query($list)); while($row=@mysql_fetch_array($blist)){ if(substr_count($row[email],"@")==1){ $name="$row[name]"; }else{ $name="$row[name]"; } $messag=$row[message]; $messag=wordwrap($messag, 55, "\n", 1); $row[rating]=round($row[rating],2); if ($row[rating] == 5) { $star = "images/5star.gif" ; $pk="5 - Excellent!"; } if ($row[rating]>=1 && $row[rating]=2 && $row[rating]=3 && $row[rating]= 4 && $row[rating]= 5) { $star = "images/5star.gif" ; $pk="5 - Excellent!"; } if ($row[rating] $messag$row[name], $row[date]"; $gr+=1; } $list_per_page=$rowi['limit_pp']; echo ""; if($start==""){ $start=1; } if($start==""||$start==1){ $sfrom=0; }else{ $sfrom=(($start-1)*$list_per_page); } $end=$list_per_page; if ($row_num1>$list_per_page){ $no_of_page=$row_num1/$list_per_page; $no_page=explode(".",$no_of_page); if($no_page[1]>0){ $no_of_page+=1; } echo ""; echo ""; if($start > 1){ $s=$start-1; echo "Previous"; } echo ""; $last=round($no_of_page,0); for($i=1;$i$i "; }else{ echo " $i "; } }else{ if($i>$start+3){ if($once==""){ echo " ....... $last"; } $once="yes"; }elseif($i0){ echo "1 ....... "; } $tonce="yes"; }else{ if($i!=$start){ echo " $i "; }else{ echo " $i "; } } } } echo ""; if($start Next"; }elseif($start>=$i){ $next = ""; } echo "$next"; } echo ""; ?>
    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-06-12T11:52:06+00:00Added an answer on June 12, 2026 at 11:52 am

      In that code, just change $HTTP_GET_VARS for $_GET and $HTTP_POST_VARS for $_POST

      extract($_GET);
      extract($_POST);
      

      I tried it and it works.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    I have one old function that I need to edit doSome($_FILES['image']); My question is
    I have an old skin that I need to adapt to the new MediaWiki
    In the old static image Google charts I have been producing a combined chart
    I have old text inside a div. I want that text to fly out
    I have old code that uses size_t which IIRC comes from cstring.h. On OS
    I have refereed old questions and found that people face many issues after installing
    I have created a image crop facility that I can click on an image
    I am coding a galery in jquery. I have an image zoom tool that
    I'm working on an old-school image warp filter. Essentially, I have a 2D array
    I have a rails project that uses an old versions of the FlexImage plug-in

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.