Hello All.<br />While I have gleaned many bits of helpful information from these pages in the past I dont think I have ever asked a question. Could it be said that "There are no new questions, only new askers"?<br /><br />Anyway; I am building a directory website for my very large extended family (over 200 living people descended from my now dead grandparents).<br /><br />I want to password protect the site but instead of requiring membership password login system I just want to ask a "proprietary" question at the initial page...something like "What is Aunt Janes middle name" or Where did Uncle Paul go to college". I want to be able to change the question and answer every once in while or even have a database of rotating questions and answers that will be randomly rotated on some timetable.<br /><br />I see this as a cool way to get the younger people to query the older in order to be able to gain access to the "common" areas of the site. <br /><br />Does anyone know how I an achieve this end? Anything I can buy? Any person or service that I can hire to make something custom?<br /><br />Any input will be appreciated.<br /><br />I have a TCH reseller account and the site will be located at <!-- w --><a class="postlink" href="http://www.alltheporters.com">www.alltheporters.com</a><!-- w --><br /><br />Thanks for reading.<br />Mike Porter<!--content-->
Hi Mike.<br />Here's a little PHP script that should do the trick. It will print a random question from the array at the top, and check for the appropriate answer. Very simple; no style. You'd have to make it fit into your site's look and feel.<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><?php<br />extract($_POST);<br />$queries = <b>array(array("First Question","First Answer"),array("Second Question","Second Answer"));</b><br />if(isset($ansr)) {<br /> if($ansr == $queries[$q][1]) {header('location:<b>**success page**</b>'); exit;}<br /> else {header('location:<b>**failure page**</b>'); exit;}<br />}<br />$q = rand(0,count($queries)-1);<br />?><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><br /><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br /><head><br /><title>What's the Answer?</title><br /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><br /></head><br /><br /><body><br /><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><br /><?php echo $queries[$q][0]; ?> <input type="text" name="ansr" value="" /><br /><input type="hidden" name="q" value="<?php echo $q; ?>" /><br /></form><br /></body><br /></html><!--QuoteEnd--></div><!--QuoteEEnd--><br />All you should have to do is populate the array at the top with your real questions and answers, and replace the <b>**success page**</b> and <b>**failure page**</b> with the pages you want to redirect them to, and it should work.<br /><br />Hope that helps. Even if you don't know PHP you can use it. Just copy it into a file, make the necessary replacements, and call it <b>something.php</b>. Then have your links to the 'protected' areas go there.<br /><br />If any of it isn't clear, just keep asking. We love to help around here as you know.<!--content-->
Wow...I cant thank you enough.!<br /><br />I will file this away and plug it in when the time comes. I will probably have some questions then.<br /><br />Thanks again.<br /><br />Mike<!--content-->
You're welcome, Mike. Good luck.<!--content-->
Hi Mike.<br />Here's a little PHP script that should do the trick. It will print a random question from the array at the top, and check for the appropriate answer. Very simple; no style. You'd have to make it fit into your site's look and feel.<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><?php<br />extract($_POST);<br />$queries = <b>array(array("First Question","First Answer"),array("Second Question","Second Answer"));</b><br />if(isset($ansr)) {<br /> if($ansr == $queries[$q][1]) {header('location:<b>**success page**</b>'); exit;}<br /> else {header('location:<b>**failure page**</b>'); exit;}<br />}<br />$q = rand(0,count($queries)-1);<br />?><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><br /><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br /><head><br /><title>What's the Answer?</title><br /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><br /></head><br /><br /><body><br /><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><br /><?php echo $queries[$q][0]; ?> <input type="text" name="ansr" value="" /><br /><input type="hidden" name="q" value="<?php echo $q; ?>" /><br /></form><br /></body><br /></html><!--QuoteEnd--></div><!--QuoteEEnd--><br />All you should have to do is populate the array at the top with your real questions and answers, and replace the <b>**success page**</b> and <b>**failure page**</b> with the pages you want to redirect them to, and it should work.<br /><br />Hope that helps. Even if you don't know PHP you can use it. Just copy it into a file, make the necessary replacements, and call it <b>something.php</b>. Then have your links to the 'protected' areas go there.<br /><br />If any of it isn't clear, just keep asking. We love to help around here as you know.<!--content-->
Wow...I cant thank you enough.!<br /><br />I will file this away and plug it in when the time comes. I will probably have some questions then.<br /><br />Thanks again.<br /><br />Mike<!--content-->
You're welcome, Mike. Good luck.<!--content-->