I'm creating a login script for WHM that would allow techs to login without having to enter a root password everytime they access it. I am having a bit of trouble on how I should perform the authentication. I am using the curl method in another script for executing queries against the cPanel API (using the access hash) but that just doesnt seem right for this since its the users computer I want to authenticate, not the script itself.
Is there a better method for doing this that I am overlooking?
Heres the code I have so far:
Code:<?php include('config.php'); if (!isset($_REQUEST['server'])) { print "You didn't specify a server."; exit(1); } else { $server = $_REQUEST['server']; } $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysql_select_db("$dbName", $db) or die ("Couldn't select the database."); $sql = "SELECT * FROM servers WHERE srv_name = '$server'"; $data = mysql_query($sql); if (!mysql_num_rows($data)) { print "Invalid server name."; exit(1); } else { $r = mysql_fetch_array($data); $serverip = $r['srv_ip']; $serverhash = $r['srv_hash']; // Do Auth stuff here $head = "Location: https://$serverip:2087"; header($head); } ?>



LinkBack URL
About LinkBacks
Reply With Quote




