I have email content with data=> name, email, phone , description and attachment.
I am able send the email with all the data to email. But what I want is , Actually I want to send attachments to the email content. But in my code I just sending the links to the email content. But If I click on that links it is not downloading. I need to send attachments to the email and also when I click on that it should download. How to resolve this. Plese somebody help me.
Below is code,
$name = $this->request->post['name'];
$email = $this->request->post['email'];
$description = $this->request->post['description'];
$phone = $this->request->post['phone'];
$upload_base_dir="image/service-images/";
$upload_time_dir=time(); // setup directory name
$upload_dir = $upload_base_dir.$upload_time_dir;
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0775, true); //create directory if not exist
}
foreach($_FILES['attachment']['error'] as $k=>$v)
{
$uploadfile = $_FILES['attachment']['name'][$k];
move_uploaded_file($_FILES['attachment']['tmp_name'][$k],$upload_dir."/".$uploadfile);
$subject = 'Service Request';
$email_header ='<html style="color: rgb(34, 34, 34); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); max-width: 575px; line-height: 18px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"><head><meta name="viewport" content="width=device-width" /><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body bgcolor="#FFFFFF" text="#000000" style="color: rgb(34, 34, 34); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); max-width: 575px; line-height: 18px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"><table style="font-family:Helvetica,Arial,sans-serif;background:#EFEDED;" cellpadding="0" cellspacing="0" bgcolor="#EFEDED" border="0" width="100%"><tbody><tr><td align="center"><table width="96%" cellpadding="0" cellspacing="0"border="0"><tbody><tr><td style="border-top:5px solid #1e96d3; background:#fff;margin:0; padding:20px; border-spacing:0px;">';
$email_footer = '</td></tr><tr><td style="margin:0; padding:15px 0;"><table style="font-family:Arial, Helvetica,sans-serif;font-size:11px;color:#999999;" cellpadding="0" cellspacing="0" border="0" width="100%"><tbody> <tr>
<td style="font-family:Arial, Helvetica,sans-serif; margin:0; font-size:11px; padding:8px 0 0 0;">This email was intended for Inf. </td></tr><tr>
<td style="font-family:Arial, Helvetica,sans-serif; margin:0; font-size:11px; padding:8px 0 0 0;"></td></tr></tbody></table></td></tr></tbody></table></td>
</tr></tbody></table></body></html>';
$body = $email_header.'<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;">
<p style="font-size:14px; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-weight: bold; line-height: 1.5em; margin: 0px; padding: 0.4em; text-align: left;">'.$subject.'</p></td></tr><tr><td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;"><p style="color:#000; font-size:13px; margin:0; font-family:Arial, Helvetica,sans-serif;"><strong>Dear Sir/Madam,</strong><br></p></td></tr><tr><td style="margin:0; padding:0 0 5px 0;"><p style="font-size:13px; background-color: rgb(234, 234, 234); color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-weight: bold; line-height: 1.5em; margin: 0px; padding: 0.4em; text-align: left;">Details:</p></td></tr><tr><td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;"><table style="font-family:Helvetica,Arial,sans-serif; font-size:12px; font-weight:bold; margin-top:10px; width:100%"><tbody>
<tr><td style="padding:4px 0;">Name</td>
<td>:</td><td style="font-weight:normal;">'.$name.'</td></tr>
<tr><td style="padding:4px 0;">Email Address</td>
<td>:</td><td style="font-weight:normal;">'.$email.'</td></tr>
<tr><td style="padding:4px 0;">Phone</td><td>:</td><td style="font-weight:normal;">'.$phone.'</td></tr>
<tr><td style="padding:4px 0;">Description</td><td>:</td><td style="font-weight:normal;">'.$description.'</td></tr>
<tr><td style="padding:4px 0;">Attachments</td><td>:</td><td style="font-weight:normal;">';
foreach($_FILES['attachment']['error'] as $k=>$v)
{
$uploadfile = $_FILES['attachment']['name'][$k];
move_uploaded_file($_FILES['attachment']['tmp_name'][$k],$upload_dir."/".$uploadfile);
$images[] = $_FILES['attachment']['name'][$k];
$count=0;
foreach($images as $image){
$count++;
}
if($_SERVER['HTTP_HOST'] == "localhost"){
$body .= '<a href='.'localhost'."/inf/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "192.168.1.156"){
$body .= '<a href='.'192.168.1.156'."/inf/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "floretmedia.net"){
$body .= '<a href='."http://floretmedia.net/temp"."/inf/".$upload_dir."/".$image' download>'.$image.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "www.arbour.in" || $_SERVER['HTTP_HOST'] == "arbour.in"){
$body .= '<a href='.'http://www.arbour.in'."/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
}
$body .= '</td></tr></tbody></table></td></tr></table>'.$email_footer.'';
//echo $body;die;
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($email);
$mail->setSender($name);
$mail->setSubject($subject);
$mail->setHtml($body);
$mail->send();
you can attach the file to the body like this
$body .= '</td></tr></tbody></table></td></tr></table>'.$email_footer.'';
$filename = 'myfile';
$path = 'your path goes here';
$file = $path . "/" . $filename;
$content = file_get_contents($file);
$content = chunk_split(base64_encode($content));
$body .= $content . "\r\n";
// send the mail
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($email);
$mail->setSender($name);
$mail->setSubject($subject);
$mail->setHtml($body);
$mail->send();
Related
Please I do not really know what I am doing wrong here. I have a page for image upload. It's working perfectly on localhost but as soon as I uploaded it to remote server, It's not working as I want it. I have changed the folder permission, I have changed the directly still not working. It's not giving me any error. it's showing file uploaded successfully but anytime I check the folder, It's empty. Please help me out. This my code below.
if(isset($_POST['upload']))
{
$tmp_name = $_FILES['passport']['tmp_name'];
if (empty($tmp_name) == false){
$name = $_FILES['passport']['name'];
$type = $_FILES['passport']['type'];
$size = $_FILES['passport']['size'];
list($width, $height, $typeb, $attr) = getimagesize($tmp_name);
if($width<=160 || $height<=160)
{
if($type=='image/jpeg' || $type=='image/jpg' || $type=='image/png')
{
if($size<='20000')
{
if(!get_magic_quotes_gpc())
{
$name = addslashes($name);
$extract = fopen($tmp_name, 'r');
$content = fread($extract, $size);
$content = addslashes($content);
fclose($extract);
//Place image in the folder
$newname="$studentID.jpg";
move_uploaded_file($_FILES['passport']['tmp_name'],"../passports/$newname");
$msg = "<center><p style ='color: #4F8A10; background-color: #DFF2BF; border-radius:.5em; width: 350px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase; padding-left: 12px'>Passport uploaded successfully.. Click the link below to continue</p></center>";
} else {
$uploaderror = "<p style='color: #D8000C; background-color: #FFBABA; border-radius:.5em; width: 300px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; margin-left: auto; margin-right: auto; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase'>Error has occured... Please try again</p>";
}
} else {
$uploaderror = "<p style='color: #D8000C; background-color: #FFBABA; border-radius:.5em; width: 300px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; margin-left: auto; margin-right: auto; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase'>$name is more than 20kb</p>";
}
} else {
$uploaderror = "<p style='color: #D8000C; background-color: #FFBABA; border-radius:.5em; width: 300px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; margin-left: auto; margin-right: auto; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase'>$type is not in acceptable format</p>";
}
} else {
$uploaderror = "<p style='color: #D8000C; background-color: #FFBABA; border-radius:.5em; width: 300px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; margin-left: auto; margin-right: auto; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase'>$name should be 160px * 160px</p>";
}
} else {
$uploaderror = "<p style='color: #D8000C; background-color: #FFBABA; border-radius:.5em; width: 300px; border: 1px solid #D8D8D8; padding: 5px; border-radius: 5px; margin-left: auto; margin-right: auto; font-family: Arial; font-size: 11px; text-transform: uppercase; text-align: center; text-transform: uppercase'>Please choose a file to upload</p>";
}
}
i have a php file to generate otp and sending html mail to user but i am unable to insert php variable it beacuse i am getting html mail content from other file please help me to do it
i want to insert below variable in html
$otpemail
$name
here is my php code
if (isset($_POST['resend'])) {
$uid = $_SESSION['usr_id'];
$otpemail=mt_rand(100000,999999);
$subject = "Email verification";
$email_from= "Go Alert <verification#goalert.in>";
$email_reply = "feedback#goalert.in";
$headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_reply."\r\n" .'X-Mailer: PHP/' . phpversion();
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$user =$db->getemail($uid);
if($user != NULL){
$email = $user['email'];
$name = $user['name'];
$status = "Not Verified";
$messageemail = file_get_contents('email.html');
$user=$db->resendemailotp($uid,$name,$email,$otpemail,$status);
#mail($email, $subject, $messageemail, $headers);
$errormsg1 = "Email Sent Please Check Spam if not recived";
}else {
$errormsg1 = "Error in Sending Email";
}
}
my html mail file codes are
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" style="background: #f0f0f0; min-height: 100%;" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="width=device-width" name="viewport" />
</head>
<body style="box-sizing: border-box; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; min-width: 100%; padding: 0; text-align: left; width: 100% !important;">
<table class="body" style="background: #f0f0f0; border-collapse: collapse; border-spacing: 0; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; height: 100%; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td align="center" class="center" style="border-collapse: collapse !important; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;" valign="top">
<center data-parsed="" style="min-width: 580px; width: 100%;">
<table class="container text-center" style="background: #fefefe; border-collapse: collapse; border-spacing: 0; margin: 0 auto; padding: 0; text-align: center; vertical-align: top; width: 580px;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td style="border-collapse: collapse !important; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;">
<!-- This container adds the gap at the top of the email -->
<table class="row grey" style="background: #f0f0f0; border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;"> </th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table class="container text-center" style="background: #fefefe; border-collapse: collapse; border-spacing: 0; margin: 0 auto; padding: 0; text-align: center; vertical-align: top; width: 580px;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td style="border-collapse: collapse !important; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;">
<!-- Main email content -->
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!-- Logo -->
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<center data-parsed="" style="min-width: 532px; width: 100%;"><a align="center" class="text-center" href="http://www.goalert.in" style="color: #f7931d; font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 1.3; margin: 0; padding: 0; text-align: left; text-decoration: none;"> <img alt="Logo Image" class="swu-logo" src="https://www.goalert.in/test/assets/images/logo.png" style="border: none; clear: both; display: block; height: auto; max-width: 100%; outline: none; padding: 15px 0px 0px 0px; text-decoration: none; width: 170px;" /> </a></center>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row masthead" style="background: #212121; border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!-- Masthead -->
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<h1 class="text-center" style="color: #f7931d; font-family: Helvetica, Arial, sans-serif; font-size: 34px; font-weight: normal; line-height: 1.3; margin: 0; margin-bottom: 10px; padding: 35px 0px 15px 0px; text-align: center; word-wrap: normal;">Download our Application</h1>
<center data-parsed="" style="min-width: 532px; width: 100%;"><a align="center" class="text-center" href="https://play.google.com/store/apps/details?id=in.com.goalert" style="color: #f7931d; font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 1.3; margin: 0; padding: 0; text-align: left; text-decoration: none;"> <img align="center" alt="Masthead Image" class="text-center" src="https://www.goalert.in/test/assets/images/play.png" style="border: none; clear: both; display: block; float: none; margin: 0 auto; max-width: 100%; outline: none; text-align: center; text-decoration: none; width: auto;" valign="bottom" /> </a></center>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;"> <!--This container adds the gap between masthead and digest content -->
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!-- Email copy -->
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<h5 style="color: inherit; font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: normal; line-height: 1.3; margin: 0; margin-bottom: 10px; padding: 0; text-align: left; word-wrap: normal;">Hi, {{name}}</h5>
<p style="color: #777777 !important; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; margin-bottom: 10px; padding: 0; text-align: left;">Thankyou for suscribing with Go Alert.Now receive all application notifiaction into your mailbox.For faster information download our official mobile application from here</p>
<br />
<hr style="border-bottom: 1px solid #cacaca; border-left: 0; border-right: 0; border-top: 0; clear: both; height: 0; margin: 20px auto; max-width: 580px;" />
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<h5 class="text-center" style="color: inherit; font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: normal; line-height: 1.3; margin: 0; margin-bottom: 10px; padding: 0; text-align: center; word-wrap: normal;">Your OTP is</h5>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!-- Coupon code box -->
<th class="small-12 large-4 columns first" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 8px; text-align: left; width: 177.33333px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
</th>
</tr>
</table>
</th>
<th class="grey small-12 large-12 columns" style="background: #f0f0f0; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 8px; padding-right: 8px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<br />
<h5 class="text-center" style="color: inherit; font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: normal; line-height: 1.3; margin: 0; margin-bottom: 10px; padding: 0; text-align: center; word-wrap: normal;" valign="middle">2ob3-32cc39-2pe3-291ab</h5>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
<th class="small-12 large-4 columns last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 8px; padding-right: 16px; text-align: left; width: 177.33333px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!-- Call to Action -->
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<center data-parsed="" style="min-width: 532px; width: 100%;">
<br align="center" class="text-center" />
<br align="center" class="text-center" />
<table class="button text-center" style="border-collapse: collapse; border-spacing: 0; margin: 0 0 16px 0; padding: 0; text-align: center; vertical-align: top; width: auto !important;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td style="border-collapse: collapse !important; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td style="background: #f7931d; border: 2px solid #f7931d; border-collapse: collapse !important; color: #fefefe; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; width: auto !important; word-wrap: break-word;">Download Our Application </td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<!--This row adds the gap between masthead and digest content -->
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;"> </th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- / End main email content -->
<table class="container text-center" style="background: #fefefe; border-collapse: collapse; border-spacing: 0; margin: 0 auto; padding: 0; text-align: center; vertical-align: top; width: 580px;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<td style="border-collapse: collapse !important; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;">
<table class="row grey" style="background: #f0f0f0; border-collapse: collapse; border-spacing: 0; display: table; padding: 0; position: relative; text-align: left; vertical-align: top; width: 100%;">
<tbody>
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th class="small-12 large-12 columns first last" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0 auto; padding: 0; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; text-align: left; width: 564px;">
<table style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;">
<tr style="padding: 0; text-align: left; vertical-align: top;">
<th style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0; text-align: left;">
<p class="text-center footercopy" style="color: #777777 !important; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 19px; margin: 0; margin-bottom: 10px; padding: 20px 0px; text-align: center;">© Copyright 2016 Go Alert. All Rights Reserved.</p>
</th>
<th class="expander" style="color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 15px; font-weight: normal; line-height: 19px; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;">
</th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>
Quick/dirty, use the output buffering system:
foo.html
<div><?php echo $var ?></div>
main script:
ob_start();
$var = 'hi mom!';
include('foo.html'); // executes any php code in the file
$html = ob_end_clean();
Alternatively, you could use a simple templating system:
foo.html:
<div>%VAR%</div>
main script:
$raw_html = file_get_contents('foo.html');
$var = 'hi mom!';
$complete_html = str_replace('%VAR%', $var, $raw_html);
I am trying to send mail to list of users with unpaid orders.
I am fetching orders in foreach loop and also have added inline style to the elements. The style works great in front end . See below:
But on email there are some links that are not styled.
Here is my code :
foreach($sid as $si) {
$message .="<li style='padding: 7px;width:90%;'>Order Number: ".$si."<A style='background: #E68126; color: #fff ; text-decoration: none; padding: 5px 10px; float: right;' href='#'>View Order</A></li><br>";
}
I am using php mail function with custom headers.
And the full html :
$message = // contents of report in $message
"
<html>
<head></head>
<body>
<div style='background:rgb(242,242,242) none repeat scroll 0% 0%;font-family:Verdana, Geneva, sans-serif;padding:6% 10%;font-size:14px;font-weight:400;color:rgb(0, 0, 0);'>
<div style='background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 2px solid rgb(0, 0, 0); padding: 20px;font-family:Verdana, Geneva, sans-serif;'>
<IMG style='padding: 10px 0px;' SRC='sample.png'/>
<hr style:'border:1px solid #000;'><BR><h2 style='color: rgb(0, 0, 0);font-weight:bold;font-size:22px;text-align:center;text-transform:uppercase;font-family:Verdana, Geneva, sans-serif;' >Order Unpaid</h2>
<span style='display: block; font-size: 18px; color: rgb(0, 0, 0); padding: 10px 0px;font-family:Verdana, Geneva, sans-serif;'>Hello ,</span>
<span style='display: block; color: rgb(0, 0, 0), 120); padding: 10px 0px;font-family:Verdana, Geneva, sans-serif;'>There are unpaid orders in your account.</span>";
foreach($sid as $si) {
$message .="<li style='padding: 7px;width:90%;'>Order Number: ".$si."<a style='background: #E68126; color: #fff !important; text-decoration: none !important; padding: 5px 10px !important; float: right !important;' href='https://www.test.com/index.php/order/view/id/".$si."'>View Order</a></li><br>";
}
$message .= "<span style='display: block; padding: 10px 0px 20px; rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'><br>You can view orders in your account information.<br></span><br> <A STYLE='color: #ffffff; background: #E68126 ; text-decoration: none; padding: 12px 19px; border-radius: 6px; width: 200px; text-align:center; margin: 3px auto; display: block; font-size: 15px; text-transform: uppercase;font-family:Verdana, Geneva, sans-serif;' href='https://www.test.com/index.php/order/index/type/1' target=_blank>View Account</A><span style='display: block; padding: 20px 0px 10px; color: rgb(0, 0, 0); line-height: 25px;font-family:Verdana, Geneva, sans-serif;'><br>If the request was sent not by you, on your petition or without your permission please inform to our security service via support#test.com.</span><span style='display: block; padding: 30px 0px 0px; font-size: 12px; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'>Happy shopping, </span><span style='display: block; padding: 9px 0px 10px; font-size: 13px; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'>Always welcome Test team</span><hr style:'border:1px solid #000;'><span style='display: block; padding: 9px 0px 10px; font-size: 14px; text-align:center; color: rgb(0, 0, 0);font-family:Verdana, Geneva, sans-serif;'> © 2015 Test technologies ltd</span></div></div></body></html>";
Not sure why it's doing this, but I'm getting the following syntax error: "Unexpected "<" on Line1".
I can't seem to find out what is the problem, I've already tried troubleshooting the problem earlier before posting this.
Here's my code:
<?php
include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php'); // Include local class lib
$sess = new SessionData(); // Creates session object
//$sess->CheckValidFBSession();
if($sess->CheckValidSession()){
header('Location: home.php');
}
$log= new log($_SERVER["PHP_SELF"], $_GET, $_POST, $_SERVER['HTTP_REFERER'] );
$stats=new Statistics();
$totalusers=$stats->totalscope();
?>
<html xmlns:fb="//www.facebook.com/2008/fbml">
<style>
.title {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
text-decoration:none;
}
.larger {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:none;
}
.larger-a {
//color:#D19160;
color:#538ADC;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:none;
}
.larger-a:hover {
//color:#FF0000;
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:underline;
}
select {
font-family: Tahoma;
font-size: 11px;
}
.white {
color:#FFFFFF;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: none;
text-decoration:none;
}
.blue {
color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: none;
text-decoration:none;
}
.red {
color:#FF0000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.menu {
color:#FFFFFF;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.menu:hover {
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.alternate {
color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.alternate:hover {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:underline;
}
a {
//color:#D19160;
color:#538ADC;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
a:hover {
//color:#FF0000;
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:underline;
}
.bordertable {
border-width: 1px;
border-color: #3B5998;
border-style: solid;
}
.dashedtable {
border-width: 1px;
border-color: #3B5998;
border-style: dashed;
}
.bottomborder {
border-style:solid;
border-color: #3B5998;
border-top-width:0px;
border-bottom-width:1px;
border-right-width:0px;
border-left-width:0px;
}
.one-column {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
border-style:solid;
border-color: #3B5998;
border-top-width:1px;
border-bottom-width:0px;
border-right-width:1px;
border-left-width:1px;
}
.text {
font-Family: Serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.td0 {
color:#000000;
background-color:#D9DFEA;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.td1 {
color:#000000;
background-color:#86A1CE;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.schedule_table {
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 1px;
border-top-width: 1px;
border-style: solid;
border-color: #000000;
}
.top-border {
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-width: 1px;
border-style: solid;
border-color: #3B5998;
}
.schedule {
color:#000000;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 0px;
border-top-width: 0px;
border-style: solid;
border-color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.border-td {
color:#000000;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-width: 1px;
border-style: solid;
border-color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
td {
color:#000000;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.inputtext {
border:double;
border-width:1;
border-color:#555555;
background-color:#D9DFEA;
font-size:11px;
color: #000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
}
.inputsubmit {
border-style:solid;
border-top-width:1px;
border-bottom-width:2px;
border-right-width:2px;
border-left-width:1px;
border-top-color:#D9DFEA;
border-bottom-color:#3B5998;
border-right-color:#3B5998;
border-left-color:#D9DFEA;
background-color:#538ADC;
font-family:Tahoma, arial;
font-size:11px;
color:#FFFFFF;
font-weight:none;
}
a img{
border:none !important;
}
#container{
margin:0 auto;
width:500px;
padding:40px;
text-align:left;
background-color:#fff;
}
#lightbox h2{
margin:0 0 1em 0;
}
#lightbox h3{
color:#FF713F;
}
#lightbox.done p{
color:#333;
}
#form{
text-align:left;
margin:25px;
}
#form ul{
list-style:none;
}
#form li{
margin:0 0 1em 0;
}
#form textarea{
width:100%;
height:150px;
}
#definition{
margin:25px;
}
.highlight{
background-color:#FEFFAF;
}
#lightbox{
display:none;
position: absolute;
top:50%;
left:50%;
z-index:9999;
width:400px;
height:200px;
padding:10px;
margin:-220px 0 0 -250px;
border:1px solid #fff;
background:#FDFCE9;
text-align:left;
}
#lightbox[id]{
position:fixed;
}
#overlay{
display:none;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:5000;
background-color:#000;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
#overlay[id]{
position:fixed;
}
#lightbox.done #lbLoadMessage{
display:none;
}
#lightbox.done #lbContent{
display:block;
}
#lightbox.loading #lbContent{
display:none;
}
#lightbox.loading #lbLoadMessage{
display:block;
}
#lightbox.done img{
width:100%;
height:100%;
}
<!--
#8EA7C5 - blue
#D9DFEA - grey
59 89 152 (#3B5998)
217 223 234 (#D9DFEA)
83 138 220 - link normal (#538ADC)
119 201 243 - link down (#77C9F3)
-->
</style>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $sess->fbappid; ?>',
session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<title>Kuarrel | Welcome to Kuarrel!</title>
<meta name="description" content="Kuarrel is an online directory that connects people from throughout the world." />
<meta name="keywords" content="kuarrel, chaibear, chai, sa-mp, sa:mp, 2014" />
<meta name="Generator" content="JB engine designed" />
<meta name="robots" content="index, follow" />
<meta name="OriginalPublicationDate" content="2014/03/12/01:37:22">
<meta name="Headline" content="Kuarrel | Welcome to Kuarrel!">
<meta name="IFS_URL" content="/index.php">
<meta name="contentFlavor" content="PAGE">
<meta name="CPS_SITE_NAME" content="Kuarrel | Welcome to Kuarrel">
<meta name="CPS_SECTION_PATH" content="Index">
<meta name="CPS_ASSET_TYPE" content="STY">
<meta name="CPS_PLATFORM" content="HighWeb">
<meta name="CPS_AUDIENCE" content="US">
<meta property="og:title" content="Kuarrel is an online directory that connects people from throughout the world.">
<meta property="og:type" content="website">
<meta property="og:description" content="Kuarrel is an online directory that connects people from throughout the world.">
<meta property="og:image" content="http://www.kuarrel.tk/images/logo-right.jpg">
<meta property="og:url" content="http://www.kuarrel.tk/index.php">
<meta property="og:site_name" content="Kuarrel">
<!-- sO3vWw3hwrnxdrwPGTKy2ZOW6yU -->
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.Canvas.setAutoResize();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script src="//connect.facebook.net/en_US/all.js#appId=194568130593245&xfbml=1"></script>
<center>
<table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700>
<tr><td>
<table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%>
<tr><td width=350 bgcolor=#3B5998>
<img src='images/logo-left.jpg'></td>
<td><table cellspacing=0 cellpadding=0 border=0 width=100%><tr><td>
<table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr><td><a href='register.php'><img alt='Register' src='images/logo-right.jpg' border=0></a></td>
<td width=100% bgcolor=#3B5998> </td></tr></table></td></tr>
<tr><td><table cellspacing=0 cellpadding=4 border=0 width=100%><tr height=21>
<!--<td bgcolor=#3B5998 width=10> </td>-->
<?PHP
if(!$sess->CheckValidSession()){
include('modules/default/topnav.php');
}else{
include('modules/loggedin/topnav.php');
}
?> <td bgcolor=#3B5998 width=100%> </td>
</tr></table></td>
</tr></table>
</td></tr></table>
</td></tr>
<tr><td><table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr><td valign=top>
<table cellspacing=0 cellpadding=0 border=0 width=105>
<tr><td>
<?PHP
if(!$sess->CheckValidSession()){
include('modules/default/leftnav.php');
}else{
include('modules/loggedin/leftnav.php');
}
?>
</td></tr>
</table>
</td><td width=595 valign=top>
<table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td>
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr><td class='white' bgcolor=#3B5998>Welcome to Kaurrel!</td></tr></table><center><p class='title'>[ Welcome to Kaurell ]<br>
<table cellspacing=0 cellpadding=0 border=0 width=95%>
<tr><td class='larger'><?=(!empty($_GET['error']));?>"<span style='color:red;font-size:16px;'>Facebook login has been disabled for today, please try again tomorrow.</span><br><br>Kaurell is an online directory that connects people from Facebook through social networks at colleges.
<p>We have opened up Kaurell for popular consumption at <b>all colleges and universities</b>. If you are not part of a college or university, you will be added to the default Kaurell network.
<p>Your account is limited to your own college or university.
<p>You can use Kaurell to:
<br> <b>•</b> Search for people at your school
<br> <b>•</b> Find out who are in your classes
<br> <b>•</b> Look up your friends' friends
<br> <b>•</b> See a visualization of your social network
<p>To get started, click below to register with your Facebook account.<!--<br><font size="+1">Join the <?=$totalusers?> people at Kaurell today.</font>-->
<center>
<?php if(strlen($_SESSION['notpartofacollege'])>2){
echo "<b>".$_SESSION['notpartofacollege']."</b>";
}
?>
<div id="fb-root"></div>
<center><input class='inputsubmit' type="button" value='Register' onclick='javascript:document.location="register.php";'> <input class='inputsubmit' type="button" value=' Login ' onclick='javascript:document.location="login.php";'>
<br> </td></tr></table> </td></tr></table>
</td></tr></table>
<center>
<?PHP include('modules/default/bottomnav.php'); ?>
</center><br>
</td></tr></table>
Thanks to anyone who can figure out what's going on here!
try to correct
<?=(!empty($_GET['error']))?
to
<?=(!empty($_GET['error']));?>
also </span><br><br>":""?> to </span><br><br>
This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
I'm getting this error again and again i try everything but i can't found solution
Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/xxxx/forum/index.php:90) in /home/pappu/public_html/forum/index.php on line 93
here is my index.php code
<?php
include_once("connect.php");
session_start();
?>
<html>
<head>
<title>MyForum</title>
<style type="text/css">
body {
background-color: #333;
margin-top: 150px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.content {
background-color: #666;
width: 960px;
margin-right: auto;
margin-left: auto;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
padding: 20px;
}
.content .categories {
width: 700px;
background-color: #333;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
margin: 0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
color: #FFF;
}
.categories .community_heading {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-variant: normal;
text-transform: capitalize;
color: #CCC;
margin: 0px;
padding-top: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-left: 14px;
font-size: 18px;
font-weight: bold;
}
.content .categories hr {
background-color: #666;
height: 3px;
border: 0px;
width: 700px;
margin: 0px;
}
.content .categories .cat_links {
border-bottom-width: thin;
border-bottom-style: solid;
border-bottom-color: #000;
padding-top: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-left: 14px;
font-size: 14px;
color: #000;
}
.content .categories .cat_a {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 18px;
font-variant: normal;
text-transform: capitalize;
color: #777;
text-decoration: none;
}
.content .categories .cat_a:hover {
text-decoration: underline;
color: #DDD;
}
.content .categories .desc {
margin: 0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #CCC;
}
</style>
</head>
<body>
<?php
if(!isset($_SESSION['password']))
{
include_once("Location:header.php");
}
else
{
header("Location:member.php");
}
?>
<div class="content">
<div class="categories">
<h3 class="community_heading">Community</h3>
<hr />
<?php
$query = "SELECT * FROM categories ORDER BY cat_id ASC";
$result = mysql_query($query) or die(mysql_error());
$categories = "";
if(mysql_num_rows($result) > 0 )
{
while($row = mysql_fetch_array($result))
{
$cat_id = $row['cat_id'];
$cat_title = $row['cat_title'];
$cat_desc = $row['cat_description'];
$categories .="
<div class='cat_links'>
<a href='view_category?cid=".$cat_id."' class='cat_a'>$cat_title</a>
<p class='desc'>$cat_desc</p>
</div>";
}
echo $categories ;
}
else
{
}
?>
</div>
</div>
</body>
</html>
You can't call Header() after including ANY code that is outputted to the page. You need to rewrite what you are doing so the Header() call is above all the HTML code.