there is error of Fatal error: Cannot redeclare domain_exists(); - php

I have error when trying to insert data in databse, i get the following message:
Notice: Undefined variable: host in C:\wamp64\www\email_verify\index.php on line 53
Notice: Undefined variable: target in C:\wamp64\www\email_verify\index.php on line 53
Notice: Undefined variable: target_ip in C:\wamp64\www\email_verify\index.php on line 53
Fatal error: Cannot redeclare domain_exists() (previously declared in C:\wamp64\www\email_verify\index.php:13) in C:\wamp64\www\email_verify\index.php on line 13
how can i solve it....?
<?php
include_once('config.php');
if(isset($_POST["email_verify_btn"])) {
$email = $_POST["email_verify"];
if(strpos($email,"\n")) {
$text = explode("\n",$email);
foreach ($text as $abc) {
function domain_exists($abc)
{
$domain = substr(strrchr($abc, "#"), 1);
$arr = #dns_get_record($domain, DNS_MX);
if ($arr[0]['host'] == $domain && !empty($arr[0]['target'])) {
return $arr[0]['target'];
}
}
if(domain_exists($abc)){
$domain = substr(strrchr($fetch_email, "#"), 1);
$data = #dns_get_record($domain, DNS_MX);
if($data) {
$status = "email id is valid";
}
if (is_array($data) || is_object($data)) {
foreach ($data as $key1) {
$host = $key1['host'];
$target = $key1['target'];
$target_ip = gethostbyname($key1['target']);
}
}
} else {
$status = "mx recored not exist";
}
$c_by = 1;
$c_date = date('Y-m-d H:i:s');
$c_ip = $_SERVER['REMOTE_ADDR'];
$insert = $connect->query("INSERT INTO `email_verify_list`(`primary_email`,`host_name`,`target`,`target_ip`,`session`,`created_by`, `created_date`, `created_ip`) VALUES ('$abc','$host','$target','$target_ip','$c_ip','$c_by','$c_date','$c_ip')");
if($insert) {
$_SESSION['date_time'] = $c_date;
echo "<script>alert('successfully');</script>";
} else {
echo "<script>alert('!!!!!not successfully');</script>";
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta charset="utf-8"/>
<title>BULK EMAIL VARIFIER</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"/>
<link rel="apple-touch-icon" href="pages/ico/60.png">
<link rel="apple-touch-icon" sizes="76x76" href="pages/ico/76.png">
<link rel="apple-touch-icon" sizes="120x120" href="pages/ico/120.png">
<link rel="apple-touch-icon" sizes="152x152" href="pages/ico/152.png">
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta content="" name="description"/>
<meta content="" name="author"/>
<link href="assets/plugins/pace/pace-theme-flash.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/bootstrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/switchery/css/switchery.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="pages/css/pages-icons.css" rel="stylesheet" type="text/css" />
<link class="main-stylesheet" href="pages/css/pages.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 9]>
<link href="assets/plugins/codrops-dialogFx/dialog.ie.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->
</head>
<body class="fixed-header ">
<div id="rootwizard" class="m-t-50">
<ul class="nav nav-tabs nav-tabs-linetriangle nav-tabs-separator nav-stack-sm">
<li class="active">
<a data-toggle="tab" href="#tab1"><span>EMAIL VERIFY</span></a>
</li>
</ul>
<form method="post" action="" >
<div class="tab-content">
<div class="tab-pane padding-20 active slide-left" id="tab1">
<div class="row row-same-height">
<div class="col-md-12">
<div class="padding-30">
<div class="row clearfix">
<div class="col-sm-3">
<div class="form-group form-group-default">
<label><font size="2">ENTER YOUR EMAIL <span class="glyphicon glyphicon-envelope"></span></font></label><br>
<textarea cols="43" rows="9" name="email_verify" style="border-color:white;border-width:thin;padding:4pt;" multiple/></textarea><br>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3">
<button type="submit" name="email_verify_btn" class="btn btn-lg btn-info" style="padding:11pt;width:200px;"/><span><b><font size="2">SUBMIT</font></b></span></button>
</div>
</div> <br><br>
<div class="row clearfix">
<div class="col-sm-12">
<table width="100%" class="table ">
<tr class="success">
<th>PRIMARY EMAIL <span class="glyphicon glyphicon-envelope"></span></th>
<th>HOST NAME</th>
<th>TARGET</th>
<th>TARGET IP</th>
<th>STATUS</th>
</tr>
<?php
$select = $connect->query("SELECT * from `email_verify_list` where session='".$_SESSION['date_time']."' order by id");
while($row = $select->fetch_assoc()) {
?>
<tr>
<td><?php echo $row['primary_email']; ?></td>
<td><?php echo $row['host_name']; ?></td>
<td><?php echo $row['target']; ?></td>
<td><?php echo $row['target_ip']; ?></td>
<td><?php echo $row['status']; ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="assets/plugins/pace/pace.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/modernizr.custom.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrapv3/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery/jquery-easy.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-unveil/jquery.unveil.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-bez/jquery.bez.min.js"></script>
<script src="assets/plugins/jquery-ios-list/jquery.ioslist.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-actual/jquery.actual.min.js"></script>
<script src="assets/plugins/jquery-scrollbar/jquery.scrollbar.min.js"></script>
<script type="text/javascript" src="assets/plugins/classie/classie.js"></script>
<script src="assets/plugins/switchery/js/switchery.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap3-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-autonumeric/autoNumeric.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-tag/bootstrap-tagsinput.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-inputmask/jquery.inputmask.min.js"></script>
<script src="assets/plugins/bootstrap-form-wizard/js/jquery.bootstrap.wizard.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="assets/plugins/summernote/js/summernote.min.js" type="text/javascript"></script>
<script src="assets/plugins/moment/moment.min.js"></script>
<script src="assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="assets/plugins/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>
<script src="pages/js/pages.min.js"></script>
<script src="assets/js/form_wizard.js" type="text/javascript"></script>
<script src="assets/js/scripts.js" type="text/javascript"></script>
<script src="assets/js/demo.js" type="text/javascript"></script>
<script>
window.intercomSettings = {
app_id: "xt5z6ibr"
};
</script>
</body>
</html>

Don't declare the function inside the loop.
Put this:
function domain_exists($abc)
{
$domain = substr(strrchr($abc, "#"), 1);
$arr = #dns_get_record($domain, DNS_MX);
if ($arr[0]['host'] == $domain && !empty($arr[0]['target'])) {
return $arr[0]['target'];
}
}
... before this line:
foreach ($text as $abc) {
Next, you need to declare the variables $target and $target_ip on the same level as you're trying to use them, i.e. on the same level as this line:
$insert = $connect->query("INSERT INTO `email_verify_list`(`primary_email`,`host_name`,`target`,`target_ip`,`session`,`created_by`, `created_date`, `created_ip`) VALUES ('$abc','$host','$target','$target_ip','$c_ip','$c_by','$c_date','$c_ip')")

Related

Bulk Email Validator works but not properly

I wish to either make use of a freely available email validator (software, script or online service). There's work but when I insert more than one email at that time only one email verifies which I insert last and other email does not verify. Only one email verifies. How can I do it?
My code:
<?php
include_once('config.php');
if(isset($_POST["email_verify_btn"])) {
$email = $_POST["email_verify"];
if(strpos($email,"\n")) {
$text = explode("\n",$email);
} else {
$text = array($email);
}
function domain_exists($text)
{
$domain = substr(strrchr($text, "#"), 1);
$arr = #dns_get_record($domain, DNS_MX);
if ($arr[0]['host'] == $domain && !empty($arr[0]['target'])) {
return $arr[0]['target'];
}
}
foreach ($text as $abc) {
$domain = "";
$target = "";
$target_ip = "";
if(filter_var($abc, FILTER_VALIDATE_EMAIL)) {
if(domain_exists($abc)){
$domain = substr(strrchr($abc, "#"), 1);
$data = #dns_get_record($domain, DNS_MX);
if (is_array($data) || is_object($data)) {
foreach ($data as $key1) {
$host = $key1['host'];
$target = $key1['target'];
$target_ip = gethostbyname($key1['target']);
}
}
if($data) {
$status = "email id is valid";
}
} else {
$status = "mx recored not exist";
}
} else {
$status = "not in syntax";
}
$c_by = 1;
$c_date = date('Y-m-d H:i:s');
$c_ip = $_SERVER['REMOTE_ADDR'];
$insert = $connect->query("INSERT INTO `email_verify_list`(`primary_email`,`host_name`,`target`,`target_ip`,`session`,`status`,`created_by`, `created_date`, `created_ip`) VALUES ('$abc','$domain','$target','$target_ip','$c_date','$status','$c_by','$c_date','$c_ip')");
if($insert == 1) {
$_SESSION['date_time'] = $c_date;
} else {
echo "<script>alert('!!!!!not successfully');</script>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta charset="utf-8"/>
<title>BULK EMAIL VARIFIER</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"/>
<link rel="apple-touch-icon" href="pages/ico/60.png">
<link rel="apple-touch-icon" sizes="76x76" href="pages/ico/76.png">
<link rel="apple-touch-icon" sizes="120x120" href="pages/ico/120.png">
<link rel="apple-touch-icon" sizes="152x152" href="pages/ico/152.png">
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta content="" name="description"/>
<meta content="" name="author"/>
<link href="assets/plugins/pace/pace-theme-flash.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/bootstrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/switchery/css/switchery.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="pages/css/pages-icons.css" rel="stylesheet" type="text/css" />
<link class="main-stylesheet" href="pages/css/pages.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 9]>
<link href="assets/plugins/codrops-dialogFx/dialog.ie.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->
</head>
<body class="fixed-header ">
<div id="rootwizard" class="m-t-50">
<ul class="nav nav-tabs nav-tabs-linetriangle nav-tabs-separator nav-stack-sm">
<li class="active">
<a data-toggle="tab" href="#tab1"><span>EMAIL VERIFY</span></a>
</li>
</ul>
<form method="post" action="" >
<div class="tab-content">
<div class="tab-pane padding-20 active slide-left" id="tab1">
<div class="row row-same-height">
<div class="col-md-12">
<div class="padding-30">
<div class="row clearfix">
<div class="col-sm-3">
<div class="form-group form-group-default">
<label><font size="2">ENTER YOUR EMAIL <span class="glyphicon glyphicon-envelope"></span></font></label><br>
<textarea cols="43" rows="9" name="email_verify" style="border-color:white;border-width:thin;padding:4pt;" multiple/></textarea><br>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3">
<button type="submit" name="email_verify_btn" class="btn btn-lg btn-info" style="padding:11pt;width:200px;"/><span><b><font size="2">SUBMIT</font></b></span></button>
</div>
</div> <br><br>
<div class="row clearfix">
<div class="col-sm-12">
<table width="100%" class="table ">
<tr class="success">
<th>PRIMARY EMAIL <span class="glyphicon glyphicon-envelope"></span></th>
<th>HOST NAME</th>
<th>TARGET</th>
<th>TARGET IP</th>
<th>STATUS</th>
</tr>
<?php
$select = $connect->query("SELECT * from `email_verify_list` where session='".$_SESSION['date_time']."' order by id");
while($row = $select->fetch_assoc()) {
?>
<tr>
<td><?php echo $row['primary_email']; ?></td>
<td><?php echo $row['host_name']; ?></td>
<td><?php echo $row['target']; ?></td>
<td><?php echo $row['target_ip']; ?></td>
<td><?php echo $row['status']; ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="assets/plugins/pace/pace.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/modernizr.custom.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrapv3/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery/jquery-easy.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-unveil/jquery.unveil.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-bez/jquery.bez.min.js"></script>
<script src="assets/plugins/jquery-ios-list/jquery.ioslist.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-actual/jquery.actual.min.js"></script>
<script src="assets/plugins/jquery-scrollbar/jquery.scrollbar.min.js"></script>
<script type="text/javascript" src="assets/plugins/classie/classie.js"></script>
<script src="assets/plugins/switchery/js/switchery.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap3-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-autonumeric/autoNumeric.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-tag/bootstrap-tagsinput.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-inputmask/jquery.inputmask.min.js"></script>
<script src="assets/plugins/bootstrap-form-wizard/js/jquery.bootstrap.wizard.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="assets/plugins/summernote/js/summernote.min.js" type="text/javascript"></script>
<script src="assets/plugins/moment/moment.min.js"></script>
<script src="assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="assets/plugins/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>
<script src="pages/js/pages.min.js"></script>
<script src="assets/js/form_wizard.js" type="text/javascript"></script>
<script src="assets/js/scripts.js" type="text/javascript"></script>
<script src="assets/js/demo.js" type="text/javascript"></script>
<script>
window.intercomSettings = {
app_id: "xt5z6ibr"
};
</script>
</body>
</html>
I think , you are not using strpos function in correct way.
you can use this way . Because strpos return also 0 value if any string found at zero position . and return FALSE if search string not found
Also note that string positions start at 0, and not 1.
if(strpos($email,"\n")!==false) {
$text = explode("\n",$email);
} else {
$text = array($email);
}

php image file is not copying in the folder

This is error showing page.i cant find any clues why showing these errors. The image file is not copying the images folder.
Notice: Undefined index: image in C:\xampp\htdocs\Project\Manpower.php on line 36
Notice: Undefined index: image in C:\xampp\htdocs\Project\Manpower.php on line 38
Warning: copy(): Filename cannot be empty in C:\xampp\htdocs\Project\Manpower.php on line 38
<?php
include_once'db_connect.php';
session_start();
$mysqli = new mysqli("localhost", "root", "", "travelagent");
if(isset($_POST['status']))
{
if (!isset($_SESSION["username"]))
{
$message = "please login!!";
echo "<script type='text/javascript'>alert('$message');</script>";
}
else
{
$id = mysqli_real_escape_string($mysqli, $_POST['id']);
$username=$_SESSION["username"];
$_SESSION['id']=$id;
$sql = "UPDATE product SET status='1' WHERE id='$id' " ;
if(mysqli_query($mysqli,$sql)==true)
{
$image_path= mysqli_real_escape_string( $mysqli ,'images/'.$_FILES['image']['name']);
if(copy($_FILES['image']['tmp_name'],$image_path))
{
$_SESSION['image']=$image_path;
$image=$_SESSION['image'];
$sql="INSERT INTO cart (user_name, product_id,image) VALUES ('$username','$id','$image')";
$result=$mysqli->query($sql);
$message = "added to cart!! ";
echo "<script type='text/javascript'>alert('$message');</script>";
session_destroy();
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Polyworld Services</title>
<meta name="Description" content="Polyworld">
<meta name="viewport" content="width:device-width" initial-scale="1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/jquery-2.2.4.js"
integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/full-slider.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body data-spy="scroll" data-target="#my-navbar">
<?php
include'header.php';
?>
<h1 style="text-align:center;">Welcome to Manpower page</h1>
<div class="row" id="content">
<?php
$result=$mysqli->query("SELECT * FROM product WHERE category_id='1' AND sub_category_id='1' AND status='0'" );
while($row=$result->fetch_array())
{
?>
<div class="col-md-3">
<ul>
<li>picture : <?php echo "<img src='admin/".$row['image']. "' height='200' width='200'>"; ?> </li>
<li>Name: <?php echo $row['name']; ?></li>
<li>Description :<?php echo $row['description']; ?></li>
<li >Details</li>
<form action="" method="post">
<input type="text" name="id" value="<?php echo $row['id']; ?>">
<input type="hidden" name="image" value="<?php echo $row['image']; ?>">
<li><input type="submit" name="status" value="add to cart"></li></br>
</form>
</ul>
</div>
<?php
}
?>
</div>
<?php include'footer.php'; ?>
<script type="text/javascript">
</script>
</script>
<script type="text/javascript" src="js/custom.js">
</script>
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</body>
</html>
Try this code to upload file
$dir="image/";//name of the folder where the file need to be copied
$file=$dir . basename($_FILES["photo"]["name"]);// where 'photo' is the field name of file input
$filetype=pathinfo($file,PATHINFO_EXTENSION);
if(move_uploaded_file($_FILES["photo"]["tmp_name"], $file)) {
echo "upload success";
}

Form that sends html template to email

The form contents are sent to my email but HTML and CSS code is not recognised on the email. Only plain text is outputted.
Below is my controller
public function registration() {
$email = $this->input->post('email');
$domain = $this->input->post('domain_name');
$passw = $this->input->post('passw');
$name = $this->input->post('name');
$skype = $this->input->post('skype');
// $package = $this->input->post('package');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'xxxx.com',
'smtp_port' => 25,
'smtp_user' => 'xxx#xxxxxx.com',
'smtp_pass' => 'xxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('xxx#xxxxxx.com', 'welcome');
$this->email->to('xxxxx#xxxxxxxx.com');
$this->email->subject('registration');
$body = $this->load->view('dns/template', TRUE);
$this->email->message($body, TRUE);
$this->email->send();
$data['message'] = 'Submitted Sucessfullly';
$data['emails'] = $this->Dns_model->emails($domain);
$this->load->view('dns/sucessful', $data);
}
Below is my view saved as template.php
My view (template)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Registration</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/bootstrap.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/main.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/style.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/AdminLTE.css">
<link rel="stylesheet" href="<?php echo base_url()?>/assets/css/sl-slide.css">
<script src="<?php echo base_url()?>/assets/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="<?php echo base_url()?>/images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo base_url()?>/images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo base_url()?>/images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="i<?php echo base_url()?>/mages/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="<?php echo base_url()?>/images/ico/apple-touch-icon-57-precomposed.png">
</head>
<body id="con" onLoad="generate();">
<div id="fb-root"></div>
<div class="container">
<section class="main-info">
<br>
<section id="recent-works3">
<section id="pricing-table">
<div class="row-fluid center clearfix">
<div class="span3">
</div>
<div class="span6">
<ul class="plan plan3">
<li class="plan-name">
<span class="lead3">Emails to be setup</span>
</li>
</ul>
<table class="table">
<thead>
<tr>
<th>Email</th>
<th>Password</th>
</tr>
</thead>
<tbody>
<tr class="info">
<td>info#test.com</td>
<td>terfwws6w</td>
</tr>
</tbody>
</table>
<ul class="plan plan3">
<li class="plan-action">
Registration website
</li>
</ul>
</div>
<div class="span3">
</div>
</div>
</section>
</section>
</section>
</div>
</div>
<script src="<?php echo base_url()?>/assets/js/vendor/jquery-1.9.1.min.js"> </script>
<script src="<?php echo base_url()?>/assets/js/vendor/bootstrap.min.js"></script>
<script src="<?php echo base_url()?>/assets/js/main.js"></script>
<script src="<?php echo base_url()?>/assets/js/jquery.ba-cond.min.js"></script>
</body>
</html>
I hope you are not using Parser library for email template, so bellow is my Answer by considering the above Condition.
You have problem with your template, means the Html code you wrote there, they have mismatched tag or some tag used in Wrong place. So you have to check that first.
If still you are not able to find out the problem then you just create a template using bellow code and You will see that the mail not more in normal text..
Nice, You nailed it...
NOTE: Don't use or etc tag and Also Use <table> instead of <div>

HTML auto-converting php tag into comment

I'm including 'success.php' into 'create.php' but my php code on 'create.php' is getting auto-commented (html tag)
create.php
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<?php
require("header.php");
$amount = str_replace(array(".", ","), "", $_POST["amount"]);
$data = array(
"amount" => $amount,
"payment_method" => $_POST["payment_method"],
"customer" => $_POST["customer"],
"installments" => $_POST["installments"]);
if ($data["payment_method"] == "credit_card") {
$data += $_POST["card"];
}
try {
$transaction = new PagarMe_Transaction($data);
$transaction->charge();
require("success.php");
} catch(Exception $e) {
echo $e->getMessage();
}
?>
</body>
</html>
success.php
<div class="container" style="padding-bottom:100px">
<div class="page-header">
<h1>Guide Life</h1>
</div>
<div class="alert alert-success" role="alert">
<b>Transação efetuada com sucesso!</b>
</div>
<? if ($transaction->payment_method == "boleto") { ?>
<p>
Link para o boleto:
<a target="_blank" href=""></a>
<iframe src="https://api.pagar.me/1/boletos/live_citxbiz9d0kg9gu3e33cwmdwr" width="100%" height="100%" />
</p>
<? } ?>
</div>
Page:
Html code generated:
<? if ($transaction->payment_method == "boleto") { ?>
Needs to have the correct open tag <?php same with <? } ?> should be <?php } ?>

syntax error, unexpected end of file when using include_once('header.php') [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
i just installed php 5.6.8 and my older scripts are considered as wrong, getting syntax error, unexpected end of file. On older PHP (5.2-5.3) it worked well, but now I don't know how to fix it to keep the functionality.
The basic problem is that in pages (like index.php) I use:
include_once("header.php");
include_once("some-page.php");
include_once("footer.php");
In header.php I have things like logo etc that appears on evey page so it goes like:
<html> all-the-standard-things-here <body> <div class="div_menu">
<ul id="menulist_root" class="mainlevel"><li id="menuitem_1">...</li></ul>
</div>
<div class="div_body">
<div class="div_center" >
<div id="page">
then goes standard page, html code etc and i finish with footer.php closing the divs:
</div> // end of page
</div> // end of div_center
</div> // end of div_body
etc
But the server doesn't like the end of header.php showing:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\project\header.php on line 52 (which is the last line).
What to do?
Well, as it was working without any change on 5.3 ... it is a lot of code, but Ok, here it is. thanx for help.
<?php
include_once('default_functions.php');
if (!$security_check || $security_check <= $_SESSION['user']['level']) {
//ok
} else {
header("Location:users.php?action=loginAdmin");
die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Slovenské firemné hry Zima | Elcop</title>
<!--
<link href="http://www.elcop.sk/templates/elcop/favicon.ico" rel="shortcut icon" type="image/x-icon" />
-->
<!--[if IE]>
<link rel="stylesheet" href="/templates/elcop/css/ie.css" type="text/css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" href="/templates/elcop/css/ie6.css" type="text/css" />
<![endif]-->
<link href="default.css" rel="stylesheet" type="text/css">
<?php
if($_SERVER['HTTP_HOST'] != 'localhost'){
?>
<base href="" />
<meta name="description" content="Individuálne kreatívne riešenia pre komunikačné potreby našich klientov predovšetkým prostredníctvom event marketingu a špeciálnych PR projektov."/>
<meta name="keywords" content="elcop, korporatne bubnovanie, slovenske firemne hry, plazove inspiracie, teambuilding"/>
<meta name="robots" content="index, follow" />
<meta name="author" content="2create" />
<meta name="title" content="Slovenské firemné hry Zima | Elcop" />
<link href="http://www.elcop.sk/templates/elcop/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" href="http://www.elcop.sk/components/com_rsform/front.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://www.elcop.sk/modules/mod_briaskISS/mod_briaskISS.css" type="text/css" />
<script type="text/javascript" src="http://www.elcop.sk/media/system/js/caption.js"></script>
<script type="text/javascript" src="http://www.elcop.sk/modules/mod_xyo_swf/lib/swfobject.js"></script>
<script type="text/javascript" src="http://www.elcop.sk/modules/mod_briaskISS/mod_briaskISS.js"></script>
<meta name="author" content="2create" />
<link rel="stylesheet" href="http://www.elcop.sk/templates/elcop/css/template.css" type="text/css" />
<link rel="stylesheet" href="http://www.elcop.sk/templates/elcop/css/menus.css" type="text/css" />
<link rel="stylesheet" href="http://www.elcop.sk/templates/elcop/css/content.css" type="text/css" />
<!--[if IE]>
<link rel="stylesheet" href="/templates/elcop/css/ie.css" type="text/css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" href="/templates/elcop/css/ie6.css" type="text/css" />
<![endif]-->
<script type="text/javascript" src="http://www.elcop.sk/templates/elcop/js/sfhover.js"></script>
<?php} else {?>
<link rel="stylesheet" href="template.css" type="text/css" />
<link rel="stylesheet" href="content.css" type="text/css" />
<?php}?>
<?php if(strlen($onload_css)) { echo $onload_css; }
if(strlen($onload_script)) { echo $onload_script; }
?>
</head>
<body <?php if(strlen($onload_event)) { echo $onload_event; }?>>
<?php
if($_SERVER['HTTP_HOST'] == 'localhost' && $_SESSION['user']['level'] >= 3) {
echo '<span style="color:red;margin:10px;">Work local (' . DB_NAME . ') !</span>';
} elseif($_SERVER['HTTP_HOST'] != 'localhost' && $_SESSION['user']['level'] >= 3) {
echo '<span style="color:green;margin:10px;">Work online!</span>';
} else {
}?>
<div class="div_main_container">
<?php
if($_SERVER['HTTP_HOST'] != 'localhost'){
?>
<div class="div_head">
<div class="div_topbox">
<div class="div_topmenu">
<ul class="menu"><li class="item14"><span>Home</span></li><li class="item15"><span>Mapa stránky</span></li><li class="item16"><span>Verzia pre tlač</span></li></ul>
</div>
<div class="div_languagemenu">
</div>
</div>
<br style="clear:both" />
<div class="div_slideshow">
<div class="div_float_logolink">
</div>
<noscript>
<div>ImageSlideShow requires Javascript</div>
</noscript>
<ul id="briask-iss35" class="briask-iss" style="width:736px;height:152px"><li><img src="http://www.elcop.sk/images/stories/Headers_2/img1.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img4.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img11.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img9.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img7.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img8.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img6.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img2.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img10.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img3.jpg" alt="Elcop" /></li><li><img src="http://www.elcop.sk/images/stories/Headers_2/img5.jpg" alt="Elcop" /></li></ul>
<script type="text/javascript">
var briaskPics35 = [0];
var briaskInstance35 =
new briaskISS(35,1,2000,80, briaskPics35);
</script>
</div>
</div>
<div class="div_menu">
<ul id="menulist_root" class="mainlevel"><li id="menuitem_1">O nás</li><li id="menuitem_2">Slovenské firemné hry<ul id="menulist_2"><li id="menuitem_2_1">SFH Zima</li><li id="menuitem_2_2">SFH Leto</li><li id="menuitem_2_3">SFH Pláže</li><li id="menuitem_2_4">Charitatívna iniciatíva</li></ul></li><li id="menuitem_3">Bedminton<ul id="menulist_3"><li id="menuitem_3_1">Účastnícky poplatok</li><li id="menuitem_3_2">Pravidlá a herný systém</li><li id="menuitem_3_3">Nominácia a nasadenie</li><li id="menuitem_3_4">Bonusové turnaje</li><li id="menuitem_3_5">Hodnotenie</li><li id="menuitem_3_6">Miesto a termíny</li><li id="menuitem_3_7">Najčastejšie otázky a odpovede</li><li id="menuitem_3_8">Prihlásené spoločnosti</li><li id="menuitem_3_9">Fotogaléria</li><li id="menuitem_3_10">Výsledky</li><li id="menuitem_3_11">Zaregistrujte sa!</li></ul></li><li id="menuitem_4">Golf</li><li id="menuitem_5">Korporátne bubnovanie</li><li id="menuitem_6">Eventy<ul id="menulist_6"><li id="menuitem_6_1">Event marketing</li><li id="menuitem_6_2">Ponuka eventov</li><li id="menuitem_6_3">Public Relations</li><li id="menuitem_6_4">Event manažment</li></ul></li><li id="menuitem_7">Referencie</li><li id="menuitem_8">Kontakt</li></ul>
</div>
<?php }?>
<div class="div_body">
<div class="div_center" >
<div id="page">

Categories