master mohon bantuannya dong. saya punya tabel id dan reg_member. keduanya nya punya field iibf_id. iibf_id di table id saya yang input, tapi iibf_id di table reg_member terisi saat user masuk di form index. nah jika ada user lain masuk dengan id yg sudah ada di reg_member maka go to index.php, jika iibf_id di reg_member msh kosong maka go to form.php
  1. <?php
  2. session_start();
  3. include('header.php');
  4.  
  5. $iibf_id = $_POST['iibf_id'];
  6.  
  7. //query untuk mendaptkan record dari id
  8.  
  9. $cekuser = mysql_query("SELECT * FROM id WHERE iibf_id = '$iibf_id'");
  10. $cekid = mysql_query("SELECT * FROM reg_member WHERE iibf_id = '$iibf_id'");
  11.  
  12. //$cekuser = mysql_query("SELECT * from id inner join reg_member on reg_member.iibf_id=id.iibf_id");
  13.  
  14.  
  15.  
  16. //cek kesesuaian id
  17.  
  18. if(mysql_num_rows ($cekuser) > 0 and ($cekid) != 0 ){
  19.  
  20. session_start();
  21. $_SESSION['id']=$_POST['iibf_id'];
  22. ?>
  23. <script language="JavaScript">
  24. alert('silakan aktivasi !');
  25. document.location='form.php';
  26. </script>
  27.  
  28. <?php
  29. }
  30.  
  31. elseif(mysql_num_rows ($cekuser) > 0 and ($cekid) < 0 ) {
  32.  
  33. ?>
  34. <script language="JavaScript">
  35. alert('sudah aktivasi !');
  36. document.location='index.php';
  37. </script>
  38.  
  39. <?php
  40. }
  41.  
  42. else {
  43. echo "<div align='center'>ID Anda Tidak Terdaftar!</div>";
  44. }
  45.  
  46.  
  47.  
  48. ?>
  49.  
  50.  
  51.  
  52.  
  53.  
  54. <script type="text/javascript">
  55.  
  56. String.prototype.trim = function() {a = this.replace(/^\s+/,'');return a.replace(/\s+$/, '');};
  57.  
  58. var emailvalreg_member = /^.+\@(\[?)[a-zA-Z0-9\-\_\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
  59.  
  60. function cekAngka(obj){
  61. var x = obj.value;
  62. var list = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
  63. var status = true;
  64. for (i=0; i<=x.length-1; i++){
  65. // jika karakter ke-i termasuk dalam array, maka nilainya TRUE jika treg_memberak, nilai FALSE
  66. if (x[i] in list) cek = true; else cek = false;
  67. status = status && cek;
  68. }
  69. return !status;
  70. }
  71.  
  72. function cekJumlah(obj){
  73. var x = obj.value;
  74. var list = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
  75. var status = true;
  76. for (i=0; i<=x.length-1; i++){
  77. // jika karakter ke-i termasuk dalam array, maka nilainya TRUE jika treg_memberak, nilai FALSE
  78. if (x > 0) cek = true; else cek = false;
  79. status = status && cek;
  80. }
  81. return !status;
  82. }
  83.  
  84. function cekJumlah2(obj){
  85. var x = obj.value;
  86. var list = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
  87. var status = true;
  88. for (i=0; i<=x.length-1; i++){
  89. // jika karakter ke-i termasuk dalam array, maka nilainya TRUE jika treg_memberak, nilai FALSE
  90. if (x[i] in list) cek = true; else cek = false;
  91. status = status && cek;
  92. }
  93. return !status;
  94. }
  95.  
  96. function valreg_memberasi (){
  97. var vfn = document.frm_reg.fn;
  98. var viibf_reg_member = document.frm_reg.iibf_reg_member;
  99. var fnama = document.frm_reg.nama;
  100.  
  101. // var viibf_reg_member = document.frm_reg.iibf_reg_member;
  102. // var vno_reg_memberentitas = document.frm_reg.no_reg_memberentitas;
  103.  
  104. //pengecekan
  105. if(vfn.value.trim().length == 0){
  106. alert("Nama harus diisi ");
  107. vfn.focus();
  108. return false;
  109. }
  110. else if(viibf_reg_member.value.trim().length == 0){
  111. alert("iibf_reg_member harus diisi ");
  112. viibfreg_member.focus();
  113. return false;
  114.  
  115.  
  116. }
  117.  
  118.  
  119. // else if(viibfreg_member.value.trim().length == 0){
  120. // alert("IIBF reg_member harus diisi ");
  121. // viibfreg_member.focus();
  122. // return false;
  123. // }
  124. // else if(cekAngka(viibf_reg_member)){
  125. // alert("IIBF reg_member harus diisi dengan Angka");
  126. // viibf_id.focus();
  127. // return false;
  128. // }
  129. // else if(vno_identitas.value.trim().length == 0){
  130. // alert("No. Identitas harus diisi ");
  131. // vno_identitas.focus();
  132. // return false;
  133. // }
  134. // else if(cekAngka(vno_identitas)){
  135. // alert("No. Identitas harus diisi dengan Angka");
  136. // vno_identitas.focus();
  137. // return false;
  138. // }
  139. // else if(vjumlah.value.trim().length == 0){
  140. // alert("Jumlah orang harus diisi ");
  141. // vfn.focus();
  142. // return false;
  143. // }
  144. // else if(cekJumlah2(vjumlah)){
  145. // alert("Jumlah orang harus diisi dengan Angka");
  146. // vjumlah.focus();
  147. // return false;
  148. // }
  149. // else if(cekJumlah(vjumlah)){
  150. // alert("Jumlah orang tidak boleh 0");
  151. // vjumlah.focus();
  152. // return false;
  153. // }
  154. else{
  155. return true;
  156. }
  157. }
  158. </script>
  159.  
  160.  
  161. <body>
  162. <div class="navbar navbar-fixed-top navbar-inverse">
  163. </div>
  164. </div>
  165. <br/>
  166.  
  167. <div class="container" style="margin-top: 5px;">
  168.  
  169. <div class="navbar">
  170. <div class="navbar-inner">
  171. <span class="brand"><strong><i class="icon-group icon-large"></i>&nbsp;&nbsp;FORM PENGECEKAN ID IIBF</strong></span>
  172. </div>
  173.  
  174. </div>
  175.  
  176. <div class="thumbnail">
  177. <div class="row">
  178.  
  179. <div class="span8">
  180. <br/>
  181.  
  182. <div class="alert alert-info"><strong><i class="icon-file"></i>&nbsp;Silahkan Input ID IIBF Anda</strong></div>
  183. <br/>
  184. <form class="form-vertical" name="frm_reg" method="POST" onSubmit="return validasi() ;" enctype="multipart/form-data">
  185.  
  186. <div class="control-group">
  187.  
  188. <div style="margin-bottom:12px;"></div>
  189. </div>
  190.  
  191.  
  192.  
  193.  
  194.  
  195. <form action="login.php" method="post">
  196.  
  197.  
  198. <div class="control-group">
  199. <label class="control-label" for="inputEmail">ID IIBF</label>
  200. <div class="controls">
  201. <input type="text" class="span9" name="iibf_id" id="inputEmail" placeholder="iibf_id" >
  202.  
  203. </div>
  204. </div>
  205.  
  206.  
  207.  
  208. <button type="submit" name="submit" class="btn btn-success" style="margin-center:40px;"><i class="icon-save icon-large"></i>&nbsp;Submit</button>
  209.  
  210. </form>
  211.  
  212.  
  213.  
  214.  
14810
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification
User Paling Aktif Bulan Lalu

Asrianor

Point Bulan Lalu: 6