Version: 0.1

Type: Full Script

Category: Networking

License: GNU General Public License

Description: See it working at 'www.huw.ukso.com' email me at 'huwsy@jediknights.co.uk' Will allow any visitor to send an email to the specified email address, without allowing them to know the email address. Based on php, no sql required. There is 2 files required, they are all included in the 1 upload file. 1st. hml.inc (containing layout info) 2nd. webmaster.php (the core file, and exercutable file)



#################
# html.inc file #
#################
<?

$above_title = <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<Base target="_parent">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
EOT;

$below_title = <<<EOT
<style>
.end {
	 font-size : large;
	 font-family : serif;
	 color : Navy;
	 text-align : center;
}
.end:hover {
	 color : Blue;	
}
.res {
	 font-size : x-small;
	 font-family : sans-serif;
	 color : Green;
	 text-align : center;
}
.Error {
	 font-family : sans-serif;
	 color : Red;
	 text-align : center;
}
.textbox  {
	BORDER-COLOR : black;
	FONT-FAMILY : Arial, Helvetica, sans-serif;
	FONT-SIZE : 8pt;
}
.button  {
	BACKGROUND-COLOR : yellow;
	COLOR : black;
	FONT-FAMILY : Arial, Helvetica, sans-serif;
	FONT-SIZE : 8pt;
	HEIGHT : 20px;
	WIDTH : 50px;
}
BODY {
	MARGIN: 2px;
	text-align : center;
}
.Dark {
	BACKGROUND-COLOR: #ff7700;
}
.Norm {
	BACKGROUND-COLOR: #FFAA00;
}
.Light {
	BACKGROUND-COLOR: #FFFF00;
}
.Main {
	BORDER-RIGHT: #ff7700 2px solid;
	FONT-SIZE: 1px;
	BORDER-LEFT: #ff7700 2px solid;
}
.Main TD {
	PADDING-RIGHT: 0px;
	PADDING-LEFT: 0px;
	PADDING-BOTTOM: 0px; 
	PADDING-TOP: 0px;
}
.Content {
	PADDING-RIGHT: 6px;
	PADDING-LEFT: 6px; 
	FONT-SIZE: 10pt; 
	PADDING-BOTTOM: 6px; 
	COLOR: navy; 
	PADDING-TOP: 6px; 
 	FONT-FAMILY : Serif;
	BACKGROUND-COLOR: #FFFFD0;
	text-align : center;
}
.Blocks {
	MARGIN-LEFT: -1px;
	MARGIN-RIGHT: -1px;
	COLOR: #ffffff;
}
.Blocks TD {
	FONT-SIZE: 1px;
	WIDTH: 4px;
	HEIGHT: 4px;
}
A:hover {
	COLOR: green;
}
A {
	COLOR : red;
	FONT-WEIGHT : bold;
	TEXT-DECORATION : none;
} 
.tabledata {
	MARGIN-TOP: -17px;
	FONT-FAMILY: Arial;
	FONT-SIZE: 10px;
	PADDING-RIGHT: 6px
}
.select  {
	BACKGROUND-COLOR : yellow;
	COLOR : black;
	FONT-FAMILY : Arial, Helvetica, sans-serif;
	FONT-SIZE : 8pt;
}
.scroll  {
	FONT-FAMILY : Verdana, Arial, Helvetica, sans-serif;
	FONT-SIZE : 8pt;
}
</STYLE>
</HEAD>
<BODY bgColor=#ffffff>
EOT;

$body_html = <<<EOT

<TABLE border=0 cellPadding=0 cellSpacing=0 class=Main width="100%">
  <TBODY>
  <TR vAlign=center>
    <TD align=right class=Norm noWrap style="HEIGHT: 20px">
      <TABLE border=0 cellPadding=0 cellSpacing=0 class="blocks">
        <TBODY>
        <TR>
          <TD class="Light"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark" rowSpan=5 style="WIDTH: 120px">&nbsp;</TD></TR>
        <TR>
          <TD class="Norm"></TD>
          <TD class="Light"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD></TR>
        <TR>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Light"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD></TR>
        <TR>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Light"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD></TR>
        <TR>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Light"></TD>
          <TD class="Dark"></TD></TR></TBODY></TABLE>
      <DIV class="tabledata" align="left">
          <a href="http://www.huw.ukso.com/">HOME</a> -
          <a href="http://www.huw.ukso.com/guest.php?view=view&results=10&page=1&app=guest">MESSAGE BOARD / GUEST BOOK</a> -
          <a href="http://www.huw.ukso.com/srch.php?news=true">TECH NEWS</a> -
          <a href="http://www.huw.ukso.com/guest.php?view=view&results=5&page=1&app=pole">VISITOR POLES</a> -
          <a href="http://www.huw.ukso.com/games/ship.html">BATTLESHIP</a> -
          <a href="http://www.huw.ukso.com/games/bout.html">BREAKOUT</a> -
          <a href="http://www.huw.ukso.com/games/chess.html">CHESS</a> -
          <a href="http://www.huw.ukso.com/games/conc.html">CONCENTRATION</a> -
          <a href="http://www.huw.ukso.com/games/con4.html">CONNECT4</a> -
          <a href="http://www.huw.ukso.com/games/hanoi.html">HANOI</a> -
          <a href="http://www.huw.ukso.com/games/peg.html">PEGS</a> -
          <a href="http://www.huw.ukso.com/games/reversi.html">REVERSI</a> -
          <a href="http://www.huw.ukso.com/games/ox.html">TIC-TAC-TOE</a>
      </DIV>
