Location: PHPKode > scripts > WH Social > wh_social/modules/invite.inc.php
<?php

    echo '<div class="content_left">
    <div id="breadcrumb">
        <ul class="crumbs">
            <li class="first"><a href="index.php" style="z-index:9;"><span></span>' . $lang['index'] . '</a></li>
            <li><a href="invite.php" style="z-index:8;">' . $lang['invite_friends'] . '</a></li>
        </ul>
    </div>
    </div>

    <div class="content_right">';

        include('modules/search.inc.php');
    echo '</div>

    <div class="clear_long"></div>';

    $ret = 1;

    echo '<div class="main_menu">';

        $ret = include 'framework/templates/'.$main_content['menu'];
    echo '<div id="line"></div>';

        $ret = include 'framework/templates/'.$main_content['infos'];
    echo '</div>';

    echo '<div class="main_content">';

    $goto = 'invite.php';
    $autoforward = 3;

    echo '<h1 class="p_space">' . $lang['invite_friends'] . '</h1>';

    if($_SERVER['REQUEST_METHOD'] != 'POST') {

    echo '<form method="post" action="">
    <p><input type="text" name="name" id="name" size="40" required maxlength="100" class="textfields"> ' . $lang['name'] . '</p>
    <p><input type="text" name="email" id="email" size="40" required maxlength="120" class="textfields"> ' . $lang['your_email'] . '</p>
    <p><input type="text" name="toname" id="toname" size="40" required maxlength="100" class="textfields"> ' . $lang['name_of_receiver'] . '</p>
    <p><input type="text" name="toemail" id="toemail" size="40" required maxlength="120" class="textfields"> ' . $lang['email_of_receiver'] . '</p>
    <p><input type="submit" name="' . $lang['invite_send'] . '" id="' . $lang['invite_send'] . '" class="buttons" value="' . $lang['invite_send'] . '"></p>
    </form>';

    	}else{

    	$name = htmlentities($_POST['name']);
    	$email = htmlentities($_POST['email']);
    	$toname = htmlentities($_POST['toname']);
    	$toemail = htmlentities($_POST['toemail']);

    	$errors = array();

    	if(isset($_POST['name'])) {
            if(trim($_POST['name']) == "") {
            $errors[] = '<p>' . $lang['name_must_be_filled'] . '.</p>';
            }

        if(isset($_POST['email'])) {
        $email = htmlentities($_POST['email']);

        if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) {
        $errors[] = '<p>' . $lang['email_must_be_filled'] . '.</p>';
        }

        	}else{
        	$errors[] = '<p>' . $lang['email_must_be_filled'] . '.</p>';
        	}

        if(isset($_POST['toname'])) {
        	if(trim($_POST['toname']) == "") {
        	$errors[] = '<p>' . $lang['enter_re_name'] . '.</p>';
        	}

        if(isset($_POST['toemail'])) {
        $toemail = htmlentities($_POST['toemail']);

        if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $toemail)) {
        $errors[] = '<p>' . $lang['enter_re_email'] . '.</p>';
        }

        	}else{
        	$errors[] = '<p>' . $lang['enter_re_email'] . '.</p>';
        	}

    if(!empty($errors)) {

    echo '<p class="false">' . $lang['not_filled_in_all_fields'] . ' - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
    echo '<ul>';

    foreach($errors as $key => $value) {
    echo '<li>' . $value . '</li>';
    }
    echo '</ul>';

    	}else{

    	$mailto = $toemail;
    	$subject = '' . $name . ' ' . $lang['has_invited_you'] . '!';
    	$message = '' . $name . ' ' . $lang['has_invited_you'] . ':
-----------------------------------------------------------------
' . $url . ' - ' . $title . '
-----------------------------------------------------------------

' . $lang['invitation_sender_mail'] . ': ' . $email . '';

    $headers = 'From:' . $email . '';

    if(mail("$mailto", "$subject", "$message", "$headers")) {

    echo '<p class="success">' . $lang['invitation_success'] . '!</p>
    <meta http-equiv="refresh" content="' . $autoforward . '; URL=' . $goto . '"><p>';

        }else{

        echo '<p class="false">' . $lang['invitation_false'] . '</p>';
        }
    }

    }}}

?>
Return current item: WH Social