From: Art Cancro Date: Fri, 31 Oct 2003 04:54:20 +0000 (+0000) Subject: * login changes X-Git-Tag: v7.86~5734 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=2642bdc0ac104857a0026d0c9b0b8f271ad4d9a2 * login changes --- diff --git a/ctdlphp/ctdlheader.php b/ctdlphp/ctdlheader.php index 57e78cbad..0f56075ac 100644 --- a/ctdlphp/ctdlheader.php +++ b/ctdlphp/ctdlheader.php @@ -9,7 +9,8 @@ function bbs_page_header() { establish_citadel_session(); - echo << @@ -27,18 +28,13 @@ function bbs_page_header() { link="#0000FF" vlink="#990066" alink="#DD0000" -> - -Citadel test PHP thing.
-CITADEL_HEADER_DATA; - -echo "Your session ID is ", $session, "
\n"; -echo "Dude, we're in ", `pwd`, "
"; -echo "Log out
"; -flush(); -test_for_echo(); +LITERAL; + echo "Your session ID is ", $session, "
\n"; + echo "Log out
"; + // flush(); + // test_for_echo(); } diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 4f0b60e62..84ab12541 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -1,22 +1,52 @@ \n"; - flush(); - echo "Writing...
\n"; - flush(); - // fwrite($clientsocket, $command, strlen($command)); - fwrite($clientsocket, $command); - echo "Reading...
\n"; - flush(); - $response = fgets($clientsocket, 4096); + serv_puts($command); + $response = serv_gets(); echo $response, "
"; flush(); } +function ctdl_mesg($msgname) { + global $clientsocket; + + serv_puts("MESG " . $msgname); + $response = serv_gets(); + + if (substr($response, 0, 1) == "1") { + echo "
\n"; + do { + $buf = serv_gets(); + if ($buf != "000") { + echo "", $buf, "
\n" ; + } + } while ($buf != "000"); + echo "
\n"; + } + else { + echo "", substr($response, 4), "
\n"; + } +} + ?> diff --git a/ctdlphp/ctdlsession.php b/ctdlphp/ctdlsession.php index 25427420b..2407a8f76 100644 --- a/ctdlphp/ctdlsession.php +++ b/ctdlphp/ctdlsession.php @@ -79,6 +79,7 @@ function ctdl_end_session() { // Tell the Citadel server to terminate our connection. fwrite($clientsocket, "QUIT\n"); + $response = fgets($clientsocket, 4096); // IGnore response fclose($clientsocket); unset($clientsocket); diff --git a/ctdlphp/index.php b/ctdlphp/index.php deleted file mode 100644 index 9127a44ac..000000000 --- a/ctdlphp/index.php +++ /dev/null @@ -1,26 +0,0 @@ - - - -

Page One

- -

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis consectetuer -varius ipsum. Cras neque tortor, congue in, faucibus id, ornare vitae, est. -Vivamus erat. Cras vel erat vitae pede convallis porttitor. Vestibulum -dictum, arcu in tempus vulputate, leo lorem commodo purus, ut fringilla -augue urna eget mi. Donec laoreet condimentum est. Vestibulum bibendum. -Curabitur faucibus, risus vitae porta commodo, felis eros fringilla nibh, -quis varius lectus ante ac pede. Maecenas eu leo. Phasellus orci. Suspendisse -elementum ultricies quam. Nulla facilisi. Fusce vel purus at nunc ultrices -tempor. Nullam laoreet massa ut wisi.

- -Page Two
-Page Three
- - - diff --git a/ctdlphp/login.php b/ctdlphp/login.php new file mode 100644 index 000000000..a4da890a1 --- /dev/null +++ b/ctdlphp/login.php @@ -0,0 +1,15 @@ + + +Page Two
+Page Three
+ + + diff --git a/ctdlphp/sessionproxy.php b/ctdlphp/sessionproxy.php index d9977a636..ee4703eb6 100755 --- a/ctdlphp/sessionproxy.php +++ b/ctdlphp/sessionproxy.php @@ -107,9 +107,26 @@ do { if ($msgsock >= 0) do { $buf = sock_gets($msgsock); if ($buf !== false) { - fwrite($ctdlsock, $buf . "\n", (strlen($buf)+1) ); + if (!fwrite($ctdlsock, $buf . "\n")) { + fclose($ctdlsock); + socket_close($sock); + system("/bin/rm -f " . $sockname); + exit(8); + } $talkback = fgets($ctdlsock, 4096); + if (!$talkback) { + fclose($ctdlsock); + socket_close($sock); + system("/bin/rm -f " . $sockname); + exit(9); + } socket_write($msgsock, $talkback, strlen($talkback)); + + if (substr($talkback, 0, 1) == "1") do { + $buf = fgets($ctdlsock, 4096); + socket_write($msgsock, $buf, strlen($buf)); + } while ($buf != "000\n"); + } } while($buf !== false); @@ -118,7 +135,7 @@ do { } while (true); socket_close($sock); -socket_close($ctdlsock); +fclose($ctdlsock); system("/bin/rm -f " . $sockname); exit(0);