Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem reading from a telnet socket!!!!

136 views
Skip to first unread message

Dani

unread,
Dec 27, 2001, 10:32:08 AM12/27/01
to
Hello,
I have a problem with telnet. Lolololo's bash.profile is configured
for change the password. The lines in bash.profile are:
...
passwd //ask new password to lolololo
exit //exit

I would like to change the password of lolololo from php.
I think that the next code is correct but there is a problem:
the line where it read of socket don't response.
Why?

<?
$dhost="mydomain";
echo "$dhost";
$duser="lolololo";
echo "$duser";
$dpass="lalalalala";
echo "$dpass";
$dpass2='iaiaiaiaia';
$fp = fsockopen($dhost, 23, &$errno, &$errstr);
echo "$fp";
if (!$fp) {
echo "Error: $errno - $errstr<br>\n";}
else {
echo "Sin error<br>";
$result = fwrite($fp,"$duser\n");
echo "$result<br>";
$result = fwrite($fp,"$dpass\n");
echo "$result<br>";
$result = fwrite($fp,"$dpass\n");
echo "$result<br>";
$result = fwrite($fp,"$dpass2\n");
echo "$result<br>";
$result = fwrite($fp,"$dpass2\n");
echo "$result<br>";
echo fread($fp, 100);
}
fclose($fp);
?>

Thanks people!!!!

0 new messages