How config to lightsquid from freeradius show user.
1. config lightsquid.cfg file. (nano or vi editor)sudo nano /var/www/lightsquid/lightsquid.cfg
- remove # and change number 0 to 1 line 112
$userealname = 1;
- save file and close.
- run /var/www/lightsquid/lightparser.pl
- open web browser and run url http://ipserver/lightsquid you see attribute was add realname.
2. Make file realname.pl by command.
- sudo nano /var/www/lightsquid/realname.pl
- See blank page and add command is follow.
#!/usr/bin/perl
use DBI;
use Socket;
#use file;
($sec_now, $min_now, $hour_now, $date_now, $mon_now, $year_now, $dayno_now) = localtime();
$mon_now++;
$year_now += 1900;
$todayni= sprintf("%04d-%02d-%02d",$year_now, $mon_now, $date_now);
$dsn = "DBI:mysql:database=radius;host=localhost";
$dbh = DBI->connect($dsn,"user","password"); #user is user for mysql, password is password for mysql
$sth = $dbh->prepare("select * from radacct,radcheck where radacct.AcctStartTime >= '".$todayni." 00:00:00' and radacct.AcctStartTime <= '".$todayni." 23:59:59' and radacct.UserName = r$ $sth->execute();
#print "Content-type:text/html\n\n";
open(FILE, ">/var/www/lightsquid/realname.cfg");
while (my $ref = $sth->fetchrow_hashref()) {
#print FILE "$ref->{'FramedIPAddress'} $ref->{'firstname'} $ref->{'lastname'}\n";
print FILE "$ref->{'framedipaddress'} $ref->{'username'} $ref->{'name'}\n";
}
close(FILE);
$sth->finish();
$dbh->disconnect();
- Save and close.
3. change permission and run file.
- sudo chmod +x /var/www/lightsquid/realname.pl
- sudo perl /var/www/lightsquid/realname.pl
- sudo perl /var/www/lightsquid/lihgtparser.pl
open web browser and run url http://ipserver/lightsquid
4. Set time run to crontab.



# perl realname.pl
ตอบลบString found where operator expected at realname.pl line 16, near "print FILE ""
(Missing semicolon on previous line?)
Scalar found where operator expected at realname.pl line 16, near "} $ref"
(Missing operator before $ref?)
Scalar found where operator expected at realname.pl line 16, near "} $ref"
(Missing operator before $ref?)
Backslash found where operator expected at realname.pl line 16, near "}\"
(Missing operator before \?)
String found where operator expected at realname.pl line 16, at end of line
(Missing semicolon on previous line?)
Unknown regexp modifier "/w" at realname.pl line 16, at end of line
Unknown regexp modifier "/w" at realname.pl line 16, at end of line
Unknown regexp modifier "/w" at realname.pl line 16, at end of line
syntax error at realname.pl line 16, near "print FILE ""
Can't find string terminator '"' anywhere before EOF at realname.pl line 16.
root@squid4-16-04:/usr/share/lightsquid#