Form Login 
<form method="post">
                        <fieldset>
                           <div class="field">
                              <label class="label_field">Username</label>
                              <input type="text" name="user" required placeholder="Username" />
                           </div>
                           <div class="field">
                              <label class="label_field">Password</label>
  <input type="password" name="pass" required placeholder="Password" />
                           </div>

                           <div class="field">
     <label class="label_field">Captcha</label>
                              <img src="mycaptcha.php" width="100px">
                              <input type="text" name="captcha" required placeholder="Captcha" />
                           </div>
                           <div class="field margin_0">
                              <label class="label_field hidden"></label>
                              <button class="main_bt" type="submit" name="Login">Masuk</button>
  <button class="main_bt" type="reset" name="Reset">Reset</button>
                           </div>
                        </fieldset>
                     </form>
Mycaptca.php

<?php
session_start();
header("Content-type: image/png");
$captcha_image = imagecreatefrompng("ypathicon/captcha.png");
$captcha_font = imageloadfont("ypathicon/font.gdf");
$captcha_text = substr(md5(uniqid('')),-6,6);

$_SESSION['captcha_session'] = $captcha_text;

$captcha_color = imagecolorallocate($captcha_image,0,0,0);
imagestring($captcha_image,$captcha_font,15,5,$captcha_text,$captcha_color);
imagepng($captcha_image);
imagedestroy($captcha_image);
?>