#!/usr/local/bin/perl 

# CPAN Modules Used

use CGI qw(:standard );
use CGI::Cookie;
use MIME::Entity;


umask 000 ;

# initialize variables

$ad_style = param('ad_style') ;
$tag_string = param('tag_string') ;
$sig_string = param('sig_string') ;
$sig_string =~ s/\r//g ;
$ad_left = param('ad_left') ;

####
# Author Information
$author_name = param('author_name') || "" ;	
$author_email = param('author_email') || "" ;	
if ( $author_email eq 'nobody@undesign.org' ) 
	{ $nobody = "true" ; } else { $nobody = ""; }
$author_url = param('author_url') || "" ;
$sender_name = "jam.media.org" ;
$sender_email = "jam\@media.org" ;

$image_filename = param('image_filename') || "" ;
$password = param('password') || "" ;
$new_password = param('new_password') || "";




# step 1: validate that the user has a valid email address passed in and a valid password.
# otherwise, send them back to tibor.cgi

	%cookies = fetch CGI::Cookie;
	@jar = (exists($cookies{'user'})) ? $cookies{'user'}->value : ();
	if ($jar[1] ne "" && $author_email eq "" ) { $author_email = $jar[1] ; }

if ($author_email eq "")
	{
	$error_message = "We need you to fill in both the email address and password to proceed!" ;
	&call_tibor ;
	}

