thaidomizil Posted June 14, 2011 Share Posted June 14, 2011 Hi there, i'm trying to find out how i could password protect a page based on a value that has been written into my mysql db before, basically i'm having a booking system, after updating a customers booking he does get a link by e-mail with the page that shows his booking details and his id like customerpage.php?id=1, now if he opens that page, i want to prompt for the value lname1 of row id 1which would be the customers last name, before he can access the page ! Thanks Quote Link to comment Share on other sites More sharing options...
thaidomizil Posted June 14, 2011 Author Share Posted June 14, 2011 Ok i just solved it myself .. If someone needs something similar, this will do. <?php $result_id = $_REQUEST['id']; if($_POST['Check']) { $lname1 = $_POST['lname1']; $result = mysql_query("select * from booking where id='$result_id' and lname1='$lname1'"); $row = mysql_fetch_assoc($result); if(mysql_num_rows($result)!='0') { header("Location: customerpage.php?id=$result_id"); } else { echo "<script>alert('Invalid Last Name');</script>"; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.