gotmedia Posted May 4, 2012 Share Posted May 4, 2012 Hi! I'm attempting to do this and feel that I'm fairly close. Would you take a look and throw me any bones? PHP Code: <?php if (isset($_POST['ppassword']) && (stristr($string,'') === TRUE)) { switch($_POST['ppassword']) { case "Google": header("Location: http://www.google.com"); exit(); case "Yahoo": header("Location: http://www.yahoo.com"); exit(); case "Bing": header("Location: http://www.bing.com"); exit(); } } ?> The Form: <form name="portal" id="portal" method="post" action=""> <input name="ppassword" type="text" id="ppassword" maxlength="25" onfocus="this.select()" onblur="this.value=!this.value?'company name':this.value;" value="company name" onclick="this.value=''" /> <input name="login" type="submit" id="login" value="Continue" /> </form> I appreciate any of your help. I feel close and this part (stristr($string,'') feels like the missing piece of the puzzle. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 4, 2012 Share Posted May 4, 2012 What is $string? You'll only find '' in $string if $string == ''; stristr will also NEVER return true. What are you trying to do? Quote Link to comment Share on other sites More sharing options...
gotmedia Posted May 4, 2012 Author Share Posted May 4, 2012 I got $string from another website lol, trying to piece things together. I'm trying to say: "If you type in a password that includes these words 'Google' for example, then you will be redirected to this page -> http://www.google.com" The above will work if you type in "Google, Inc.", "Google Corp", etc. as long as the word "google" (case insensitive) is inputted. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 4, 2012 Share Posted May 4, 2012 If you just randomly put code in and don't know why or what it does, you won't get very far. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted May 4, 2012 Share Posted May 4, 2012 So... if you use "google" as your password, and you log into your site... you get redirected to google.com? Have i got that right? 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.