password ikut terupdate

deny · Aug 4, 2012
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>

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
ak pny 2 table bbk dan bbk detail


CREATE TABLE IF NOT EXISTS `t_bbk` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`bbk_number` varchar(30) NOT NULL,
`so_number` varchar(30) NOT NULL,
`order_number` varchar(30) NOT NULL,
`order_tgl` date NOT NULL,
`tgl` date NOT NULL,
`gudang` varchar(30) NOT NULL,
`kategori` varchar(15) NOT NULL,
`notes` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


CREATE TABLE IF NOT EXISTS `t_bbkdetail` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`id_bbk` int(5) NOT NULL,
`nama_brg` varchar(30) NOT NULL,
`spl` varchar(10) NOT NULL,
`code` varchar(20) NOT NULL,
`speck1` varchar(10) NOT NULL,
`speck2` varchar(10) NOT NULL,
`speck3` varchar(10) NOT NULL,
`qty` int(5) NOT NULL,
`satuan` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
editbbkForm.php

<form method="post" action="updateBbk.php">
        <input type="hidden" name="id" value="<?php echo"$id"; ?>">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td width="11">&nbsp;</td>
    <td width="876" valign="top">
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
					<tr>
					  <th colspan="6" align="left"><span class="style8">VIARA Plastics</span></th>
					  <th align="left">&nbsp;</th>
					  <th align="center">&nbsp;</th>
					  <th colspan="3" align="left">&nbsp;</th>
					  <th align="left">&nbsp;</th>
				  </tr>
					<tr>
					  <th colspan="6" align="left">Bukti Barang Keluar</th>
					  <th align="left">&nbsp;</th>
					  <th align="center">&nbsp;</th>
					  <th colspan="3" align="left">&nbsp;</th>
					  <th width="146" align="left">&nbsp;</th>
				  </tr>
					<tr>
						<th width="178" align="left"> BBK No</th>

					  <th width="26" align="center">:</th>
					  <td colspan="4" align="left"><input type="text" name="bbk_number" value="<?php echo $bbk_number?>" /></td>
					  <th width="50" align="left">&nbsp;</th>
					  <th width="27" align="center">&nbsp;</th>
				      <th width="174" align="left">Tanggal</th>
				      <td colspan="3" align="left"> : &nbsp;&nbsp;&nbsp;<?php echo $tgl; ?></td>
			      </tr>
					<tr>
					  <th align="left">Sales Order No</th>
					  <th align="center">:</th>
					  <td colspan="4" align="left"><input type="text" name="so_number" value="<?php echo $so_number?>" /></td>
					  <th align="left">&nbsp;</th>
					  <th align="center">&nbsp;</th>
					  <th width="174" align="left">Gudang</th>
				      <td colspan="3" align="left"> : &nbsp;&nbsp;&nbsp;<input type="text" name="gudang" value="<?php echo $gudang; ?>" size="15" /></td>
			      </tr>
					<tr>
						<th align="left">Order Produksi No</th>
						<th align="center">:</th>
						<td colspan="4" align="left"><input type="text" name="order_number" value="<?php echo $order_number?>" /></td>
						<th align="left">&nbsp;</th>

						<th align="center">&nbsp;</th>
					  <th width="174" align="left">Kategori</th>
	        <td colspan="3" align="left">: &nbsp;&nbsp;&nbsp;<select name="kategori" id="<?php echo $kategori?>">
                          <option id="Bahan Baku">Bahan Baku</option>
                          <option id="Produk Jadi">Produk Jadi</option>
                      </select></td>
				  </tr>
					<tr>
					  <th align="left">Tanggal Order</th>
					  <th align="center">:</th>
					  <td colspan="4" align="left"><input type="text" name="order_tgl" id="demo3" maxlength="25" size="25" class="text_box" value="<?php echo $order_tgl?>"/>
          <a href="javascript:NewCssCal('demo3','yyyymmdd')"> <img src="images/cal.gif" width="16" height="16" alt="Pick a date" /></a>&nbsp;</td>
					  <th align="left">&nbsp;</th>
					  <th align="center">&nbsp;</th>
					  <th align="left">&nbsp;</th>
					  <td colspan="3" align="left">&nbsp;</td>
				  </tr>
				</table>
			    <table width="100%" border="1" cellspacing="0" cellpadding="0" class='tab' id='listBarang'>
                  <tr>
                    <th width="6%" height="29"><strong>No</strong></th>
                    <th width="23%">Nama Barang</th>
                    <th width="7%">Spl</th>
                    <th width="13%">Code</th>
                    <th width="32%">Spesifikasi</th>
                    <th width="8%">Qty</th>
                    <th width="11%">Satuan</th>
                  </tr>
 <?php
			$i=1;
			//$total = 0;
			foreach($data as $row)
			{ //qty,nama_brg,spl,code,satuan,speck1,speck2,speck3
			?>
                  <tr>
                    <td align='center'><?php echo $i; ?></td>
                    <td align='center'><input type="text" name="nama_brg" value="<?php echo $row[1]; ?>" size="20"></td>
                    <td align='center'><input type="text" name="spl" value="<?php echo $row[2]; ?>" size="5" /></td>
                    <td align='center'><input type="text" name="code" value="<?php echo $row[3]; ?>"  size="10"/></td>
                    <td align='center'><input type="text" name="speck1" value="<?php echo $row[5]; ?>"  size="2"/>&nbsp;&nbsp;<input type="text" name="speck2" size="2" value="<?php echo $row[6]; ?>" />&nbsp;&nbsp;<input type="text" name="speck3" value="<?php echo $row[7]; ?>" size="2" /></td>
                    <td align='center'><input type="text" name="qty" value="<?php echo $row[0]; ?>"  size="3"/></td>
                    <td align='center'><input type="text" name="satuan" value="<?php echo $row[4]; ?>" / size="5"></td>
                  </tr>
                  
                    <?php
            $i++;
			//$total += ($row[1]*$row[3]);
			}
			?>
                </table>
			 
				    <table width="100%" border="0" cellspacing="0" cellpadding="1">
                  <tr>
                    <td width="84">Keterangan</td>
                    <td width="782" rowspan="2" align="left"><textarea name="notes" cols='60' rows='5' id='notes' style="border:solid 1px #000000; border-collapse:collapse"><?php echo $notes?></textarea></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    </tr>
                </table>				 	  </td>
  </tr>
  <tr>
    <td valign="top" align="left">&nbsp;</td>
    <td colspan="2"><input type="submit" name="bsubmit" value="Save" style="color:#0066ff; background-color:#00ff00">&nbsp;&nbsp;      <input type="button" value="Cancel" class="buttonStyle" onclick="window.location='Indexbbk.php'"  style="color:#0066ff; background-color:#00ff00"/></td>
    </tr>
