<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function get_calender_events() { $params = array(); /*Get current date*/ $current_date = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key = "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...
<?php
if(isset($_POST['sub1']))
{
$First_Name=$_POST['First_Name'];
$Surname=$_POST['Surname'];
$Email=$_POST['Email'];
$Telephone=$_POST['Telephone'];
$temp = $_POST['chk1'];
if(!empty($temp)){
//$files = array();
foreach($temp as $key=>$val){
if($val=='1'){
$files[] = "file_1.pdf";
}else if($val=='2'){
$files[] = "file_2.pdf";
}
else if($val=='3'){
$files[] = "file_3.pdf";
}
}
}
// array with filenames to be sent as attachment
//$files = array("file_1.pdf","");
// email fields: to, from, subject, and so on
$cc = "testdemo075@gmail.com";
$to = "testdemo356@gmail.com";
$from = "testdemo356@gmail.com";
$subject ="My subject";
$message= "<table width='862' border='0' cellspacing='0' cellpadding='0' align='center' style='font-family:Arial, Helvetica, sans-serif;'>
<tr><td style='border-bottom:3px solid #3a4a76;' ><img src='http://www.yomptesting.com/hairformen/mailimg/email-header.png'/></td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><p>Hello,</p></td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><p>Please See Bellow Download Franchise Form Details.</p></td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> First Name :$First_Name</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Surname Name :$Surname</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Telephone :$Telephone</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Email :$Email</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Message :$Message</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Desired Location :$Desired</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Address :$Address</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Experience :$Experience</td></tr>
<tr><td width='15%' height='25' align='left' valign='middle'></tr></tr>
<tr><td width='15%' height='25' align='left' valign='middle'></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Form submitted on <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>$email_date</span> at <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>$email_time</span> from host <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>$emailip</span></td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Please contact them as soon as possible.</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Kind Regards</td></tr>
<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><strong>Hair For Men</strong></td></tr>
<tr><td width='15%' height='25' align='left' valign='middle'></tr>
<tr><td colspan='2'><img src='http://www.yomptesting.com/hairformen/mailimg/email-footer.png' /></td></tr>
</table>";
$headers = "From: $from";
// boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
$headers .= "\r\nCc: $cc";
$headers .= "\r\nBcc: $bcc";
// multipart boundary
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
$message .= "--{$mime_boundary}\n";
// preparing attachments
for($x=0;$x<count($files);$x++){
$file = fopen($files[$x],"rb");
$data = fread($file,filesize($files[$x]));
fclose($file);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" .
"Content-Disposition: attachment;\n" . " filename=\"$files[$x]\"\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
$message .= "--{$mime_boundary}\n";
}
// send
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<p>mail sent to $to!</p>";
} else {
echo "<p>mail could not be sent!</p>";
}
}
?>
<form action="" method="post">
<div class="form">
<h1>Which Of These 'How To' Guides Would you Like to Today ?</h1>
<ul>
<li class="pink">
<label>How to get Visibility <br />on whats coming?</label>
<input type="checkbox" name="chk1[]" value="1"/>
<div class="cls"></div>
</li>
<li class="purpal">
<label>How to generate <br />more cash?</label>
<input type="checkbox" name="chk1[]" value="2"/>
<div class="cls"></div>
</li>
<li class="green">
<label>How to improve <br />profitability?</label>
<input type="checkbox" name="chk1[]" value="3"/>
<div class="cls"></div>
</li>
<li><input type="text" name="First_Name" id="" placeholder="First Name" required/></li>
<li><input type="text" name="Surname" id="" placeholder="Surname Name" required/></li>
<li><input type="email" name="Email" id="" placeholder="E-mail" required /></li>
<li><input type="text" name="Telephone" id="" placeholder="Telephone" required/></li>
<li><input type="submit" name="sub1" value="" /></li>
</ul>
</div>
</form>
<br />
========================================================================================================
file upload
<?php
if(isset($_POST['career']))
{
error_reporting("E_ALL");
$subject =$_POST['subject'];
$email_date=date("d-m-Y");$email_time=date("H:i:s A");
$emailip= $_SERVER['SERVER_ADDR'];
//$to = get_option( 'admin_email' );
$to="testdemo356@gmail.com";
//$to="Steve.brierley@mi-dat.com,ian.mcinnes@mi-dat.com";
$from = $_POST['Email'];
$subject = "CV";
$message= "<table width='862' border='0' cellspacing='0' cellpadding='0' align='center' style='font-family:Arial, Helvetica, sans-serif;'>";
$message.= "<tr><td style='border-bottom:3px solid #3a4a76;' ><img src='http://artifexonline.dyndns.biz:8081/projects/wp_mi-dat/code/mailimg/midate-herder.png'/></td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><p>Hello Mi-dat,</p></td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><p>Please See Bellow Attachment File.</p></td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> First Name :".$_POST['FirstName']."</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Last Name :".$_POST['LastName']."</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> E-mail :".$_POST['Email']."</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> Telephone :".$_POST['Telephone']."</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'> I would like to apply for :".$_POST['body']."</td></tr>";
$message.= "<tr><td width='15%' height='25' align='left' valign='middle'></tr></tr>";
$message.= "<tr><td width='15%' height='25' align='left' valign='middle'></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Form submitted on <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>".$email_date."</span> at <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>".$email_time."</span> from host <span style='font-size:14px; font-family:Arial, Helvetica, sans-serif; color:#3AB08F;'>".$emailip."</span></td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Please contact them as soon as possible.</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>Kind Regards</td></tr>";
$message.= "<tr><td height='25' colspan='2' align='left' valign='middle' style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'><strong>Your Website Team.</strong></td></tr>";
$message.= "<tr><td width='15%' height='25' align='left' valign='middle'></tr>";
$message.= "<tr><td colspan='2'><img src='http://artifexonline.dyndns.biz:8081/projects/wp_mi-dat/code/mailimg/midate-footer.png' /></td></tr>";
$message.= "</table>";
//$cc = $_POST['cc'];
//$bcc = "Emma@yomp.biz";
$bcc = "testdemo075@gmail.com";
// Temporary paths of selected files
$file1 = $_FILES['file1']['tmp_name'];
$file2 = $_FILES['file2']['tmp_name'];
// File names of selected files
$filename1 = $_FILES['file1']['name'];
$filename2 = $_FILES['file2']['name'];
// array of filenames to be as attachments
$files = array($file1, $file2);
$filenames = array($filename1, $filename2);
// include the from email in the headers
$headers = "From: $from";
// boundary
$time = md5(time());
$boundary = "==Multipart_Boundary_x{$time}x";
// headers used for send attachment with email
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$boundary}\"";
$headers .= "\r\nCc: $cc";
$headers .= "\r\nBcc: $bcc";
// multipart boundary
$message = "--{$boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
$message .= "--{$boundary}\n";
// attach the attachments to the message
for($x=0; $x<2; $x++){
$file = fopen($files[$x],"r");
$content = fread($file,filesize($files[$x]));
fclose($file);
$content = chunk_split(base64_encode($content));
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" .
"Content-Disposition: attachment;\n" . " filename=\"$filenames[$x]\"\n" .
"Content-Transfer-Encoding: base64\n\n" . $content . "\n\n";
$message .= "--{$boundary}\n";
}
// sending mail
$sendmail = mail($to, $subject, $message, $headers);
// verify if mail is sent or not
if ($sendmail) {
echo "Your Resume Sent successfully!";
} else {
echo "Error occurred. Try again!";
}
}
?>
<style>
#fileinput { position: absolute; left: -9999em; }
#fileinput1 { position: absolute; left: -9999em; }
#link:hover { text-decoration: underline; cursor: pointer; }
</style>
<div class="career-form">
<h1>Send Us your CV</h1>
<form action="" method="post" enctype="multipart/form-data">
<ul>
<li><input type="text" id="" value="" name="FirstName" placeholder="First Name" required></li>
<li><input type="text" id="" value="" name="LastName" placeholder="Last Name" required></li>
<li><input type="email" id="" value="" name="Email" placeholder="E-mail" required></li>
<li><input type="tele" id="" value="" name="Telephone" placeholder="Telephone" required></li>
<li><input type="text" id="" value="" name="body" placeholder="Previous Experience " required></li>
<li>
<div class="radio">
<input name="file1" type="file" id="fileinput"/>
<label>Curriculum Vitae</label>
<label for="fileinput" id="link" class="trigger-file-input"><img src="panel-logo.png" /></label>
<div class="cls"></div>
</div>
<div class="upload"></div>
<div class="cls"></div>
</li>
<li>
<div class="radio">
<input name="file2" type="file" id="fileinput1" />
<label>Cover Letter</label>
<label for="fileinput1" id="link" class="trigger-file-input"><img src="panel-logo.png" /></label>
<div class="cls"></div>
</div>
<div class="upload"></div>
<div class="cls"></div>
</li>
<li><input type="submit" id="" name="career" value="SUBMIT"></li>
</ul>
</form>
</div>
Comments
Post a Comment