Solved

HTML Code that will provide Authentication to i site

Posted on 2007-03-29
8
179 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

740 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