
<?php

session_start();
@ob_start();
include "../../config/koneksi.php";

$module=$_GET[module];
$act=$_GET[act];
 
// Input YM
if ($module=='reg' AND $act=='input'){
	$cek = mysql_query("Select * from customer where email = '$_POST[email]'");
	$ketemu = mysql_num_rows($cek);
	

		  $passw = md5($_POST[passw]);
		  $acti = rand(1000,9999);
		  mysql_query("INSERT INTO customer(nama,passw,alamat,email,telp,memo,acti,tgllahir) VALUES('$_POST[nama]','$passw','$_POST[alamat]','$_POST[email]','$_POST[telp]','$_POST[passw]','$acti','$_POST[dob]')");
		  $to = $_POST[email];
		  $link = "http://milokaraoke.com/milo/activation.php?i=".$to."&a=".$acti;
		  $email_subject = 'Activation to Milo Family Karaoke Online Reservation';
		  $email_body = "Hi,\n\nYou have received a new message from Milo Family Karaole Online Reservation Registration form.\n\n"."Here are the details:\n\nName: $_POST[nama]\n\nActivation Code: $acti \n\nor click this link for activation $link";
		  $headerss = "From: noreply@milokaraoke.com\n"; 


		  
		  mail($to,$email_subject,$email_body,$headerss);
		  //echo "<script>alert('Anda telah berhasil registrasi'); window.location = 'index.php'</script>";
		  
		  header('location:activation.php?i='.$_POST[email].'&module=reg');

}

elseif ($module=='cust' AND $act=='add'){
	$sales = $_SESSION['nama'];
	mysql_query("INSERT INTO produk(produk,category) VALUES('$_POST[nama]','$_POST[cat]')");
	header('location:data.php');

}

elseif ($module=='cust' AND $act=='edit'){
	mysql_query("update produk set produk = '$_POST[nama]', category ='$_POST[cat]' where id = $_GET[id]");
	header('location:data.php');

}
elseif ($module=='cust' AND $act=='delete'){
	mysql_query("delete from produk  where id = $_GET[id]");
	header('location:data.php');

}elseif ($module=='pricelist' AND $act=='add'){
	$id = $_GET['id'];
	mysql_query("INSERT INTO pricelist(id,xfrom,xto,price) VALUES('$id','$_POST[from]','$_POST[to]','$_POST[price]')");
	header('location:pricelist.php?id='.$id);

}

?>
