Solved

HTML Code that will provide Authentication to i site

Posted on 2007-03-29
8
177 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

19 Experts available now in Live!

Get 1:1 Help Now