<?php /** * Copyright 2005 Wim van Ravesteijn * * This file is part of AEGEE-Europe Photo Page. * * AEGEE-Europe Photo Page is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * AEGEE-Europe Photo Page is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with AEGEE-Europe Photo Page. If not, see * <http://www.gnu.org/licenses/>. */ include("./include/include.php"); page_header(); if( $_SERVER["REQUEST_METHOD"]=="POST" ) { $Name=get_var('name'); $Email=get_var('email'); $Subject=get_var('subject'); $Message=get_var('message'); $error=false; if( strlen($Name)<3 ) { echoln("<span class=\"error\">Please provide your name.</span><br>"); $error=true; } if( strlen($Email)<3 OR !check_email($Email) ) { echoln("<span class=\"error\">Please provide a valid e-mail address.</span><br>"); $error=true; } if( strlen($Subject)<3 ) { echoln("<span class=\"error\">Please provide a subject.</span><br>"); $error=true; } if( strlen($Message)<16 ) { echoln("<span class=\"error\">Please provide a message.</span><br>"); $error=true; } if( $error ) { echoln("<p>"); }else { $To = WEBMASTER_MAIL; $Subject="[AEGEE Photo Page] ".$Subject; $Message.="\n\n\n============================================"; $Message.="\nThis mail was sent from the AEGEE photo page"; $Headers="From: \"".$Name."\" <".$Email.">"; if( mail($To, $Subject, $Message, $Headers) ) { // ok echoln("<span class=\"ok\">Your mail has been sent to the webmaster.</span><p>"); $Name=""; $Email=""; $Subject=""; $Message=""; }else { // failed echoln("<span class=\"error\">Failed sending your mail. Please try again later.</span><p>"); } } } echoln("<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\" name=\"webmaster\">"); echoln(" <table>"); echoln(" <tr class=\"even\">"); echoln(" <th colspan=\"2\">Send an e-mail to the webmaster</th>"); echoln(" </tr>"); echoln(" <tr class=\"even\">"); echoln(" <td>Your name:</td>"); echoln(" <td><input type=\"text\" name=\"name\" value=\"".$Name."\" size=\"50\"></td>"); echoln(" </tr>"); echoln(" <tr class=\"even\">"); echoln(" <td>Your e-mail:</td>"); echoln(" <td><input type=\"text\" name=\"email\" value=\"".$Email."\" size=\"50\"></td>"); echoln(" </tr>"); echoln(" <tr class=\"even\">"); echoln(" <td>Subject:</td>"); echoln(" <td><input type=\"text\" name=\"subject\" value=\"".$Subject."\" size=\"50\"></td>"); echoln(" </tr>"); echoln(" <tr class=\"even\">"); echoln(" <td valign=\"top\">Message:</td>"); echoln(" <td><textarea name=\"message\" cols=\"50\" rows=\"8\">".$Message."</textarea></td>"); echoln(" </tr>"); echoln(" <tr class=\"even\">"); echoln(" <td colspan=\"2\"><br/><input type=\"submit\" value=\"Send\"> <input type=\"reset\" value=\"Cancel\"></td>"); echoln(" </tr>"); echoln(" </table>"); echoln("</form>"); page_footer(); ?>