Captiveportal register page on login
-
Hello.
I have the captive portal running with radius and everything works perfectly well. However, I can only log in with pre-existing users on my radius server. I would like to know if there is a way to create a user registration page on the captive portal. I'm using mysql, I have the correct radius table, I know which fields I need to use to authenticate. When I create a php file to register in a mysql database, the msqli error occurs. I would like to know if there is a way to create this registration portal or if you could give me ideas on how to do it another way, any help would be welcome. -
I'm using myself a PHP script that does something with the Freeradius database :
<?php try { $link = new PDO('mysql:host=192.168.1.33;port=3307;dbname=radius', 'radius', 'xxxxxxx'); // Check connection if($link === false) { die("ERROR: Could not connect."); } // Attempt delete query execution $sql = "DELETE FROM `radacct` WHERE `acctstoptime` IS NULL and `acctstarttime` < (NOW() - INTERVAL 610 MINUTE)"; $stmt = $link->prepare($sql); $stmt->execute(); unset($stmt); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } ?>
So check if the needed PHP library "ext-20-pdo" is installed ( in /usr/local/etc/php ).
I can't recall anymore if I installed that one, or if it is there by default.
Because you have Freeradius installed, the MySQL client is already there.There were, in the past, some exemples in this forum - just scroll down a lot ;) - and you'll find posts with example how to build PHP pages that collect user info and posts it into the needed "radius" database.
Be aware that you have to patch the freeradius PHP a little bit so it uses the database for the account info : right now, it uses a flat file, the one you find here : /usr/local/etc/raddb/mods-config/files/authorize
I've posted a while ago what needed to be changed so Freeradius uses the users created in the database, not the flat file.