Change Full Host Registration / QuickImage
-
I like this very much. Especially requiring credentials to image during registration and the “machine already registered as: hostname”
-
[B]“Machine already registered” change:[/B]
change [I]man.hostexists.php[/I] under [I]/var/www/service[/I] and change it to this (it’s around line 57):
[CODE]
$sql = “select hostName, count(*) as cnt from hosts where hostMAC = '” . $mac . “'”;
$res = mysql_query( $sql, $conn ) or die( mysql_error() );
while( $ar = mysql_fetch_array( $res ) )
{
if ( $ar[“cnt”] == 0 )
{
echo “#!ok”;
}
else
echo “”._(“This Machine is already registed as”).": " . $ar[“hostName”] . “”;
}[/CODE] -
Works great man thanks
-
Cool. Blackout integrated this into the codebase moving forward. I have always thoroughly enjoyed the guessing game and lookup when a host exists but I don’t know which one it is. /sarcasm off
-
Yep, love it. Shared with the rest of the FOG evangelists I know.
-
is there anyway to add a similar idea to the ‘Quick Host Reg and inventory’ for when the machine is already registered to show what machine it is? at the moment it just shows host exists
-
yes quite easy actually, without looking at the code, you should be able to use the same principle above but for auto.register.php
-
thanks will take a look when back at work
-
Lee (or anyone) are you able to help, I cant seem to find where to edit this?
-
change auto.register.php line 77 (dependant on version you’ve got but it’s around there)
from:
[B]$sql = “select count() as cnt from hosts where hostMAC = ‘" . $mac . "’";[/B]
to:
[B]$sql = "select hostName, count() as cnt from hosts where hostMAC = '” . $mac . “'”;[/B]
and then change output on line 264 (again might be diff line - version)
from:
[B]echo (“Exists”);[/B]
to:
[B]echo “”.(“This Machine is already registed as”).": " . $ar[“hostName”] . “”;[/B]i haven’t tested this but can’t see why it wouldn’t work
-
Thank you!! This works perfectly using FOG 0.32. This is so handy.
I would love to see this put into 0.33 code, I know the above patch has been (not sure if this part has).
Thanks again to everyone in thread
[quote=“Lee Rowlett, post: 9534, member: 28”]change auto.register.php line 77 (dependant on version you’ve got but it’s around there)
from:
[B]$sql = “select count() as cnt from hosts where hostMAC = ‘" . $mac . "’";[/B]
to:
[B]$sql = "select hostName, count() as cnt from hosts where hostMAC = '” . $mac . “'”;[/B]
and then change output on line 264 (again might be diff line - version)
from:
[B]echo (“Exists”);[/B]
to:
[B]echo “”.(“This Machine is already registed as”).": " . $ar[“hostName”] . “”;[/B]i haven’t tested this but can’t see why it wouldn’t work :)[/quote]
-
Added this to quick inventory screen as it was very simple. Thanks Lee!