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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.