From: paulr Date: Mon, 6 Dec 2010 06:12:52 +0000 (+1100) Subject: renamed files X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=e2e22b45b14cae630587bc662a8bfcda98b04510;p=ga4php.git renamed files --- diff --git a/authserver/authd/authd.php b/authserver/authd/authd.php index 3a52041..3f723e5 100644 --- a/authserver/authd/authd.php +++ b/authserver/authd/authd.php @@ -50,27 +50,28 @@ if($pid == -1) { break; case MSG_GET_OTK_PNG: - if(!isset($msg["username"])) { + if(!isset($msg["otk"])) { msg_send($cl_queue, MSG_GET_OTK_PNG, false); } else { - $username = $msg["username"]; - $sql = "select users_otk from users where users_username='$username'"; + $otk = $msg["otk"]; + $sql = "select users_username from users where users_otk='$otk'"; $dbo = getDatabase(); $res = $dbo->query($sql); - $otk = ""; + $username = ""; foreach($res as $row) { - $otk = $row["users_otk"]; + $username = $row["users_username"]; } - if($otk == "") { + if($username == "") { msg_send($cl_queue, MSG_GET_OTK_PNG, false); } else { $hand = fopen("otks/$otk.png", "rb"); $data = fread($hand, filesize("otks/$otk.png")); fclose($hand); - unlink("otks/$otk.png"); - $sql = "update users set users_otk='' where users_username='$username'"; - $dbo->query($sql); + //unlink("otks/$otk.png"); + //$sql = "update users set users_otk='' where users_username='$username'"; + //$dbo->query($sql); + error_log("senting otk, fsize: ".filesize("otks/$otk.png")." $otk "); msg_send($cl_queue, MSG_GET_OTK_PNG, $data); } } diff --git a/authserver/lib/authClient.php b/authserver/lib/authClient.php index 58de4ec..e1b941f 100644 --- a/authserver/lib/authClient.php +++ b/authserver/lib/authClient.php @@ -55,7 +55,7 @@ class GAAuthClient { return $msg; } - function getOtkPng($username) { + function getOtkPng($otk) { global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; @@ -71,7 +71,8 @@ class GAAuthClient { $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT); $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER); - $message["username"] = $username; + $message["otk"] = $otk; + error_log("sending message, $otk"); msg_send($sr_queue, MSG_GET_OTK_PNG, $message, true, true, $msg_err); msg_receive($cl_queue, 0, $msg_type, 16384, $msg); diff --git a/authserver/www/admin.php b/authserver/www/admin.php index fa6f6df..b47978f 100644 --- a/authserver/www/admin.php +++ b/authserver/www/admin.php @@ -29,13 +29,13 @@ foreach($users as $user) { if($user["realname"] == "") $realname = ""; else $realname = $user["realname"]; - if($user["haspass"]) $haspass = "Yes Delete Password"; + if($user["haspass"]) $haspass = "Yes Delete Password"; else $haspass = "No "; if($user["hastoken"]) $hastoken = "Yes"; else $hastoken = "No"; - if($user["otk"]!="") $otk = "Get"; + if($user["otk"]!="") $otk = "Get"; else $otk = "Already Claimed"; $delete = "Delete"; @@ -45,7 +45,7 @@ foreach($users as $user) { } ?>
-
Create User:
+
Create User(s) - Enter a comma seperated list of names:

Radius Clients

Not yet implemented diff --git a/authserver/www/actions.php b/authserver/www/admin_actions.php similarity index 81% rename from authserver/www/actions.php rename to authserver/www/admin_actions.php index 2d2ca9c..d6a224c 100644 --- a/authserver/www/actions.php +++ b/authserver/www/admin_actions.php @@ -17,9 +17,9 @@ if(isset($_REQUEST["action"])) { if($myAC->authUserPass($username, $password)) { $_SESSION["loggedin"] = true; $_SESSION["username"] = $username; - header("Location: index.php"); + header("Location: admin.php"); } else { - header("Location: index.php?message=loginfail"); + header("Location: admin.php?message=loginfail"); } exit(0); @@ -27,13 +27,13 @@ if(isset($_REQUEST["action"])) { case "logout": $_SESSION["loggedin"] = false; $_SESSION["username"] = ""; - header("Location: index.php"); + header("Location: admin.php"); exit(0); break; case "createuser": $username = $_REQUEST["username"]; $myAC->addUser($username); - header("Location: index.php"); + header("Location: admin.php"); exit(0); break; case "update": @@ -56,11 +56,13 @@ if(isset($_REQUEST["action"])) { $username = $_REQUEST["username"]; $myAC->setUserPass($username, ""); break; - case "getotk": - $username = $_REQUEST["username"]; - $otk = $myAC->getOtkPng($username); + case "getotkimg": + + $otk = $_REQUEST["otk"]; + error_log("requesting otk, $otk"); + $otk_img = $myAC->getOtkPng($otk); header("Content-type: image/png"); - echo $otk; + echo $otk_img; exit(0); break; }