cat /temp/checkmac.php
<?php
// PHP page to check if MAC is not aleady there for the user, then INSERT it for MAC VALIDATION,
// it will add mac for 1st time login user only
// 31-OCT-2017
$link = mysql_connect('localhost', 'root', 'roott123');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// Default DB is radius
mysql_select_db('radius');
// Look for MAC entry for this user
$result=mysql_query("select * FROM radcheck WHERE `UserName`='$argv[1]' AND attribute='Calling-Station-Id' order by Username limit 1");
$val = mysql_num_rows($result);
if ($val > 0) {
printf ("MAC Entry already found by Suntech");
}
else {
printf ("Seems to be New User, adding its MAC address in table ...");
mysql_query("INSERT into radcheck (UserName, Attribute, op, Value) values ('$argv[1]', 'Calling-Station-Id', ':=', '$argv[2]')");
}
?>
cat /temp/checkmac.php7
<?php
// PHP page to check if MAC is not aleady there for the user, then INSERT it for MAC VALIDATION,
// it will add mac for 1st time login user only
// 31-OCT-2017
$link = mysqli_connect('localhost', 'root', 'roott123', 'radius');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// Default DB is radius
// mysqli_select_db('radius');
// Look for MAC entry for this user
$result=mysqli_query($link, "select * FROM radcheck WHERE `UserName`='$argv[1]' AND attribute='Calling-Station-Id' order by Username limit 1");
$val = mysqli_num_rows($result);
if ($val > 0) {
printf ("MAC Entry already found by ZAiBBBBBBBBBBBBBBBB");
}
else {
printf ("Seems to be New User, adding its MAC address in table ...");
mysqli_query($link, "INSERT into radcheck (UserName, Attribute, op, Value) values ('$argv[1]', 'Calling-Station-Id', ':=', '$argv[2]')");
}
?>
checkmac.php
Ah!! You are here, which means that you do want to know about me.
The name's Rubel & I live in BANGLADESH. Well, there isn't a biography of mine available, I'm not a celebrity.
However, I'm a GEEK, I live, breathe, sleep & talk INTERNET. This is my place on INTERNET & I'm happy with it. I love surfing INTERNET & getting to know good websites & believe me, though I've seen a lot of them, I'm still thirsty, b'coz, yeh dil mange more.
I am also complete the CCNA, CCNP, MCSA, MCDBA & MCSE certification. Now i am studying to sit the exam CCIE & RHCE.
0 $type={blogger}:
Post a Comment