|
|
Re: Support for "Net Send"/Winpopup [message #505 is a reply to message #486] |
Fri, 15 February 2002 04:55 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
ironstorm wrote on Thu, 14 February 2002 8:30 AM |
I'm thinking of adding this into FUD, because of the net environment I work it will be more handy to have this for notification then ICQ (not allowed at work) and email (allowed but folks get too much email).
Would you guys be opposed to including my hack?
I'm figuring the easiest way to implement it is to add a field to FUD_User for domain & user info (format: \\MYDOMAIN\USER), then add a class for WinPopup firing when the other notify events go - if the domain data in that field is not blank.
The class for winpopup would prolly check the OS and if windows do a net send, otherwise try a net send through Samba.
I'm going to play with it at work.
|
Sounds like an interesting idea. If you do write it, I see no problem with adding it as a module that can be enabled/disabled via the global control panel. I can see how it could be useful in an office enviroment where IM clients are not let through the firewall.
Would this kind of functionality require any external non PHP code?
FUDforum Core Developer
|
|
|
Re: Support for "Net Send"/Winpopup [message #510 is a reply to message #505] |
Fri, 15 February 2002 12:27 |
ironstorm
Messages: 89 Registered: February 2002 Location: Toronto, Ontario, Canada
Karma: 0
|
Member |
|
|
prottoss wrote on Thu, 14 February 2002 11:55 PM |
Sounds like an interesting idea. If you do write it, I see no problem with adding it as a module that can be enabled/disabled via the global control panel. I can see how it could be useful in an office enviroment where IM clients are not let through the firewall.
Would this kind of functionality require any external non PHP code?
|
It should be possible to do it natively, however I don't have enough info on the protcol yet to attempt it...
So, for now I'll write a class to handle sending messages, inside I'll check for windows and then use exec "net send MACHINE MESSAGE" in Windows...
Under all other OSes, I'll require that the SAMBA client be installed and use "smbclient -M MACHINE", for this one I have to fopen the process and write as if doing stdin for the body of the message...
I just need to make sure to do escapeshellargs on stuff, so no one can F-around with the command line.
If I get enough info to do it with a native socket connection, then later on I can replace both of those with the native socket version, putting it in a class should make it transparent to the rest of the code.
|
|
|
Re: Support for "Net Send"/Winpopup [message #566 is a reply to message #510] |
Mon, 18 February 2002 16:22 |
ironstorm
Messages: 89 Registered: February 2002 Location: Toronto, Ontario, Canada
Karma: 0
|
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
|
|
|
Re: Support for "Net Send"/Winpopup [message #567 is a reply to message #566] |
Mon, 18 February 2002 16:25 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Does Windows require any additional software to run this program, or can any stock Win2k,WinXP,WinMe install do it?
FUDforum Core Developer
|
|
|
Re: Support for "Net Send"/Winpopup [message #568 is a reply to message #567] |
Mon, 18 February 2002 16:29 |
ironstorm
Messages: 89 Registered: February 2002 Location: Toronto, Ontario, Canada
Karma: 0
|
Member |
|
|
prottoss wrote on Mon, 18 February 2002 11:25 AM | Does Windows require any additional software to run this program, or can any stock Win2k,WinXP,WinMe install do it?
|
I'm not sure about Windows ME/98 (in fact I doubt they have 'at'), but the NT family of releases NT4, 2K, XP all have the 'net' command and the 'at' scheduler out of the box.
|
|
|
Re: Support for "Net Send"/Winpopup [message #569 is a reply to message #568] |
Mon, 18 February 2002 16:33 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
ironstorm wrote on Mon, 18 February 2002 11:29 AM |
prottoss wrote on Mon, 18 February 2002 11:25 AM | Does Windows require any additional software to run this program, or can any stock Win2k,WinXP,WinMe install do it?
|
I'm not sure about Windows ME/98 (in fact I doubt they have 'at'), but the NT family of releases NT4, 2K, XP all have the 'net' command and the 'at' scheduler out of the box.
|
I have an XP box at work, I'll try your code on it I am curious how WinPopUps work.
FUDforum Core Developer
|
|
|
Re: Support for "Net Send"/Winpopup [message #571 is a reply to message #569] |
Mon, 18 February 2002 16:42 |
ironstorm
Messages: 89 Registered: February 2002 Location: Toronto, Ontario, Canada
Karma: 0
|
Member |
|
|
prottoss wrote on Mon, 18 February 2002 11:33 AM |
ironstorm wrote on Mon, 18 February 2002 11:29 AM |
prottoss wrote on Mon, 18 February 2002 11:25 AM | Does Windows require any additional software to run this program, or can any stock Win2k,WinXP,WinMe install do it?
|
I'm not sure about Windows ME/98 (in fact I doubt they have 'at'), but the NT family of releases NT4, 2K, XP all have the 'net' command and the 'at' scheduler out of the box.
|
I have an XP box at work, I'll try your code on it I am curious how WinPopUps work.
|
The best way to see them in action (I'm not confident my code works 100% yet), is to go...
Start->Run Cmd.exe (command prompt) hostname (print your hostname) net send <type your hostname> hello world, this is my message. (send a message to yourself)
It should work between WindowsNT based and Samba equip computers too, YMMV though, I'm not an expert in how it has to be set up for it to work, I just know that it's there ...
To give you an example (of how little I know about it ), I have one machine (all of our boxes run Win2K) at work that I can net send messages from, but can't receive them (I think it can't recieve them because it is not part of the same domain, but I have no idea if that's the real reason).... But that's ok, cause it's the server anyway, so it doesn't need to recieve... just dish out.
[Updated on: Mon, 18 February 2002 16:43] Report message to a moderator
|
|
|
Re: Support for "Net Send"/Winpopup [message #677 is a reply to message #486] |
Fri, 22 February 2002 16:32 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I see, seems to work well on my Win XP box.
I noticed 2 things of annoyance with the dialog that pops up. First I cannot select the text in the dialog and copy it anywhere, so if the dialog has some text I need I'd have to retype the text in order to use it. Seconds, is that if the message contains a URL it does not become a link that I can click on.
Is there a way to bypass those limitations?
FUDforum Core Developer
|
|
|
Re: Support for "Net Send"/Winpopup [message #678 is a reply to message #677] |
Fri, 22 February 2002 17:13 |
ironstorm
Messages: 89 Registered: February 2002 Location: Toronto, Ontario, Canada
Karma: 0
|
Member |
|
|
prottoss wrote on Fri, 22 February 2002 11:32 AM |
I noticed 2 things of annoyance with the dialog that pops up. First I cannot select the text in the dialog and copy it anywhere, so if the dialog has some text I need I'd have to retype the text in order to use it.
Seconds, is that if the message contains a URL it does not become a link that I can click on.
Is there a way to bypass those limitations?
|
Winpopup is not the greatest... about the only thing going for it is that it's one every NT/2K/XP machine out of the box... which is why I would like to use it for my local office net (I think email is overkill for notification, at least where you get as much email as we get here )
That said, if one wants to, they can install a Winpopup replacement client like realpop that has support for URLs and selecting text...
I run ICQ98a at home, so I'm used to not having clickable links from notifications (I think the 'Javascript:' stuff screws up the old ICQ)...
|
|
|
Re: Support for "Net Send"/Winpopup [message #2670 is a reply to message #678] |
Thu, 16 May 2002 10:53 |
delvar
Messages: 7 Registered: May 2002 Location: UK
Karma: 0
|
Junior Member |
|
|
98 does have win popup but you have to manualy start it from c:/windows/Winpopup.exe but once running should work the same as the other windows versions, iv not tryed it with your script but I know it works over my lan popup to popup.
Hay 'tis anuver usles sig!
|
|
|