Re: possibly buffer problem, including a bit of code this time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



matt VanDeWalle wrote:
oops, sorry about the lack of any code with my last problem message.

ok this is a start, still your descriptions assume too much - remember
no on this list knows you or your code - you must be very explicit (the more
you are the better the help people can give)

I am still having the same buffer problem where after asking for a password, it doesn't stop and wait, just falling through to the next prompt. here is basically what the new_user function looks like. I am using php 4.3.10 on slackware 10.1
/* the new user function */
function new_user($sock, $username)
{
global $cdata;
/* shorthand of socket_write is now  send_single */

now this is not my area of 'expertise' ... just thinking
out loud really:

so send_single() is a function written by you? as a wrapper to
socket_write()?

do all 3 prompts (as sent by send_single()) show up on the screen when you connect?
at what point do they appear exactly.

I assume you have used copious ammounts of the following functions in order to
try to determine the problem?:

socket_last_error()
socket_strerror()

also have you tried using:
http://nl2.php.net/manual/en/function.socket-recv.php
instead of socket_read()?

send_single($sock, "please type the username you would like to go by ");
$username = socket_read($sock, 1024, PHP_NORMAL_READ);
/* i had to change to PHP_NORMAL_READ or else windows users couldnt get on with more than 1 char */
$username = trim($username);
/* now comes the problem as far as i'm seeing it program execution-wise */
send_single($sock, "please choose a password");
$pwd = socket_read($sock, 1024, PHP_NORMAL_READ);
$passwd = trim($pwd);
send_single($sock, "email address to send your signup info");
$email = socket_read($sock, 1024, PHP_NORMAL_READ);
$email = trim($email);
/* do rest of function like fill array and write userfile etc */
..........
}
ok: as far as i can tell, it asks for the password, skips that, and goes right onto the prompt that asks for the email address (totally skips that as well), and proceeds to fill the array and write the file and then log the user on, so of course half of the array variables seem to be blank and the file doesn't contain the password or email)
obviously I'm doing something wrong but what?
matt
ps, hope that is enough of the code to tell


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux