Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTML Code that will provide Authentication to i site

Posted on 2007-03-29
8
Medium Priority
?
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

 
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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

661 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