...

View Full Version : Email PHP Code



coolbud012
11-25-2010, 07:54 AM
Hello Every One,Here I am writing the full code of signup file of my website.
I need That while someone registers A welcome mail should be sent to that user.It should contain image if wanted and graphics and simple text and links..Please help me..And any coder here who have knowledge of php and smarty plz contact me..

Here is the php code of that file,the website is made with php and smarty so there is a language file too..


<?
$page = "signup";
include "header.php";

if (isset ( $_POST ['task'] )) {
$task = $_POST ['task'];
} else {
$task = "";
}

// SET ERROR VARS
$is_error = 0;
$error_message = "";

// IF USER IS ALREADY LOGGED IN, FORWARD TO USER HOME PAGE
if ($user->user_exists != 0) {
header ( "Location: user_home.php" );
exit ();
}

// PROCESS INPUT FROM FIRST STEP (OR DOUBLE CHECK VALUES), CONTINUE TO SECOND STEP (OR SECOND STEP PROCESSING)
if ($task == "register") {
$signup_email = $_POST ['signup_email'];
$signup_mobile = $_POST ['signup_mobile'];
$signup_firstname = $_POST ['signup_firstname'];
$signup_lastname = $_POST ['signup_lastname'];
$signup_birthday = $_POST ['Birthday_Day'];
$signup_birthmonth = $_POST ['Birthday_Month'];
$signup_birthyear = $_POST ['Birthday_Year'];
$signup_birthtime = "$signup_birthyear-$signup_birthmonth-$signup_birthday";
$signup_gender = $_POST ['signup_gender'];

// CHECK TERMS OF SERVICE AGREEMENT IF NECESSARY
if ($setting [setting_signup_tos] != 0) {
$signup_agree = $_POST ['signup_agree'];
if ($signup_agree != 1) {
$is_error = 1;
$error_message = $signup [1];
}
}

// RETRIEVE AND CHECK SECURITY CODE IF NECESSARY
if ($setting [setting_signup_code] != 0) {
session_start ();
$code = $_SESSION ['code'];
if ($code == "") {
$code = randomcode ();
}
$signup_secure = $_POST ['signup_secure'];

if ($signup_secure != $code) {
$is_error = 1;
$error_message = $signup [2];
}
}

if ($signup_gender != 1 && $signup_gender != 2) {
$is_error = 1;
$error_message = "Please select your gender.";
}

if (! $signup_birthday || ! $signup_birthmonth || ! $signup_birthyear) {
$is_error = 1;
$error_message = "Please select your birth day";
}

if ($signup_firstname == "") {
$is_error = 1;
$error_message = "Please enter your first name";
}

if ($signup_lastname == "") {
$is_error = 1;
$error_message = "Please enter your last name";
}

// CHECK USER ERRORS
$new_user = new swimsms_user ();
$new_user->user_account ( $signup_email, $signup_mobile );
if($new_user->is_error == 1 && is_error == 0){
$is_error = $new_user->is_error;
$error_message = $new_user->error_message;
}

// IF THERE IS NO ERROR, CONTINUE TO STEP 2 OR PROCESS STEP 2
if ($is_error == 0) {

$result = 1;

$new_user->user_create ( $signup_email, $signup_mobile, "", $signup_firstname, $signup_lastname, $signup_birthtime, $signup_gender );

// IF THERE WAS AN ERROR, GO BACK TO STEP 1
} else {
$task = "register";
}

} else {
$result = 0;
$signup_birthtime = "--";
}

// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign ( 'result', $result );
$smarty->assign ( 'error_message', $error_message );
$smarty->assign ( 'signup_email', $signup_email );
$smarty->assign ( 'signup_mobile', $signup_mobile );
$smarty->assign ( 'signup_firstname', $signup_firstname );
$smarty->assign ( 'signup_lastname', $signup_lastname );
$smarty->assign ( 'signup_birthtime', $signup_birthtime );
$smarty->assign ( 'signup_gender', $signup_gender );
$smarty->assign ( 'signup_secure', $signup_secure );
$smarty->assign ( 'signup_agree', $signup_agree );

include "footer.php";
?>

coolbud012
11-27-2010, 05:01 PM
no1 to help me?

StrangeCoder
11-27-2010, 06:28 PM
http://php.net/manual/en/function.mail.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum