Solved

HTML Code that will provide Authentication to i site

Posted on 2007-03-29
8
178 Views
Last Modified: 2010-04-16
I am trying to get some code that allows me to have a user Type in an Employer Number 54321009876512 and then the code would check to make sure the firts 7 Didget were 5432100 and that the number was 14 Charicters  long and the would forwared them to a web link

Example : Type in  543210098765412  Submit   www.google.com window would open.
0
Comment
Question by:LOGTECHSERV
  • 3
  • 2
8 Comments
 
LVL 4

Expert Comment

by:mukhtar2t
ID: 18817539
if substr($str,0,7) = '5432100' and length($str) == 14
0
 

Author Comment

by:LOGTECHSERV
ID: 18817568
I Have no clue what that means im sorrry i am the farthest ting from a programer  im just looking for somethiing to cut and paste in to a html page.

Thanks
0
 
LVL 4

Expert Comment

by:mukhtar2t
ID: 18817594
you can not do this by html
HTML just display the text
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 4

Expert Comment

by:mukhtar2t
ID: 18817603
However you can use PHP
if(substr($str,0,7) = '5432100' ) and (length($str) == 14)
{
do whatever you want
}
0
 
LVL 1

Accepted Solution

by:
veiko_1001 earned 500 total points
ID: 18817666
Insert this Javascript code between you <head> tags:

<script type="text/javascript">
      function verifyCode() {
            var codeToCheck = document.myForm.myTextField.value;
            if(codeToCheck.length != 14 || codeToCheck.substr(0,7) != "5432100")
                  alert("Incorrect code");
            else
                  window.location = "http://www.google.com";
      }
</script>

And then the following form in your page:

      <form name="myForm">
            <input type="text" name="myTextField" value="54321009876512" /><br />
            <input type="button" name="myButton" value="Submit" onclick="javascript: verifyCode();" />
      </form>
0
 
LVL 1

Expert Comment

by:veiko_1001
ID: 18817674
Sorry remove the value="54321009876512" part from the text field, I was just using that to try it out. So the form should actually look like this:

      <form name="myForm">
            <input type="text" name="myTextField" /><br />
            <input type="button" name="myButton" value="Submit" onclick="javascript: verifyCode();" />
      </form>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now