head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	95.06.05.02.33.50;	author nocturne;	state Exp;
branches;
next	1.1;

1.1
date	95.03.07.14.15.31;	author yonah;	state Exp;
branches;
next	;


desc
@zwrite gateway FE
@


1.2
log
@changed "post" to "GET", as it should have been
@
text
@#!/usr/athena/bin/perl

require 'zsend.pl';
require 'parseform.pl';

$query=$ENV{'QUERY_STRING'};

print("Content-Type: text/html\n\n");
print("\n");

if($query){
	&send_zwrite($query);
}
else{
	&provide_form();
}

sub provide_form {
	print <<EndOfForm;
<title>Zwrite Form</title>

<h1>Zwrite</h1>
Note, you should <a href="zlocate">zlocate</a> the user you want to send to, to assure they are logged in.

<form method="GET">
Your address: <input name="from" size=30><p>
Send zephyr to: <input name="to" size=30><p>
Message:
<TEXTAREA name="body" rows=9 cols=60></TEXTAREA><p>
<input type="submit" value="Send the zephyr">
<input type="reset" value="Naaaaah, just kidding">
</form>
EndOfForm
}

sub send_zwrite {
	local($info) = @@_;

	%resp = &parseform($info);	
	
	$host = "www.mit.edu";
	$resp{'to'} = "mkgray" unless $resp{'to'};

	$zsend'localaddr = ((gethostbyname("$host"))[4]);

	@@zsend'zhmaddr = unpack("C4",$zsend'localaddr);
	foreach $person (split(' ', $resp{'to'})){
	$_ = &zsend'zpacket(undef,            # figure out uid
                "message",
                "personal",
                "", # opcode
                "$resp{'from'} via SIPB www-zephyr gateway",
                "$person",
                "message from \$sender\n\$signature\n\$message",
                      "From user at $ENV{'REMOTE_ADDR'}",
                "$resp{'body'}\n_________________________________________________\n@@i(This zephyr sent via the SIPB WWW-zephyr gateway\nat http://www.mit.edu:8001/zwrite. Problems/comments\nshould be sent to webmaster@@mit.edu)");

        &zsend'zsend($_);
	print("Your message has been sent<br>\n");

}
	
}

1;
@


1.1
log
@Initial revision
@
text
@d25 1
a25 1
<form method="post">
@
