Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem reading from telnet socket!!!!

Status
Not open for further replies.

diembi

Programmer
Sep 22, 2001
238
ES
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=&quot;mydomain&quot;;
echo &quot;$dhost&quot;;
$duser=&quot;lolololo&quot;;
echo &quot;$duser&quot;;
$dpass=&quot;lalalalala&quot;;
echo &quot;$dpass&quot;;
$dpass2='iaiaiaiaia';
$fp = fsockopen($dhost, 23, &$errno, &$errstr);
echo &quot;$fp&quot;;
if (!$fp) {
echo &quot;Error: $errno - $errstr<br>\n&quot;;}
else {
echo &quot;Sin error<br>&quot;;
$result = fwrite($fp,&quot;$duser\n&quot;);
echo &quot;$result<br>&quot;;
$result = fwrite($fp,&quot;$dpass\n&quot;);
echo &quot;$result<br>&quot;;
$result = fwrite($fp,&quot;$dpass\n&quot;);
echo &quot;$result<br>&quot;;
$result = fwrite($fp,&quot;$dpass2\n&quot;);
echo &quot;$result<br>&quot;;
$result = fwrite($fp,&quot;$dpass2\n&quot;);
echo &quot;$result<br>&quot;;
echo fread($fp, 100);
}
fclose($fp);
?>

Thanks people!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top