Jump to content

Directing User Based on Password Entered (using stristr)


gotmedia

Recommended Posts

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. 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.