permisi mas Ellyx, saya mau nanya ketika saya mengedit foto profilenya lalu saya update passwordnya ikut berubah juga mas..kenapa bisa begitu y?script update saya begini mas.mohon bantuannya..
<?php
session_start();
$user_name=ucwords($_SESSION['user_name']);
$foto = $_FILES['foto']['name'];
$time=date("G");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if (session_is_registered('user_id'))
{
include"./config/conn.php";
$tampil=mysql_db_query($db,"SELECT * from daftar where user = '$user_name'")or die("gagal koneksi ".mysql_error());
$data=mysql_fetch_array($tampil);
$nama=$_POST['nama'];
$kota=$_POST['kota_asal'];
$user=$_POST['user'];
$email=$_POST['email'];
$pass=md5($_POST['pass']);
$foto = $_FILES['foto']['name'];
$size = $_FILES['foto']['size'];
$error = $_FILES['foto']['error'];
if($size > 0 && $error == 0){
move_uploaded_file($_FILES['foto']['tmp_name'],'./images/'.$foto);}
if(empty($nama) or empty($kota) or empty($user) or empty($email)){
echo"<script>alert('isi semua fields');history.go(-1)</script>";
}
else{
if(!empty($foto) && !empty($pass)){
$sqlsimpan="update daftar set
nama='$nama',
kota_asal='$kota',
user='$user',
pass='$pass',
email='$email',
foto='$foto'
where user='$user_name'";
if($foto != $data['foto']){
@unlink("./images/".$data['foto']);
}
$update=mysql_query($sqlsimpan) or die ("data belum tersimpan".mysql_error());
}
else if(!empty($foto) && empty($pass)){
$sqlsimpan="update daftar set
nama='$nama',
kota_asal='$kota',
user='$user',
email='$email',
foto='$foto'
where user='$user_name'";
if($foto != $data['foto']){
@unlink("./images/".$data['foto']);
}
$update=mysql_query($sqlsimpan) or die ("data belum tersimpan".mysql_error());
}
else if(empty($foto) && !empty($pass)){
$sqlsimpan="update daftar set
nama='$nama',
kota_asal='$kota',
user='$user',
pass='$pass',
email='$email'
where user='$user_name'";
$update=mysql_query($sqlsimpan) or die ("data belum tersimpan".mysql_error());
}
else
{
$sqlsimpan="update daftar set
nama='$nama',
kota_asal='$kota',
user='$user',
email='$email',
where user='$user_name'";
$update=mysql_query($sqlsimpan) or die ("data belum tersimpan".mysql_error());
}
}
if ($update) {
echo"<script>alert('Data Anda berhasil diperbaharui')</script>";
echo"<meta http-equiv='refresh' content='0; url=index.php'>";
}
else {
echo"<script>alert('Data Gagal Diperbaharui')</script>";
echo"<meta http-equiv='refresh' content='0; url=editslankers.php'>";
}
}
else{?>
<script language="javascript">alert("Anda Belum Login!!,,silahkan login terlebih dahulu");</script>
<script> document.location.href='index.php'; </script>
<?php
}
echo"</center>";
?>
</body>
</html>