Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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>
- <?
- include "../koneksi.php";
- $C_TIM=$_POST["C_TIM"];
- $HARI=$_POST["HARI"];
- $TGL=$_POST["TGL"];
- $KET=$_POST["KET"];
- $KTP=$_POST["KTP"];
- $NM=$_POST["NM"];
- $TMPT_LHIR=$_POST["TMPT_LHIR"];
- $TGL_LHIR=$_POST["TGL_LHIR"];
- $PKERJAAN=$_POST["PKERJAAN"];
- $ALAMAT=$_POST["ALAMAT"];
- $NO_HP=$_POST["NO_HP"];
- $TLP=$_POST["TLP"];
- $ID_PEL=$_POST["ID_PEL"];
- $NO_METER=$_POST["NO_METER"];
- $TRIF_LM=$_POST["TRIF_LM"];
- $DY_LM=$_POST["DY_LM"];
- $TRIF_BR=$_POST["TRIF_BR"];
- $DY_BR=$_POST["DY_BR"];
- $TGNGN_NORMAL=$_POST["TGNGN_NORMAL"];
- $GARDU=$_POST["GARDU"];
- $TIANG=$_POST["TIANG"];
- $NO_TOKEN=$_POST["NO_TOKEN"];
- $NO_KSR=$_POST["NO_KSR"];
- $NO_MAT=$_POST["NO_MAT"];
- //random
- $randmin = "1111111111";
- $randmin1 = "1234567891";
- $randmax = "9999999999";
- $rand1 = rand($randmin,$randmax);
- $rand2 = rand($randmin1,$randmax);
- $rand3 = rand($randmin,$randmin1);
- $rand4 = rand($randmax,$randmin1);
- $rand5 = rand($randmax,$randmin);
- $KCT = $rand1.$rand2;
- $KCT2 = $rand1.$rand3;
- $CC = $rand1.$rand4;
- $FIT = $rand2.$rand3;
- $PW = $rand2.$rand4;
- $CT = $rand3.$rand4;
- $CT2 = $rand4.$rand5;
- //query simpan yg panjang
- $aplg="INSERT INTO tm_plg VALUES
- ('$KTP','$NO_MAT','$C_TIM','$ID_PEL','$NO_METER','$NO_KSR','$NM','$TMPT_LHIR',
- '$TGL_LHIR','$PKERJAAN','$ALAMAT','$NO_HP','$TLP','$KET',1,1)";
- $bplg="INSERT INTO td_plg VALUES
- ('$ID_PEL','$NO_METER','$NO_TOKEN','$KTP','$HARI','$TGL','$TRIF_LM','$DY_LM',
- '$TRIF_BR','$DY_BR','$TGNGN_NORMAL','$GARDU','$TIANG')";
- $tkn="INSERT INTO t_token VALUES
- ('$NO_TOKEN','$C_TIM','$ID_PEL','$NO_METER','$KCT','$KCT2','$CT','$CT2','$CC','$FIT','$PW')";
- $ksr="INSERT INTO t_kasir VALUES
- ('$NO_KSR','$C_TIM','$KTP',0)";
- $mtr="INSERT INTO t_material VALUES (
- '$NO_MAT','$C_TIM','$KTP',0,0,0,0,0)";
- $sql="select id from table1 where nama='namanya'";
- if(!adaIsinya($sql)){
- $stat++;
- }
- $sql="select id from table2 where nama='namanya'";
- if(!adaIsinya($sql)){
- $stat++;
- }
- if($stat==2){
- $hsla=@mysql_query($aplg,$idkoneksi);
- $hslb=@mysql_query($bplg,$idkoneksi);
- $tkn=@mysql_query($tkn,$idkoneksi);
- $ksr=@mysql_query($ksr,$idkoneksi);
- $mtr=@mysql_query($mtr,$idkoneksi);
- echo "data tersimpan";
- }else{
- echo "Silahkan di cek kembali";
- }
- @mysql_close($idkoneksi);
- function adaIsinya($sql)
- {
- //lakukan query
- //cari jumlahnya
- if($tot==0){
- return FALSE;
- }else{
- return $tot;
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement