<?
session_start();
function makeRandomcaptcha() {
$salt ="abch123efgABCDEFhjkm4LMNP567npqGHIJKrstuvwxyz89";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 5) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$captcha_word = makeRandomcaptcha();
if($_GET[tampil]=="1")
{
$im = imagecreate(100, 30);
$hitam = imagecolorallocate( $im,255,255,255);
$putih = imagecolorallocate( $im,0,0,0);
$ukuran_font = 5;
imageline($im, 0, 15, 99, 15, $putih);
$pos_x = (imageSX($im) - strlen($_GET[cod]) * imagefontwidth($ukuran_font))/2;
$pos_y =(imageSY($im) - imagefontheight($ukuran_font))/2;
imagestring($im, $ukuran_font, $pos_x, $pos_y, $_GET[cod], $putih);
header("Content-Type: image/jpeg");
imageJPEG($im);
imagedestroy($im);
}
include"koneksi.inc.php" ?>
<table width="800px" height="100px" style="position:absolute;top:0px;z-index:100" bgcolor="#ffffff"><tr><td>
</td></tr></table>
<form method="POST" action="forminputbloglist.php" style="position:absolute;top:20px;z-index:101">
<table width=90% style="font-family:verdana;font-size:11px" cellpadding=2 cellspacing=4>
<tr bgcolor=#efefef><td>Input Link Blog</td></tr>
<tr><td>Title Blog</td></tr>
<tr><td><input type="text" name="nama" size="40" maxlength="20" value="<? echo"$_POST[nama]"; ?>"></td></tr>
<tr><td>URL (mis:http://abgamal.blogspot.com)</td></tr>
<tr><td><input type="text" name="urlx" value="<? echo"$_POST[urlx]"; ?>" size="40"></td></tr>
<tr><td>Keterangan (Max :100 karakter)</td></tr>
<tr><td><input type="text" name="ket" value="<? echo"$_POST[ket]"; ?>" maxlength="200" size="40"></td></tr>
<tr><td>MASUKKAN KODE </td></tr>
<tr><td>
<? echo"<img src=forminputbloglist.php?tampil=1&cod=$captcha_word>"; ?>
</td>
</tr>
<tr><td><input type=text name=word id="word"></td></tr>
<input type=hidden name=words id="words" value="<? echo"$captcha_word"; ?>"></td></tr>
<tr><td><input type="submit" name="submit" value="input"></td></tr>
</table>
</form>
<?
if($_POST[submit])
{
$urlstr=substr("$_POST[urlx]",0,7);
if(empty($_POST[nama]))
{
echo"<script>alert('title tidak boleh kosong')</script>";
}
elseif(empty($_POST[urlx]))
{
echo"<script>alert('url tidak boleh kosong')</script>";
}
elseif($urlstr!="http://")
{
echo"<script>alert('salah penulisan url')</script>";
}
elseif(empty($_POST[ket]))
{
echo"<script>alert('keterangan tidak boleh kosong')</script>";
}
elseif($_POST[word]!=$_POST[words])
{
echo"<script>alert('kode salah')</script>";
}
else
{
$nama=str_replace("'","",$_POST[nama]);
$ket=str_replace("'","",$_POST[ket]);
$urlx=str_replace("'","",$_POST[urlx]);
$now=time();
mysql_query("INSERT INTO bloglist (id,nama,link,ket) VALUES ('$now','$nama','$urlx','$ket')");
echo"<script>window.close()</script>";
}
}
?>
<div style=display:none>
teruz dipaste dmna bozz codenya??
ReplyDeletebisa tukeran link bozz??