-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,
I saw that you fixed this but have you ever thought of using the imap_* 
functions for this? It'd be a lot easier and it does work on pop3 servers.
~Paul

On Wednesday 16 October 2002 05:02 pm, Jason Young wrote:
> I'm in the process of writing a very very simple web-based email client,
> just for my personal use, so I can perm-delete all the spam that comes
> in through the day on my home account before i get home.
>
>
> On the very first connect, its great.. connects, does a 'uidl' which
> lists all the mail ID's (the 'else' part of the if statement below)
>
> The problem lies where I click the generated link and attempt to read a
> message, the browser load just hangs (despite the set_time_limit()) and
> when I cancel it, the server tells me there's another connection active.
>
> I have an fputs($pop, "QUIT\r\n); as well as an fclose($pop); ..
> Shouldn't this be sufficient to make sure the connection is closed
> before my visit to trying to read a message? Or is that not the problem?
>
> I'm thinking its something with the actual ($action == "read") code..
> but... what would it be?
>
> Thanks for all help!
> -Jason
>
> Code----
>
> <?
> if (isset($_GET['action']))
>    $action = $_GET['action'];
> if (isset($_GET['msg']))
>    $msg = $_GET['msg'];
>
> $pop = fsockopen("pop.server", 110, $errno, $errstr, 300);
>
> fgets($pop,255);
>
> fputs($pop,"USER name\r\n");
> fgets($pop,255);
>
> fputs($pop,"PASS word\r\n");
> $status = fgets($pop,255);
>
> if (substr($status, 0, 4) == "-ERR") {
>    echo $status;
>    exit();
> }
>
> if ($action == "read") {
>    set_time_limit(10);
>    $cmd = "top $msg 10";
>    fputs($pop, $cmd);
>    $themsg = fgets($pop);
>    echo $themsg;
> } else {
>    fputs($pop,"uidl\r\n"); // Get list of messages
>    $list = fgets($pop,255)."<br>";
>    $list = substr($list, 4, strpos($list, " ", 3));
>    for ($i = 1; $i <= $list; $i++) {
>      $curr = fgets($pop);
>      echo "<a href=\"?action=read&msg=".substr($curr, 0, strpos($curr, "
> "))."\">$curr</a><br>";
>    }
>    echo "<br>$list messages";
> }
>
> fputs($pop,"QUIT\r\n");
> echo fgets($pop);
>
> fclose($pop);
> ?>

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9rgbwDyXNIUN3+UQRAuO3AJ9zntAWZ6RkOC2LHQDSEVlirN1CegCfZatW
JGjOasC8q+s56CcF1j9Odok=
=49DU
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to