EOT;

$Post_links = <<<EOT

      </TD></TR>
  <TR>
    <TD class="content" bgcolor="#FFFFD0">
      <DIV align="center">
EOT;

$search_script =  <<<EOT

<form action="srch.php" name="search" onSubmit="return srch.php">
	<input type="text" name="q" size="10" class="textbox" id="input"><br>
	<input type="Submit" name="submit" value="Go" class="button">
	<input type="Reset" name="reset" value="Reset" class="button">
</form>
EOT;

$base_html = <<<EOT

      </DIV>
    </TD></TR>
  <TR vAlign=center>
    <TD align=left class=Norm noWrap style="HEIGHT: 20px">
      <TABLE border=0 cellPadding=0 cellSpacing=0 class="blocks">
        <TBODY>
        <TR>
          <TD class="Dark" rowSpan=5 style="WIDTH: 120px">&nbsp;</TD>
          <TD class="Dark"></TD>
          <TD class="Light"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD></TR>
        <TR>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Light"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD></TR>
        <TR>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Light"></TD>
          <TD class="Norm"></TD>
          <TD class="Norm"></TD></TR>
        <TR>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Light"></TD>
          <TD class="Norm"></TD></TR>
        <TR>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Dark"></TD>
          <TD class="Light"></TD></TR></TBODY></TABLE>
      <DIV class="tabledata" align="right">
        <script language="JavaScript" type="text/javascript">
          build = document.lastModified;		
          document.write("Build : " + build + " - ");
        </script>
        <a href='http://www.huw.ukso.com/'>www.huw.ukso.com</a>
      </DIV>
    </TD>
  </TR>
  </TBODY>
</TABLE>
EOT;

$body_base = <<<EOT

</BODY>
</HTML>
EOT;

$fp = fopen("visitor.log","r");
$ippost = fread($fp,15);
fclose($fp);
$ip = getenv("REMOTE_ADDR");
$posted_on = date('F d, Y g:i a');
$write = "ip info: " . $ip . " - server time: " . $posted_on . "\n";
$fp = fopen("visitor.log","a");
fwrite($fp,$write);
fclose($fp);

?>

######################
# webmaster.php file #
######################
<?
/*  ====================================================================
 *  Copyright (c) 2001 Huw, HuwSy@jediknights.co.uk
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of the code in any formmust retain the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer.
 *
 *  2. The name of the author may not be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *  ==================================================================== 
 *  DONOT ATTEMPT TO MODIFY THIS FILE UNLESS
 *  YOU ARE ENTIERLY SURE OF THE ATTECTS IT
 *  MAY HAVE ON THE SCRIPTS PREFORMANCE.
 *
 *  ALL VARIABLES WITH A HASHED (#) COMMENT
 *  FOLLOWING MAY BE REQUIRED TO BE MODIFIED
 *  FOR CORRECT OPERATIONS UPON YOUR OWN
 *  SERVER.
 */

include "html.inc"; # where visuals are pulled from
$sendto = "huwsy@jediknights.co.uk"; # send email to this address
$cur_file_name = "webmaster.php"; # current file name
global $name;
global $email;
global $subject;
global $info;

if (! ($email && $info) )
{
	$title = "Send A Message To The Webmaster";
	$body_print_data = <<<EOT
<form action="$cur_file_name" name="webmaster" onSubmit="return $cur_file_name">
<table align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td align="right" valign="top">Name :</td>
    <td valign="top"><input type="text" name="name" size="30" class="textbox" id="input"></td>
</tr>
<tr>
    <td align="right" valign="top">*Email :</td>
    <td valign="top"><input type="text" name="email" size="30" class="textbox" id="input"></td>
</tr>
<tr>
    <td align="right" valign="top">Subject :</td>
    <td valign="top"><input type="text" name="subject" size="30" class="textbox" id="input"></td>
</tr>
<tr>
    <td align="right" valign="top">*Feedback :</td>
    <td valign="top"><textarea cols=50 rows=4 name="info" class="textbox"></textarea></td>
</tr>
<tr>
    <td align="right" valign="top"></td>
    <td valign="top">
      <input type="Submit" name="submit" value="Submit" class="button">
      <input type="Reset" name="reset" value="Reset" class="button"><br>
      <center>
        * = Required fields
      </center>
    </td>
</tr>
</table>
</form>
EOT;

}
else
{
	$sub = "Webmaster: " . $subject;
	$message = "Name : " . $name . "\nEmail : " . $email . "\n\n" . $info;
	$exploded_line = explode("@",$email);
	$exploded_line1 = explode(".",$exploded_line[1]);
	if ($exploded_line1[1])
	{
		mail($sendto, $sub, $message);
		$title = "Email Sent";
		$body_print_data = "Thank you for taking the time to compleat the form";
	}
	else
	{
		$title = "Email Not Sent";
		$body_print_data = "Your email address is not valid.<br>\nPlease try again with a valid email address.";
	}
}

echo $above_title;
echo "\n<TITLE>" . $title . "</TITLE>\n";
echo $below_title;
echo $body_html;
echo $Post_links;
echo "\n      <div class='end'>" . $title . "</div>\n";
echo $body_print_data;
echo $base_html;
echo $body_base;

?>