3 if(file_exists("config.php")) {
4 require_once("config.php");
6 // config file doesnt exist, we must abort sensibly
9 // get out master library for ga4php
10 require_once("../lib/lib.php");
14 // first we want to fork into the background like all good daemons should
15 //$pid = pcntl_fork();
21 // i am the parent, i shall leave
22 echo "i am a parent, i leave\n";
27 /// ok, this is just testing stuff... create queue
28 global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT;
32 $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT, 0666 | 'IPC_CREAT');
33 $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER, 0666 | 'IPC_CREAT');
42 msg_receive($sr_queue, 0, $msg_type, 16384, $msg);
46 // minimal checking, we leav it up to authenticateUser to do the real
48 if(!isset($msg["user"])) $msg["user"] = "";
49 if(!isset($msg["passcode"])) $msg["passcode"] = "";
50 $username = $msg["user"];
51 $passcode = $msg["passcode"];
53 msg_send($cl_queue, MSG_AUTH_USER, $myga->authenticateUser($username, $passcode));
56 if(!isset($msg["username"])) {
57 msg_send($cl_queue, MSG_ADD_USER, false);
59 $username = $msg["username"];
61 msg_send($cl_queue, MSG_ADD_USER, $myga->setUser($username));