Wednesday, April 29, 2009

Script Edit Profil dot PHP

<?
include"koneksi.inc.php";

if($_POST[editprofil])
{
$urlstr=substr("$_POST[url]",0,7);
if($_POST[nama_dpn]=="" || $_POST[email]=="" || $_POST[url]=="")
{
?>
<script>
alert('nama, email, url tidak boleh kosong');
window.location="http://abgamal.blogspot.com/?mode=editprofil";
</script>
<?
}
elseif(!ereg("^.+\..+$",$_POST[email]))
{
?>
<script>
alert("~~~ Warning!! ~~~ \n\n INVALID PENULISAN EMAIL")
window.location="http://abgamal.blogspot.com/?mode=editprofil";
</script>
<?
}
elseif($urlstr!="http://")
{
?>
<script>alert('salah penulisan url')
window.location="http://abgamal.blogspot.com/?mode=editprofil";
</script>
<?
}
else
{
$updateprofil=mysql_query("UPDATE user SET realname='$_POST[nama_dpn]',email='$_POST[email]',url='$_POST[url]' WHERE id='$_POST[id]'");

if($updateprofil)
{
header('location:http://abgamal.blogspot.com');
}
else
{
?>
<script>alert('eksekusi database gagal')
window.location="http://abgamal.blogspot.com";
</script>
<?
}

}
}
else
{
header('location:http://abgamal.blogspot.com');
}
?>

<----------Batas Copy----------->
Ganti text warna merah dengan alamat blog anda

No comments:

Post a Comment