</table>
        </form>
updateBbk.php


<?php 
include 'conf.php';
 if(isset($_POST['bsubmit'])){
	print_r($_REQUEST);
      
	  	$id 			= $_POST['id'];
	   	$bbk_number 	= $_POST['bbk_number'];
		$so_number		= $_POST['so_number'];
       		$order_number 	= $_POST['order_number'];
		$order_tgl		= $_POST['order_tgl'];
		$tgl			= date('Y-m-d');
		$gudang			= $_POST['gudang'];
		$kategori		= $_POST['kategori'];
        	$notes			= $_POST['notes'];
		$nama_brg       = $_POST['nama_brg'];
		$spl		    = $_POST['spl'];
		$code	        = $_POST['code'];
		$speck1         = $_POST['speck1'];
		$speck2         = $_POST['speck2'];
		$speck3	        = $_POST['speck3'];
		$qty		    = $_POST['qty'];
		$satuan         = $_POST['satuan'];
				
	  		$query_1 = "UPDATE t_bbk a , t_bbkdetail  b SET
					a.bbk_number	 = '$bbk_number',
					a.so_number		 = '$so_number',
					a.order_number	 = '$order_number',
					a.order_tgl		 = '$order_tgl',
					a.gudang		 = '$gudang',
					a.kategori		 = '$kategori',
					a.notes			 = '$notes',
					b.nama_brg		 = '$nama_brg',
					b.spl			 = '$spl',
					b.code			 = '$code',
					b.speck1		 = '$speck1',
					b.speck2		 = '$speck2',
					b.speck3		 = '$speck3',
					b.qty			 = '$qty',
					b.satuan		 = '$satuan'
					
					Where 	a.id=b.id_bbk and a.id='$id'";
 				 mysql_query($query_1) or die(mysql_error());
				
		   
            echo "Data Berhasil disimpan <br>";
   
 		  echo"<script language='javascript'>window.location='indexBbk.php'</script>";

 
    }else{
        header('Location: indexBbk.php');
	   
    }

?>


jika ak gunakn fungsi d atas hny bisa untuk update 1 row pada t_bbkdetail

bgm jk ad 2 atw lebih row yg hrs d update pd t_bbkdetail,,,

thx

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
gmn caranya memunculkan pilihan yg kita pilih dr radio button dan pilihan itu muncul di form sebelumnya?
contoh, 1 Lusin ada 12 buah.
Nama Barang : Lusin
Detail Satuan : 12
Lusin menggunakan a href, jadi saat kita klik lusin, popup radio button muncul.
Saat pilih Buah, data Buah muncul di samping angka 12.
Mohon bantuannya, terimakasih ;)

Lihat semua 1 jawaban

Silahkan login untuk menjawab!

poling

Andy Baim · Aug 2, 2012
assalamualaikum
gan sintak buat polling di php dg database mysql
tolong ya gan;)

Lihat semua 4 jawaban

Silahkan login untuk menjawab!

CodeIgniter

Eastman disciple · Aug 2, 2012
Gan, ada tutorial PHP Framework CodeIgniter ga?. Thx GBU

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
$query = "SELECT id_bulan , nama_bulan FROM tb_bulan WHERE id_bulan NOT IN (SELECT bln_bayar FROM pembayaran WHERE nis = $_POST )";

Lihat semua 2 jawaban

Silahkan login untuk menjawab!