. */ include("./include/include.php"); admin_header(); if( !in_array("application_invite", $_SESSION['sess_functions']) ) { echoln("You are not authorized to see this page."); }else { echoln("

Invite person

"); echoln("Via this form, you can send invitation mails to people to apply for the Agora. The invitations are personal (name and body cannot be changed)."); $error = false; if( $_SERVER['REQUEST_METHOD']=="POST" ) { // Form submitted, check for errors if( strlen($_POST['firstname'])<2 OR strlen($_POST['firstname'])>50 ) { echoln("
Please provide a first name (maximum 50 characters)."); $error = true; } if( strlen($_POST['lastname'])<2 OR strlen($_POST['lastname'])>50 ) { echoln("
Please provide a family name (maximum 50 characters)."); $error = true; } $query = "SELECT `BodyCode` FROM `ab_bodies` WHERE `BodyCode`='".addslashes($_POST['bodycode'])."'"; if( @mysql_num_rows( $res=doquery($query) )!=1 ) { echoln("
Please select a body."); $error = true; } if( !check_email($_POST['email']) ) { echoln("
Please provide a valid e-mail address."); $error = true; } if( !$error ) { // Send invitation echoln("

"); if( ! $mail = new Mail($setup['MailReturnpath'], $_POST['email']) ) { echoln("Failed sending mail. Unable to connect to mail server."); }else { $mail->setSubject("Invitation to apply for ".$setup['SetupEventType']); $mail->addHeader("To", Mail::encodeHeader(utf8_decode($_POST['firstname']." ".$_POST['lastname']))." <".$_POST['email'].">"); $mail->addHeader("From", "\"Chair team AEGEE-Europe\" <".$setup['MailChair'].">"); $mail->addHeader("X-Content", "invitation to participant"); $mail->addHeader("X-ApplicationID", $r = mt_rand(0, 5000)); $mail->addHeader("X-Signature", get_signature("invitation to participant", $r)); $m = "Hello ".$_POST['firstname'].",\n\n"; $m.= "Althought the applications for the upcoming ".$setup['SetupEventType']." are closed at the moment, the Chair team gives you the possibility to apply. To apply, please go to the following url:\n\n"; $m.= "\thttps://".$FULL_URL."invite.php?g=".urlencode($_POST['firstname'])."&f=".urlencode($_POST['lastname'])."&b=".strtolower($_POST['bodycode'])."&c=".substr(md5(SECRET.$_POST['firstname'].$_POST['lastname'].strtolower($_POST['bodycode'])), 0, 12)."\n\n"; $m.= "Please keep in mind that this invitation is personal and cannot be handed over to other people.\n\n"; $m.= "We hope to receive your application soon.\n\n"; $m.= "With kind regards,\n\nChair team of AEGEE-Europe"; if( $_SESSION['sess_uid']>0 ) $m .= "\n\n\n-- This invitation has been send by ".$_SESSION['sess_name']." --"; $mail->setMessage($m); switch( $mail->send(true) ) { case Mail::MAIL_OK: echoln("Invitation send successfully."); break; case Mail::MAIL_QUEUE: echoln("Invitation has been queued for sending successfully (will be sent later)."); break; default: echoln("Failed sending invitation to applicatant. Please try again later or contact the webmaster."); } } echoln("

"); echoln("

Send another invitation.

"); } } if( $error OR $_SERVER['REQUEST_METHOD']!="POST" ) { // Error in input, or GET request: show form echoln("

"); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln("
Invitation
First name:
Family name:
Body:
E-mail:
"); echoln("

"); echoln("
"); } } admin_footer(); ?>