html - Get stuck on php if with captcha confirmation -
i have survey website have username , password , status. problem status use tell php can survey or not. have pass recaptcha test correct status (only people have status=1 can go). stuck tell error didn't complete recaptcha passed green ticks. have 5 columns on phpmyadmin id(a.i. primary key) , name , username , password , status.
here code
<?php require_once "condb.php"; // use connect phpmyadmin ?> <?php if (isset($_post['btn_enter'])) { $password = md5($_post['password']); $username = $_post['username']; $captcha=$_post['g-recaptcha-response']; $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=/*my_key*/&response=" .$captcha."&remoteip=".$_server['remote_addr']); $obj = json_decode($response); if($obj->success == true) { $sql="select * login username='$username' , password='$password' , status='1' limit 1"; $result=mysqli_query($cn,$sql) or die(mysqli_error($cn)); $num=mysqli_num_rows($result); # count row array if ($num > 0) { $row = mysqli_fetch_array($result); $_session['name']=$row['name']; header('location:index.php'); } elseif ($row['status']=2) { echo "you admin."; }elseif ($row['status']=3) { echo "over power!"; } }elseif($obj->success == false) { header('location:captcha.php'); } else { header('location:error.php'); } } ?>
here form code.
<form method="post"> <div align="center" class="row col-sm-12 col-md-12 col-lg-12 col-xs-12" style="margin:0 auto;"> <input type="numeric" class="form-control input-lg" placeholder="username" style="width:35%;height:50%" name="username" autofocus required><br> <input type="password" class="form-control input-lg" placeholder="password" style="width:35%;height:50%" name="password" autofocus required><br> </div> <br><br><br><br><br><br> <div class="g-recaptcha" data-sitekey="<!--my_key-->"></div> <br><br> <button type="submit" class="btn btn-success btn-lg" name="btn_enter" style="height:50%;width:20%;">ตกลง</button> <br><br> <p style="font-size:32px;color:#66ff33;">< <span><a href="https://www.facebook.com" class="btn btn-warning btn-lg glyphicon glyphicon-hand-right"> have problem? contact me</a></span></p> </form>
Comments
Post a Comment