if ($author_url ne "" && !($author_url =~ m/^http:\/\//) ) { $author_url =~ s/^/http:\/\// ; }
	$author_safe_email = $author_email ;
	$author_safe_email =~ s/\^\&\|\<\>/./g ;

if ((! -d "./MyOrbit/$author_safe_email/" ) && ( $author_email ne "") && ($nobody ne "true" ) )
{
	$error_message = 'We didn\'t recognize your email address as an existing account.  Hit the &#147;create&#148; button to create a new <b><font color="#999999">UN</font><font color="#666666">AD</font></b> and make yourself an account.' ;
$create_ad = <<"_____EoI2_____";
<a href="context.cgi?author_email=$author_email" onMouseOver='swapON("create")' onMouseOut='swapOFF("create")'><img name="create" alt="create un-ad" border="0" src="/images/orbit/buttons/create.gif"></a>
_____EoI2_____
	&call_tibor ;
}


# read in author information
	open (DIR_FILE, "./MyOrbit/$author_safe_email/.author_info") ;
	# read parameters into variables
	@stored_params = <DIR_FILE> ;
	chop @stored_params ;
	$s_author_email = $stored_params[0] ;
	$s_author_name = $stored_params[1] ;
	$s_author_url = $stored_params[2] ;
	$s_password = $stored_params[3] ;
		# there are certainly better ways to do this
		$s_author_email =~ s/^author_email:// ;
		$s_author_name =~ s/^author_name:// ;
		$s_author_url =~ s/^author_url:// ;
		$s_password =~ s/^.*:// ;
	close DIR_FILE ;
		
	if ($s_password eq "NEW_USER" && $password eq "" && $nobody ne "true")
	{
	$error_message = "We need you to pick a <b>new</b> password before we can proceed.  This will enable you to access your private gallery.  Please fill one in below!" ;
	&call_tibor ;
	}

	if ($jar[0] ne "" && $author_name eq "" ) { $author_name = $jar[0] ; }
	if ($jar[2] ne "" && $author_url eq "" ) { $author_url = $jar[2] ; }
	if ($jar[3] ne "" && $password eq "" )  { $password = $jar[3] ; }

	if (($nobody ne "true") && (($author_email eq "") || ($password eq "" )))
	{
	$error_message = "We need you to fill in both the email address and password to proceed!" ;
	$error_message = $error_message . 'If you\'ve lost your password, please send mail to <a href="mailto:wwtd\@undesign.org">wwtd\@undesign.org</a> and we\'ll try and help you.' ;

	&call_tibor ;
	}

	# special cases: NEW USER
	if ( (($s_password ne $password) && ($s_password ne "NEW_USER")) && ($nobody ne "true" ) )
	{
	$error_message = "Incorrect password!" ;
	$error_message = $error_message . 'If you\'ve lost your password, please send mail to <a href="mailto:wwtd\@undesign.org">wwtd\@undesign.org</a> and we\'ll try and help you.' ;
	$error_message = $error_message . '<br><br>Otherwise, please try again.' ;
	&call_tibor ;
	}


	# we now have a valid user
	if ($new_password ne "") { $password = $new_password ; }
	if ($s_password eq "NEW_USER") {
		$password_message = "Thanks for joining the unad campaign at undesign.org!  Your password is $password.\n\n" ;
	}

	if ( $image_filename ne "" )
	{
		# need to save a new file
		&save_file ;
	}

	# 
	
	# if you want to update your personal info, must do it from this screen, not context.cgi
if ( $s_password eq "NEW_USER" )
	{ &update_author_info ; &update_cookie; }
if ( $nobody ne "true" )
{ 
	if ( $password ne $s_password || $author_name ne $s_author_name || $author_url ne $s_author_url )
	{ 
		if ( (($author_name eq "") || ($author_name eq "Anonymous" )) && $s_author_name ne "" ) 
			{ $author_name = $s_author_name ; }
		if ( $author_url eq "" && $s_author_url ne "" ) 
				{ $author_url = $s_author_url ; }
			&update_author_info ; 
			&update_cookie ;  
	}
	if ($author_email ne $jar[1]) { &update_cookie ; }
} 

	&build_info_list ;

	&read_info_files ;
	if ( $pub_changed_final eq "true" )
		{
		$pub_message = '<font color="#990000">Publication status has been updated.</font><br><br>' ;
		}
	&print_screen ;



exit(0);

sub sort_function { $KEYS[$b] <=> $KEYS[$a] ; }
sub build_info_list {
	opendir (STOCK_LIST, "./MyOrbit/$author_safe_email") ;
	@image_list = grep(/^.*png$/, readdir(STOCK_LIST)) ;
	rewinddir(STOCK_LIST);
	@info_list = grep(/^.*\.info$/, readdir(STOCK_LIST)) ;
	closedir(STOCK_LIST) ;
        local(@KEYS);
        foreach (@image_list) {
                $temp_key = $_ ;
                $temp_key =~ s/^\.\/([^\/]+)\/([^\/]+)\/([^\/]+)/$3/ ;
                $temp_key =~ s/^.*\.([0-9]+)\.([0-9]+)\.png$/$1/ ;
                push(@KEYS, $temp_key );
        }
        @image_list = @image_list[sort sort_function $[..$#image_list];
        @info_list = @info_list[sort sort_function $[..$#info_list];
}

sub read_info_files {
	for ($i = 0; $i <= $#image_list ; $i++ )
	{
		&read_in_info_file ;
	}

}
		

sub read_in_info_file
{
	$pub_changed = "false" ;
	open (TEMP, "./MyOrbit/$author_safe_email/$info_list[$i]") ;
	my(@temp_array) = <TEMP> ;
	chop @temp_array;
	$info_ad_left[$i] = $temp_array[1] ;
	$info_tag_string[$i] = $temp_array[2] ;
	$info_ad_style[$i] = $temp_array[3] ;
	$info_published[$i] = $temp_array[4] ;
	my ($form_published) =param("$image_list[$i]_p") ;
		# check for change in publication status
		if ( ( $info_published[$i] ne  $form_published ) && ( $form_published ne "") ) 
		{
			$pub_changed = "true" ;
			$temp_array[4] = param("$image_list[$i]_p") ;
			$info_published[$i] = param("$image_list[$i]_p") ;
		}
		if ( $info_published[$i] eq "PUBLISHED_true" ) 
		{
			$publish_list[$i] = "checked" ;
		} else {
			$d_publish_list[$i] = "checked" ;
		}
	$info_string[$i] = "" ;
	for ( $j = 5 ; $j <= $#temp_array; $j++ )
		{
		$info_string[$i] = $info_string[$i] . $temp_array[$j] . "\n" ;
		}
		chop $info_string[$i] ;
			
	close TEMP ;
	if ( $pub_changed eq "true" ) {
		$pub_changed_final = "true" ;
		open (PUB, ">./MyOrbit/$author_safe_email/$info_list[$i]") ;
		for ( $k = 0; $k <= $#temp_array; $k++  )
		{
		print PUB $temp_array[$k], "\n" ;
		}
		chmod 0644, PUB ;
		close PUB ;
	}
	
}

###
###	Create list of image files
sub build_image_output {

	for ( $i = 0; $i <= $#image_list ; $i++ )
	{
print <<"_____EoI2_____";
<tr><td height="95" valign="top" align="left"><FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
<img src="./MyOrbit/$author_safe_email/$image_list[$i]" width="468" height="60" vspace="3" alt="Image by iStock, unad by $author_name"><br>
_____EoI2_____
if ( $nobody ne "true" ) {
print <<"_____EoI2_____";
<input type="radio" name="$image_list[$i]_p" value="PUBLISHED_true" $publish_list[$i]> Public
<input type="radio" name="$image_list[$i]_p" value="PUBLISHED_false" $d_publish_list[$i]> Private</font></td></tr>
_____EoI2_____
	}
	}
}

sub build_clone_output {
	for ( $i = 0; $i <= $#image_list ; $i++ )
	{
print <<"_____EoI2_____";
_____EoI2_____
if ( $nobody ne "true" ) {
print <<"_____EoI2_____";
<form method="POST" name="delete_$i" action="undesign.cgi">
<tr><td height="37" valign="bottom">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.delete_$i.submit()" onMouseOver="swapON(\\'delete$i\\');" onMouseOut="swapOFF(\\'delete$i\\');">' +
        '<img src="/images/orbit/buttons/delete.gif" border="0" width="77" height="19" name="delete$i"></a>')
</script>
<noscript>
<INPUT type="image" alt="Delete Unad" border="0" src="/images/orbit/buttons/delete.gif">
</noscript>
<input type="hidden" name="author_email" value="$author_email">
<input type="hidden" name="image_filename" value="$image_list[$i]">
<input type="hidden" name="info_filename" value="$info_list[$i]">
<input type="hidden" name="password" value="$password">
</td></tr>
</form>
_____EoI2_____
} else {
print <<"_____EoI2_____";
<tr><td height="37" valign="bottom">
<img src="/trans.gif" width="5" height="30" border="0"></td>
_____EoI2_____
}

print <<"_____EoI2_____";
<form method="POST" name="clone_$i" action="context.cgi">
<input type="hidden" name="author_name" value="$author_name">
<input type="hidden" name="author_email" value="$author_email">
<input type="hidden" name="author_url" value="$author_url">
<input type="hidden" name="ad_left" value="$info_ad_left[$i]">
<input type="hidden" name="tag_string" value="$info_tag_string[$i]">
<input type="hidden" name="sig_string" value="$info_string[$i]">
<input type="hidden" name="ad_style" value="$info_ad_style[$i]">
<tr><td height="58" valign="top">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.clone_$i.submit();" onMouseOver="swapON(\\'clone$i\\');" onMouseOut="swapOFF(\\'clone$i\\');">' +
        '<img src="/images/orbit/buttons/clone.gif" border="0" width="77" height="19" name="clone$i"></a>')
</script>
<noscript>
<INPUT type="image" alt="Clone Unad" border="0" src="/images/orbit/buttons/clone.gif">
</noscript>
</td></tr>
</form>
_____EoI2_____
	}
}

sub update_cookie {
	$c = new CGI::Cookie(-name    =>  'user',
                             -value   =>  ["$author_name","$author_email", "$author_url", "$password" ],
                             -expires =>  '+3M' 	# three months
	                    );
}
sub update_author_info {
	open (DIR_FILE, ">./MyOrbit/$author_safe_email/.author_info") ;
	print DIR_FILE "author_email:", $author_email, "\n" ;
	print DIR_FILE "author_name:", $author_name, "\n" ;
	print DIR_FILE "author_url:", $author_url, "\n" ;
	print DIR_FILE "password:", "$password", "\n" ;
	chmod 0644, DIR_FILE ;
	close DIR_FILE ;
}

sub save_file {

	system ( "mv ./MyOrbit/scratch/$image_filename ./MyOrbit/$author_safe_email/$image_filename") ;
	$image_info_filename = $image_filename ;
	$image_info_filename =~ s/.png$/.info/ ;

	open (INFO_FILE, ">./MyOrbit/$author_safe_email/$image_info_filename") ;
	print INFO_FILE $image_filename, "\n" ;
	print INFO_FILE $ad_left, "\n" ;
	print INFO_FILE $tag_string, "\n" ; 	# tag string
	print INFO_FILE $ad_style, "\n" ; 	# tag string
	$published_true = "PUBLISHED_true" ;
	$published_false = "PUBLISHED_false" ;
if ( $nobody eq "true" ) {
	print INFO_FILE $published_true, "\n" ;
} else {
	print INFO_FILE $published_false, "\n" ;
}
	print INFO_FILE $sig_string, "\n" ;
	chmod 0644, INFO_FILE ;
	close INFO_FILE ;

	$image_url = "http://undesign.org/orbit/MyOrbit/$author_safe_email/$image_filename" ;

    ### Create the top-level, and set up the mail headers:
    $top = MIME::Entity->build(Type    =>"multipart/mixed",
                               From    => "$sender_email ($sender_name)",
	                       To      => "$author_email ($author_name)",
	                       Bcc      => "orbitmaster\@undesign.org",
                               Subject => "WWTS?");

    ### Build the user message
    $message = "Greetings!\n\n" ;
    $message = $message . $password_message ;
    $message = $message . "Your unad has been created with the following text:\n" ;
    $tab_string = $sig_string ;
    $tab_string =~ s/\n/\n\t/g ;
    $tab_string =~ s/\n\t$//g ;
    $message = $message . "\t" . $tab_string . "\n\n";
    $message = $message . "You may access your image at\n\t$image_url\n\n" ;
    $message = $message . "You may access your image directory at\n\thttp://undesign.org/orbit/tiborocity.cgi\n\n" ;
    $message = $message . "Thanks again for your cooperation!\n\n" ;
    $message = $message . "jam.media.org\nhttp://jam.media.org/\n\n" ;

	$message = $message . "================\n" ;
	$message = $message . "User Information\n" ;
	$message = $message . "================\n" ;
	$message = $message . "\tUser Host: " . remote_host() . "\n" ;
	$message = $message . "\tUser Agent: " . user_agent() . "\n" ;

    ### Part #1: a simple text document:
    $top->attach(Type => "text/plain",
		Encoding => "7bit",
		Data => "$message" );


    ### Part #2: a GIF file:
    $top->attach(Path        => "./MyOrbit/$author_safe_email/$image_filename",
                 Type        => "image/png",
                 Encoding    => "base64");



    ### Send it:
    open MAIL, "| /usr/lib/sendmail -t -oi -oem" or die "open: $!";
    $top->print(\*MAIL);
    close MAIL;
}

sub call_tibor {
###
###
### This is the error is password or email address was not filled in properly
###
print header(-type=>'text/html', -expires=>'now');
print <<"_____EoI2_____";


<HTML>
<HEAD>
<TITLE>undesign - in orbit</TITLE>
<link rel="SHORTCUT ICON" HREF="http://undesign.org/favicon.ico">
<META NAME="Author" CONTENT="media.org">
<META NAME="Keywords" CONTENT="Tibor Kalman,webchick,undesign,Kalle Lasn,adbusters,WWTD,media.org,culture jamming,social responsibility">
<META NAME="Description" CONTENT="Context is everything: Tibor Kalman inspires a plan for all seasons.">
<style type="text/css">
<!--
A:visited {COLOR: #666666; TEXT-DECORATION: underline;}
A:link {COLOR: #666666; TEXT-DECORATION: underline;}
A:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.white:visited {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:link {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.gray:visited {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:link {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:hover {COLOR: #333333; TEXT-DECORATION: underline;}
-->
</style>

<script type="text/javascript" src="/orbit/js/win.js"></script>

<script type="text/javascript" Language="JavaScript">
<!--
        var create_off = new Image() ;
        create_off.src = "/images/orbit/buttons/create_off.gif";
        var login_off = new Image() ;
        login_off.src = "/images/orbit/buttons/login_off.gif";
function swapON (imagename)
{
        var imagename ;
        the_swap_image = eval ("document." + imagename) ;
        the_old_swap = the_swap_image.src
        the_swap_image.src = eval (imagename + "_off.src") ;

}

function swapOFF (imagename)
{
        var imagename ;
        theimage = eval ("document." + imagename) ;
        theimage.src = the_old_swap  ;

}



// -->
</script>


</HEAD>

<BODY bgcolor="#cccccc" link="#999999" vlink="#999999" alink="#999999" text="#666666" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">


<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <TR><td valign="top" height="80%">
  
<!-- BEGIN HEADER TABLE -->

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle" bgcolor="#ffffff">
    
<table width="750" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle">
		<a href="/" title="undesign. a plan for all seasons."><img src="/images/undesign_sm.gif" width="291" height="50" hspace="20" border="0" alt="UNDESIGN | a plan for all seasons"></a>
	</TD><td align="right" bgcolor="#ffffff">
				<img src="/trans.gif" hspace="2" vspace="0" name="tibor" width="62" height="13" border="0"><a href="/glimpses.html" title="What you discover in an image reveals a lot about you." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="What you discover in an image reveals a lot about you." src="/images/orbit/tibor_sm1.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="What you see is who you are." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="What you see is who you are." src="/images/orbit/tibor_sm2.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="The perfect state of creative bliss is having power and knowing nothing." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="The perfect state of creative bliss is having power and knowing nothing." src="/images/orbit/tibor_sm3.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Perception is an impression of a moment, which one cannot appreciate until it has passed." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Perception is an impression of a moment, which one cannot appreciate until it has passed." src="/images/orbit/tibor_sm4.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Do you want to die with the most toys or with the best life and experiences?" onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Do you want to die with the most toys or with the best life and experiences?" src="/images/orbit/tibor_sm5.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Find the cracks in the wall." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Find the cracks in the wall." src="/images/orbit/tibor_sm6.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Don't accept anything as 'right' or 'correct' or 'the truth.'" onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Don't accept anything as 'right' or 'correct' or 'the truth.'" src="/images/orbit/tibor_sm7.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Question, question, question your assumptions." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Question, question, question your assumptions." src="/images/orbit/tibor_sm8.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Make a choice. Choose it and stick to it. Make it the best damn choice ever." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Make a choice. Choose it and stick to it. Make it the best damn choice ever." src="/images/orbit/tibor_sm9.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a>
	</td><TD width="30" bgcolor="#ffffff"><img src="/trans.gif" width="30" height="1">
	</TD>
  </TR>
</table>

</TD>
</TR>
</table>


<!-- BEGIN CONTENT TABLE -->

<table width="750" border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0">  
  <TR><TD colspan="12" align="left">\&nbsp;</TD></TR>  
  <TR>
    
      <TD width="85"><img src="/trans.gif" width="85" height="1"></TD>
      <TD></TD>
    
      <TD valign="top">\&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">\&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">\&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">\&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top" width="30%">\&nbsp;</TD>
      <TD></TD>
    
  </TR>
  <TR>
  
<!-- LEFT QUOTE -->

    <TD valign="top" align="right"><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/left_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

<!-- BEGIN CORE CONTENT -->

	<TD colspan="9" valign="top" width="100%">





<br><center>
<FONT SIZE="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
$error_message



</center></FONT>

<P ALIGN="CENTER">
<FORM method="POST" name="loginform" action="kalman.cgi">
<INPUT TYPE="hidden" NAME="ad_style" VALUE="$ad_style">
<INPUT TYPE="hidden" NAME="tag_string" VALUE="$tag_string">
<INPUT TYPE="hidden" NAME="sig_string" VALUE="$sig_string">
<INPUT TYPE="hidden" NAME="ad_left" VALUE="$ad_left">
<INPUT TYPE="hidden" NAME="author_name" VALUE="$author_name">
<table CELLPADDING="5" CELLSPACING="0" BORDER="0" WIDTH="100%">

<TR>
<TD ALIGN="RIGHT">
<FONT SIZE="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Your email
</FONT></TD>
<TD ALIGN="LEFT">
<INPUT TYPE="text" NAME="author_email" VALUE="$author_email">
</TD>
</TR>

<TR>
<TD ALIGN="RIGHT">
<FONT SIZE="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Your password
</FONT></TD>
<TD ALIGN="LEFT">
<INPUT TYPE="password" NAME="password" VALUE="$password">
<INPUT TYPE="hidden" NAME="author_url" VALUE="$author_url">
<INPUT TYPE="hidden" NAME="image_filename" VALUE="$image_filename">
</TD>
</TR>

<TR>
<TD ALIGN="RIGHT">
<br>
</TD>
<TD ALIGN="LEFT">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.loginform.submit();" onMouseOver="swapON(\\'login\\');" onMouseOut="swapOFF(\\'login\\');">' +
        '<img src="/images/orbit/buttons/login.gif" border="0" name="login"></a>')
</script>
<noscript>
<INPUT TYPE="submit" VALUE="login">
</noscript>
$create_ad        
</TD>
</TR>

</table>
</form>


<br clear="all"><br>
<br><br>
</TD>
   
<!-- RIGHT QUOTE -->

	<TD valign="top" align="left" nowrap><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/right_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

	<TD width="10">\&nbsp;</TD>
   
</TR></table>

</td></tr><tr><td valign="top" bgcolor="#ffffff">


<!-- BEGIN FOOTER TABLE -->

<br>
<table width="98%" border="0" cellpadding="0" cellspacing="0"><TR> 
	<TD width="85" bgcolor="#ffffff"><img src="/trans.gif" width="85" height="1"></td>
     <TD nowrap align="left" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/" class="gray" title="undesign. a plan for all seasons."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">\&lt;\&lt; home </font></a>
		<br clear="all">
		</TD>
	<TD width="100%" align="center" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="http://jam.media.org/" class="gray" title="meet the undesigners."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">[ <b>\&amp;\*\$\#\@~!</b> ] </font></a>
		<br clear="all">
	</TD>
     <TD nowrap align="right" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/orbit/" class="gray" title="undesign in orbit."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">orbit \&gt;\&gt;</font></a>
		<img src="/trans.gif" width="30" height="1"> 
		<br clear="all">
		</TD>
  </TR></table>
  <br><br>
  
</td></tr></table>

  
  </BODY>
</HTML>

_____EoI2_____
###
###
### End of Error Screen
###


exit(0);

}
sub print_screen {

###
###
### Main Screen
###
print header(-cookie=>$c, -type=>'text/html',-expires=>'now');
print <<"_____EoI2_____";


<HTML>
<HEAD>
<TITLE>undesign - in orbit</TITLE>
<link rel="SHORTCUT ICON" HREF="http://undesign.org/favicon.ico">
<META NAME="Author" CONTENT="media.org">
<META NAME="Keywords" CONTENT="Tibor Kalman,webchick,undesign,Kalle Lasn,adbusters,WWTD,media.org,culture jamming,social responsibility">
<META NAME="Description" CONTENT="Context is everything: Tibor Kalman inspires a plan for all seasons.">
<style type="text/css">
<!--
A:visited {COLOR: #666666; TEXT-DECORATION: underline;}
A:link {COLOR: #666666; TEXT-DECORATION: underline;}
A:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.white:visited {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:link {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.gray:visited {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:link {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:hover {COLOR: #333333; TEXT-DECORATION: underline;}
TD.small {font-size: xx-small; font-family: VERDANA,ARIAL,HELVETICA,SANS-SERIF; color: #666666 }
-->
</style>


<script type="text/javascript" Language="JavaScript">
<!--
        var createnew_off = new Image() ;
        createnew_off.src = "/images/orbit/buttons/createnew_off.gif";
        var public_off = new Image()  ;
        public_off.src = "/images/orbit/buttons/public_off.gif" ;
        var viewmine_off = new Image()  ;
        viewmine_off.src = "/images/orbit/buttons/viewmine_off.gif" ;
        var update_off = new Image()  ;
        update_off.src = "/images/orbit/buttons/update_off.gif" ;
        var updateinfo_off = new Image()  ;
        updateinfo_off.src = "/images/orbit/buttons/updateinfo_off.gif" ;
        var delete_off = new Image()  ;
        delete_off.src = "/images/orbit/buttons/delete_off.gif" ;
        var clone_off = new Image()  ;
        clone_off.src = "/images/orbit/buttons/clone_off.gif" ;
function swapON (imagename)
{
        var imagename ;
        the_swap_image = eval ("document." + imagename) ;
        the_old_swap = the_swap_image.src
	if ( imagename.search(/delete/) >= 0 ) { imagename = "delete" ; }
	if ( imagename.search(/clone/) >= 0 ) { imagename = "clone" ; }
        the_swap_image.src = eval (imagename + "_off.src") ;

}

function swapOFF (imagename)
{
        var imagename ;
        theimage = eval ("document." + imagename) ;
        theimage.src = the_old_swap  ;

}



// -->
</script>

<script type="text/javascript" src="/orbit/js/win.js"></script>

</HEAD>

<BODY bgcolor="#cccccc" link="#999999" vlink="#999999" alink="#999999" text="#666666" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">


<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <TR><td valign="top" height="80%">
  
<!-- BEGIN HEADER TABLE -->

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle" bgcolor="#ffffff">
    
<table width="750" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle">
		<a href="/" title="undesign. a plan for all seasons."><img src="/images/undesign_sm.gif" width="291" height="50" hspace="20" border="0" alt="UNDESIGN | a plan for all seasons"></a>
	</TD><td align="right" bgcolor="#ffffff">
				<img src="/trans.gif" hspace="2" vspace="0" name="tibor" width="62" height="13" border="0"><a href="/orbit/" title="Everything is an experiment." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Everything is an experiment." src="/images/orbit/tibor_sm1.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="THEM = US" onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="THEM = US" src="/images/orbit/tibor_sm2.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Consumer culture is an oxymoron." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Consumer culture is an oxymoron." src="/images/orbit/tibor_sm3.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Wealth is poverty." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Wealth is poverty." src="/images/orbit/tibor_sm4.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Religion works better for corporations than for people." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Religion works better for corporations than for people." src="/images/orbit/tibor_sm5.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Rules are good. Break them." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Rules are good. Break them." src="/images/orbit/tibor_sm6.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Success = Boredom" onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Success = Boredom" src="/images/orbit/tibor_sm7.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Mistakes, misunderstandings, and mis-comprehensions provide fresh ideas." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="Mistakes, misunderstandings, and mis-comprehensions provide fresh ideas." src="/images/orbit/tibor_sm8.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="You'll see it better if you look upside down." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img alt="You'll see it better if you look upside down." src="/images/orbit/tibor_sm9.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a>
	</td><TD width="30" bgcolor="#ffffff"><img src="/trans.gif" width="30" height="1">
	</TD>
  </TR>
</table>

</TD>
</TR>
</table>


<!-- BEGIN CONTENT TABLE -->

<table width="750" border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0">  
  <TR><TD colspan="12" align="left">&nbsp;</TD></TR>  
  <TR>
    
      <TD width="85"><img src="/trans.gif" width="90" height="1"></TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top" width="30%">&nbsp;</TD>
      <TD></TD>
    
  </TR>
  <TR>
  
<!-- LEFT QUOTE -->

    <TD valign="top" align="right"><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/left_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

<!-- BEGIN CORE CONTENT -->

	<TD colspan="9" valign="top" width="100%">





<br><center>
_____EoI2_____

if ($nobody ne "true" ) {
print <<"_____EoI2_____";
<FONT SIZE="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
You are currently editing the <b><font color="#999999">UN</font><font color="#666666">AD</font></b> Gallery of $author_name ($author_email). 
Create a new <b><font color="#999999">UN</font><font color="#666666">AD</font></b> or make the ones you have created public to <a href="http://www.undesign.org/orbit/unmadison.cgi">share with others.</a>
<br>
<br>$pub_message
_____EoI2_____

} else {
print <<"_____EoI2_____";
<FONT SIZE="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Welcome to the Anonymous <b><font color="#999999">UN</font><font color="#666666">AD</font></b> Gallery.  You can create your own private gallery by 
<a href="context.cgi">creating a new</a> <b><font color="#999999">UN</font><font color="#666666">AD</font></b>
and filling in your email address.  (No spam, natch.)
_____EoI2_____
}

print <<"_____EoI2_____";
<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="top">
<FORM method="POST" name="form_update" action="kalman.cgi">
<table cellpadding="4" cellspacing="0" border="0">

_____EoI2_____

&build_image_output ;



print <<"_____EoI2_____";
</table>
</form>
</font>

</td><td valign="top">
<table cellpadding="4" cellspacing="0" border="0">
_____EoI2_____


&build_clone_output ;

print <<"_____EoI2_____";
</table>
</td></tr></table>

<br>
<TABLE CELLPADDING="4" CELLSPACING="0" BORDER="0" align="left">
	<TR>
_____EoI2_____

if ( $nobody ne "true" ) {
print <<"_____EoI2_____";
	<TD VALIGN="TOP" width="141">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.form_update.submit();" onMouseOver="swapON(\\'update\\');" onMouseOut="swapOFF(\\'update\\');">' +
        '<img src="/images/orbit/buttons/update.gif" border="0" name="update"></a>')
</script>
<noscript>
<input type="image" alt="update your gallery" src="/images/orbit/buttons/update.gif">
</noscript>
<input type="hidden" name="author_email" value="$author_email">
<INPUT TYPE="hidden" NAME="password" VALUE="$password">
	</TD>
</form>	
_____EoI2_____
}
print <<"_____EoI2_____";

	<TD VALIGN="TOP" width="148">
        <a href="tiborocity.cgi" onMouseOver="swapON('public');" onMouseOut="swapOFF('public');">
        <img src="/images/orbit/buttons/public.gif" border="0" name="public"></a>
	</TD>
	<TD VALIGN="TOP" width="92">
<form method="POST" name="newcreate" action="context.cgi">
<input type="hidden" name="author_name" value="$author_name">
<input type="hidden" name="author_email" value="$author_email">
<input type="hidden" name="author_url" value="$author_url">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.newcreate.submit();" onMouseOver="swapON(\\'createnew\\');" onMouseOut="swapOFF(\\'createnew\\');">' +
        '<img src="/images/orbit/buttons/createnew.gif" border="0" name="createnew"></a>')
</script>
<noscript>
<INPUT type="image" alt="Create Unad" border="0" src="/images/orbit/buttons/createnew.gif">
</noscript>
</form>
	</TD>
</TR></TABLE>
</center>


<br clear="all">
_____EoI2_____


if ( $nobody ne "true" ) {
print <<"_____EoI2_____";
<FORM method="POST" name="infoupdate" action="kalman.cgi" >

		<TABLE cellpadding="2" cellspacing="0" width="571" border="0" bgcolor="#999999">
		<TR>
		<TD align="LEFT" valign="TOP" width="100%">
		<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA" color="#ffffff"><b>
		&nbsp;Your Unadvertiser Information
		</b></FONT></TD>		
		</TR>
		</TABLE>
		
<table cellspacing="0" cellpadding="1" border="0" width="571">
	<tr>
	<td bgcolor="#666666">
	
<table cellpadding="10" cellspacing="0" border="0" width="569">
	<tr><td bgcolor="#cccccc">
	

<table cellpadding="0" cellspacing="0" border="0">
	<tr><td>

<table CELLPADDING="5" CELLSPACING="0" BORDER="0" WIDTH="100%">

<TR>
<TD align="left">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Old Password
</FONT><br>
<INPUT TYPE="password" NAME="password" VALUE="$password"></TD>

<TD align="left">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Update URL
</FONT><br>
<INPUT TYPE="text" NAME="author_url" VALUE="$author_url"></TD>


</TR>

<TR>
<TD align="left">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
New Password
</FONT><br>
<INPUT TYPE="password" NAME="new_password" VALUE=""></TD>


<TD align="left">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Update Name
</FONT><br>
<INPUT TYPE="text" NAME="author_name" VALUE="$author_name"></TD>
</TR>


</table>

</td><td valign="bottom" align="center">
<font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#666666">
Use this form to change your <b><font color="#999999">UN</font><font color="#666666">AD</font></b>vertiser 
 information. 
</font>
<br>
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.infoupdate.submit();" onMouseOver="swapON(\\'updateinfo\\');" onMouseOut="swapOFF(\\'updateinfo\\');">' +
        '<img src="/images/orbit/buttons/updateinfo.gif" border="0" width="143" height="19" name="updateinfo" vspace="10"></a>')
</script>
<noscript>
<input type="image" alt="update your gallery" border="0" src="/images/orbit/buttons/updateinfo.gif">
</noscript>
</form>


</td></tr></table>


</TD>
</TR>
</table>
</TD>
</TR>
</table>

_____EoI2_____
}




print <<"_____EoI2_____";
<br clear="all"><br>
<br><br>
</TD>
   
<!-- RIGHT QUOTE -->

	<TD valign="top" align="left" nowrap><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/right_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

	<TD width="10">&nbsp;</TD>
   
</TR></table>

</td></tr><tr><td valign="top" bgcolor="#ffffff">


<!-- BEGIN FOOTER TABLE -->

<br>
<table width="98%" border="0" cellpadding="0" cellspacing="0"><TR> 
	<TD width="85" bgcolor="#ffffff"><img src="/trans.gif" width="85" height="1"></td>
     <TD nowrap align="left" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/" class="gray" title="undesign. a plan for all seasons."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">&lt;&lt; home </font></a>
		<br clear="all">
		</TD>
	<TD width="100%" align="center" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="http://jam.media.org/" class="gray" title="meet the undesigners."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">[ <b>\&amp\;\*\$\#\@~!</b> ] </font></a>
		<br clear="all">
	</TD>
     <TD nowrap align="right" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/orbit/" class="gray" title="undesign in orbit."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">orbit \&gt;\&gt;</font></a>
		<img src="/trans.gif" width="30" height="1"> 
		<br clear="all">
		</TD>
  </TR></table>
  <br><br>
  
</td></tr></table>

  
  </BODY>
</HTML>

_____EoI2_____
###
###
### End of Main Screen
###


exit(0);

}
