FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Support for "Net Send"/Winpopup
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Support for "Net Send"/Winpopup [message #566 is a reply to message #510] Mon, 18 February 2002 16:22 Go to previous messageGo to previous message
ironstorm is currently offline  ironstorm   Canada
Messages: 89
Registered: February 2002
Location: Toronto, Ontario, Canada
Karma:
Member

ironstorm wrote on Fri, 15 February 2002 7:27 AM


It should be possible to do it natively, however I don't have enough info on the protcol yet to attempt it...



Forget I said that... It is WAY to complicated for a native implementation...

Here is the code I have so far, it hasn't been tested under
Linux so I don't know if it will work...

Quote:


<?
function WinPopup($Target, $Message)
{
global $COMSPEC;
if (isset($COMSPEC)) // Windows
{
/* Schedule the call to 'net send', because if 'net send'
can't quickly resolve the computer name it can easily exceed PHP's
allowed processing time, and besides don't want the user to wait */
$result = shell_exec("at ".date("H:i", time()+60)." net send \"".$Target."\" ".escapeshellarg($Message));
preg_match("/ID = ([0-9]+)$/",$result, $matches );
return $matches[1];
}
// *nix with Samba
$result = shell_exec("echo ".escapeshellarg($Message)."| smbclient -M ".escapeshellarg($Target)." >/dev/null");
return 1;
}

?>
<pre>

<form>

<h4>Winpopup / Net Send from PHP</h4>

<input type=text name=target value='<?=gethostbyaddr($REMOTE_ADDR);?>'>
<input type=submit value='go!'>

<?
// The Test ...
if (isset($target))
{
$x = WinPopup($target, "PHP sent you a message at ".date("H:i"));
echo "<BR>";
echo "date = ".date("H:i");
echo "<Br>";
echo "x = [ $x ]";
?>
<br>
if <b><?=$target?></b> is a windows PC with some kind of
net send / winpopup compatiable maillots
running you should hopefully get
a message in about a minute or two.
</pre>


<?
if ($COMSPEC)
{
$at = shell_exec("at");
echo "at = [ <textarea nowrap rows=10 cols=100>".$at."</textarea><Br>]";
}
else
{
phpinfo();
}
}
?>
</form>

[Updated on: Mon, 18 February 2002 16:24]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Showcase forum
Next Topic: Function list
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 20:01:15 GMT 2024

Total time taken to generate the page: 0.04171 seconds