postgresql - PHP: The page isn’t redirecting properly, Too many redirects -
i tried implementing system wherein user enters username , phone number, when form submitted, checks database verify number , username based on it's existence. sms sent number. gets popup enter otp code.
however on entering otp code error of redirecting loops. i'll explain flow of files below:
index.php -> login.php -> otp.php -> check_otp.php -> home.php
those files being used. reaches otp page , when enter, authenticate goes loop. post code see wrong otp authentication code.
session_start(); // starting session $error=''; // variable store error message if (isset($_post['verify'])) { if (empty($_post['otp'])) { $error = "otp invalid"; } else { // post otp $otp=$_post['otp']; } $otp = stripslashes($otp); $otp = pg_escape_string($otp); $check = "select * otp otp = '$otp'"; $ret_check = $dbconnection->executequery($check); $ret_num = $dbconnection->numrows($ret_check); $cust_code = ''; while($row = $dbconnection->fetchrow($ret_check)){ $cust_code = $row[0]; } $cust_code; if($ret_num != 1){ $error = "wrong otp entered"; header("location: otp-home.php"); } else { echo $_session['login_user'] = $cust_code; header("location: home.php"); }
i hope enough. if else required. please let me know. appreciated. thank you
Comments
Post a Comment