"Localhost" and "" is always the same thing to me. But I remember some articles I read few weeks ago to declare some new product or new services are not recognize "Localhost" anymore.
"bradgrafelman" reminds me the problem might caused by url.
Whenever you download this cute captcha from Author's site.
CF Captcha v0.9
// Author: codefuture.co.uk
It works fine no matter what with Firefox.

But if you test this captcha with IE8. You'll get the error message if your url like this:
There's something inside the code has conflicted with the keyword "Localhost" .
The error message gone simply just replace your url in your local machine like this :

So far , I just know there's some of the code inside this captcha has conflicted with keyword "Localhost" along with IE 6 & 8. But I'm not able to pin-point it so far.
I would be very glad if anyone might able to dig deeper in this issue.

So.... hum.... Just remember this. Localhost is no longer the same as .

How comes I never think about this??????? Thanks for bradgrafelman!!! You're right. That's exactly as what you believe.

Simply just change this

To this.....


Just tried on my neighbor's computer.
Both two computer's works fine in Firefox but shows a cookie error on IE.
I tried almost every possible setting in IE. Turn off all anti-virus and anti-spam program. Turn the security level of IE to lowest. Accept all cookies....

Neighbor's computer ;
Apache  2.215
PHP     5.32
MySQL   5.07

My Computer ; 
Apache  2.063
PHP     5.214
MySQL   5.09

The demo on Author's website works both on FF and IE.
But when I download the code on local machine. It works only in Firefox.
I thought it's the IE browser setting from the beginning but I already changed all settings and tested under two different OS win7 and xp. It's the same. Only works in Firefox.

This tiny captcha code is kind of weird. Only works in Firefox but not IE (6,8)
Hope someone may figure it out what's going on?
Or you may download this code from Author. (demo included)
Click Here


            echo 'CAPTCHA CHECK: <span style="color:red">'.$error_captcha.'</span>';
            echo 'CAPTCHA CHECK: <span style="color:green">Correct</span>';

<form  method="post" action="" class="center">
    <br/><img id="captcha_img" src="./captcha/cf.captcha.php?img=<?=time();?>" /><br/>
    <a href="#" onclick="document.getElementById('captcha_img').src = './captcha/cf.captcha.php?img=' + Math.random(); return false">Reload Captcha</a><br/>
    <label for="setCaptcha">Verification code: </label><br/>
    <input name="setCaptcha" type="text" id="setCaptcha" size="24" class="textbox" /><br/><br/>
    <input type="submit" value="Send" /><br/>


//   CF Captcha v0.9
//   -------------------------------
//   Author:    codefuture.co.uk
//   Version:   0.9
//   Date:      28-Apr-10
//   download the latest version from - http://codefuture.co.uk/projects/captcha/
//   Copyright (c) 2010 codefuture.co.uk

//  error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// settings

// Cookie timer
    define('COOKIE_TIMER', 5 );

// Cookie Salting Pick a random code
    define('SALTING', 'aeb1021e49282375948ac10004c2eb53ef9070e0');

// check_captcha() Error Messages
    define('ERROR_MESSAGE_CAPTCHA',             'Verification code can\'t be blank');
    define('ERROR_MESSAGE_CAPTCHA_INVALID',     'Verification code is invalid');
    define('ERROR_MESSAGE_CAPTCHA_TIMED_OUT',   'Sorry the verification code is only valid for '.COOKIE_TIMER.' minutes');
    define('ERROR_MESSAGE_CAPTCHA_COOKIE',      'No captcha cookie given. Make sure cookies are enabled.');

// Check Captcha

 * Holds any errors from check_captcha
 * you could use it like this
 * <div style="color:red"><?=$error_captcha;?></div>
    $captcha_error = null;

 * check_captcha()
 * @param string $captcha
 * @param boolean $timer (on|off)(true|false)
 * @return boolean
function check_captcha($captcha,$timer = true){
    global $error_captcha;

    $captcha = htmlspecialchars(stripslashes(trim($captcha)));

        $error_captcha = ERROR_MESSAGE_CAPTCHA;
        return false;

    }elseif (isset($_COOKIE['Captcha']) ...

Here's the fixed file. Just in case if anyone interested.


In fact, I know nothing about Smarty and I always thought it's something like a clothing. You may just put it on and off.
Never thought it transplants that deep into the source code that seems you need a surgical operation to remove it.

It's not motivated at all if the only reason for you to learn a Language just to remove it, right ?!

I need to do this in a much bigger project. Well~~ ok!! Let's learn some Tasty Smarty.
Thanks for all your reply~

There's one more document in the Smarty template "index.tpl" contains html.
The code between " {section} {/section} " must transform to pure PHP. I'm stuck right here. I must made some mistakes but just can't figure it out...... You know~~


<head> <title> Site Architecture Example </title> 

<table border="0" width="100%">
   <td align="left">
     <a href="http://www.packtpub.com">
      <img src="./images/PacktLogoSmall.png" border="0">
     <img src="./images/focused.gif">
   <h1> Chapter 2 Example </h1>

Here are the books in a two-column table : 
<br> <br>

<table border="1" width="100%">

{section name=tbl loop=$book->title}

 {if %tbl.index% is not odd}


 <td align="left">
      <img src="./images/{$book->image[tbl]}" width="220">

    <td valign="top">
      <font size=+1><b> {$book->title[tbl]} </b></font><br> 
      <font size=-1 color=blue><b>  {$book->author[tbl]} </b></font><br>
      {$book->description[tbl]} <br>
      Year: {$book->year[tbl]} <br>
      <font size=-1>Cover Price: <s>${$book->price[tbl]}</s></font> <br>
      Our Price: ${$book->discounted[tbl]} 
      <font color=red> save {$book->discount[tbl]} % </font>

 {if %tbl.index% is odd}




Here is a very tiny program(3 files) has embedded with Smarty template engine.
Anyone knows how to remove Smarty completely?
I konw the procedure to remove Smarty but failed to rewrite the code into pure PHP.
Complete source files as in attachment.

CLICK HERE!!~~~ http://www6.mimima.com/link.php?ref=FGHkNoDtmB


$book = new bo_books();

$smarty = new Smarty; 


class books {

    public $title = array(); 
    public $image = array(); 
    public $author = array(); 
    public $description = array(); 
    public $year = array ();
    public $price = array(); 

    // private 
    private $filename = "data.txt";

    //class constructor
    function __construct() {

     //get the lines as an array

      $lines = file($this->filename);

    // strip "\n" at the end of each array
    // get each variable in an array

      foreach ( $lines as $line) {

        if (strlen($line) > 2) {

        $line = rtrim($line);

        list($what, $content) = explode("=> ", $line."=> => => ");

        if ($what == "Title") {
            } elseif ($what == "Image") {
            } elseif ($what == "Author") {
            } elseif ($what == "Description") {
            } elseif ($what == "Year") {
            } elseif ($what == "Price") {

    } // end constructor

} // end GetData


class bo_books {

    public $title = array(); 
    public $image = array(); 
    public $author = array(); 
    public $description = array(); 
    public $year = array ();
    public $price = array(); 
    public $discount = array();
    public $discounted = array();

    protected $DataObject;

    function ...