0)
{
$SQL_CK = mysql_query("select * from chmod where user='$us' && keypm='1'");
if(mysql_num_rows($SQL_CK)<>0)
{
$Save_kh = $_REQUEST[Save_kh];
if($Save_kh == 1)
{
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $size; $i++ )
{
$str .= $chars[ rand( 0, $size - 1 ) ];
}
$LUU_KH = "INSERT INTO khachhang VALUES ('$str', '$TenKH', '')";
$Run_SQL_KH =mysql_query($LUU_KH,$ctqlpo);
}
?>
Untitled Document
window.location.href='Form_nhap_don_hang.php'";
}
if(mysql_num_rows($SQL_BILL)<>0)
{
$STT = 0;
while ($row = mysql_fetch_row($SQL_BILL)) //Chạy từ mẩu tin đầu đến mẩu tin cuối
{
$MaEND = $row[0];
}
$Dodai = strlen($MaEND);
$Madh = substr( $MaEND, 2, $Dodai) + 1;
$Mabill = $TTO.$Madh;
//----------------------------------- Check mã đơn hàng tồn tại -------------------------------
$SQL_BILL_TIM = mysql_query("select * from bill where Mabill='$Mabill'");
if(mysql_num_rows($SQL_BILL_TIM)<>0)
{
$Madh = $Madh + 1;
$Mabill_x = $TTO.$Madh;
}
if(mysql_num_rows($SQL_BILL_TIM)==0)
{
$Mabill_x = $Mabill;
}
//----------------------------------------------------------------------------------------------
$_SESSION[Mabill] = $Mabill_x;
$NGAY_HH = Ngaygio();
$ADD_BILL = "INSERT INTO bill VALUES ('$Mabill_x', '$us', '$NGAY_HH', '$TenKH', '$LoaiKH', '0', '0')";
$Run_SQL =mysql_query($ADD_BILL,$ctqlpo);
echo "";
}
?>
window.location.href='Thongbao.php'";
}
?>
window.location.href='Thongbao.php'";
}
?>