473,394 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Validating a specific MAC address

Hello all!

I'm no programmer, but I have to try to complete some code for a
project that we are working on. There will be a web page that is set up
to register devices online. Part of the registration process will
require the user to select the type of device from a select box, and
then enter the MAC address for the device.

On the web page there will be two fields, a select box, and a text
field. The select box will have four choices:
<SELECT name="Device">
<option value="" selected>[choose yours]
<option value="GameCube">GameCube
<option value="PS2">PS2
<option value="XBox">XBox
The text field will have a default value of XX-XX-XX-XX-XX-XX. I
already have a way to validate that they only put in 0-9, A-F, or a-f.
For the sake of example, let's say that GameCubes have a factory set
MAC address that begins with 00-00-00-00, PS2s have a factory set MAC
address that begins with 00-00-00-01, and XBoxes have a factory set MAC
address that begins with 00-00-00-02.
I want to validate that when the user selects GameCube as their device,
that they also input a MAC address that begins with 00-00-00-00. Does
this make sense?
Please let me know if you need more details.

Thanks for any help that you can provide!

Lee

Jul 23 '05 #1
5 6744
On Wed, 09 Feb 2005 11:01:36 -0800, palsuddeath wrote:
I want to validate that when the user selects GameCube as their device,
that they also input a MAC address that begins with 00-00-00-00. Does
this make sense?


Assuming the network interface isn't manufactured by the company that
makes the device: The MAC address is for the network interface and the
prefix is assigned to the company that makes the network interface not the
company that makes the GameCube. If they start using a network interface
made by a different company your code won't work.

--
Life is short, but wide. -KV

Jul 23 '05 #2
So are you saying that my assumption that all GameCubes have the same
beginning MAC address is flawed? How could I verify this?

Thanks!

Lee

Jul 23 '05 #3
On Wed, 09 Feb 2005 11:36:33 -0800, palsuddeath wrote:
So are you saying that my assumption that all GameCubes have the same
beginning MAC address is flawed? How could I verify this?


I'm saying that, for what ever reason (price, availability, performance)
the NIC built into any given device isn't always necessarily going to be
manufactured by the manufacturer of the device.

Nintendo does have an OUI, but you'll have to check that all of the
manufacturers you're dealing with have one... and then assume they never
use anyone else's devices.

00-09-BF (hex) Nintendo Co.,Ltd.
0009BF (base 16) Nintendo Co.,Ltd.
11-1 HOKOTATE-CHO
KAMITOBA, MINAMI-KU
KYOTO 601-8501
JAPAN

You can check the MAC(OUI) address registry here:
http://standards.ieee.org/regauth/oui/index.shtml

--
Life is short, but wide. -KV

Jul 23 '05 #4
Okay, then just for fun, let's assume that the vendors I'm dealing with
have an OUI as listed above. How could I write the code to accomodate
this?

Jul 23 '05 #5
On Wed, 09 Feb 2005 13:09:39 -0800, palsuddeath wrote:
Okay, then just for fun, let's assume that the vendors I'm dealing with
have an OUI as listed above. How could I write the code to accomodate
this?


Well, you have the list of devices you are using and you have the list of
MAC addresses assigned to those companies, I'd have a SELECT box of the
devices automatically pop the manufacturers prefix and only let the user
enter the unique portion.

html>
<body>
<FORM NAME='test' ACTION='test.html' METHOD='POST'>
<SELECT name="Device" onchange='updateprefix(this.value);'>
<option value="" selected>[choose yours]</option>
<option value="00-00-00">GameCube</option>
<option value="00-00-01">PS2</option>
<option value="00-00-02">XBox</option>
</SELECT>
<input disabled name='prefix' id='prefix' type='text' value='NA'>
</form>
</body>
</html>

<script type='text/javascript'>
function updateprefix(newprefix) {
document.test.prefix.value = newprefix;
}
</script>
--
Life is short, but wide. -KV

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: The Plankmeister | last post by:
Hi... What's the best method of validating input characters? I would like to prevent users submitting exotic characters (such as those acquired on Windows Systems by pressing ALT+) and thought...
15
by: qazmlp | last post by:
What is the best & fastest way of validating an IPv4 address? Basically, the input can be either in IPAddressv4 or IPAddressv4:port format. Currently I have the following code to validate the...
1
by: Henrik Nyberg | last post by:
Here's a small method for validating email in C#. It may save you some time.. public static bool IsValidEmailAddress(string sEmail) { if (sEmail == null) { return false; } int nFirstAT =...
6
by: Alex Bink | last post by:
Hi, I have a validating event on a textbox in which I want to prevent the user to leave the textbox without entering the right data. Only if he clicks on another specific control he is allowed...
0
by: aj | last post by:
Jordan you can use regular expression (Namespace: System.Text.RegularExpressions) for validating the IP address in the textbox. Regular Expression to validate Web address:...
2
by: charleswesley | last post by:
I find myself regularly needing to validate user input as either a) numeric only or b) valid email address format (user@domain.tld) I am assuming that there are regular expressions that can be...
2
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
2
by: Peted | last post by:
Hi if i derive a reference to a control on a winform (ie Control activeControl = somecontrol on the form) how can i test if that control has a validating or validated event and more importantly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.