PDA

View Full Version : اجازه ندادن به ثبت نام مجدد از طریق یک کامپیوتر



soroush.elec
شنبه 07 اردیبهشت 1392, 19:20 عصر
سلام دوستان
من در سایتم می خواهم ایجاد سیستم کسب درآمد از طریق معرفی عضو جدید ایجاد کنم. به طوریکه به هر کدام از اعضای سایت یک referral ID بدهم . و به ازای هر کسی که از طریق آن آی دی عضو سایت شد یک مبلغی به معرف بدهم. ولی خوب این امکان دارد که خود شخص با آدرس های ایمیل دیگر در سایت ثبت نام کند و پول بگیرد. برای محدود کردن این عمل می خواهم مک آدرس کامپیوتری که با آن ثبت نام صورت می گیرد را چک کنم تا تکراری نباشد. آیا چنین چیزی در وب امکان پذیر است؟ لطفاً راهنمایی بفرمایید.

hesamsalehnamadi
شنبه 07 اردیبهشت 1392, 19:43 عصر
روش اول


public string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty)// only return MAC Address from first card
{
IPInterfaceProperties properties = adapter.GetIPProperties();
sMacAddress = adapter.GetPhysicalAddress().ToString();
}
} return sMacAddress;
}


روش دوم



public string GetMACAddress()
{
ManagementObjectSearcher objMOS = new ManagementObjectSearcher("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMOS.Get();
string MACAddress = String.Empty;
foreach (ManagementObject objMO in objMOC)
{
if (MACAddress == String.Empty) // only return MAC Address from first card
{
MACAddress = objMO["MacAddress"].ToString();
}
objMO.Dispose();
}
MACAddress = MACAddress.Replace(":", "");
return MACAddress;
}


روش سوم با استفاده از جاوا اسکریپت



<script language="javascript" type="text/javascript">
function showMacAddress() {
var obj = new ActiveXObject("WbemScripting.SWbemLocator");
var s = obj.ConnectServer(".");
var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
var e = new Enumerator(properties);
var output;
output = '<table border="0" cellPadding="5px" cellSpacing="1px" bgColor="#CCCCCC">';
output = output + '<tr bgColor="#EAEAEA"><td>Caption</td><td>MACAddress</td></tr>';
while (!e.atEnd()) {
e.moveNext();
var p = e.item();
if (!p) continue;
output = output + '<tr bgColor="#FFFFFF">';
output = output + '<td>' + p.Caption; +'</td>';
output = output + '<td>' + p.MACAddress + '</td>';
output = output + '</tr>';
}
output = output + '</table>';
document.getElementById("box").innerHTML = output;
}
</script>


منبع : http://www.c-sharpcorner.com/uploadfile/ahsanm.m/how-to-get-the-mac-address-of-system-using-Asp-NetC-Sharp/