I have a serious problem,
I want to show the Hebrew words in RTL format after PDF creation, but it's not showing. It always shows LTR.
I have some words combinations of English and Hebrew language.
I did some search on google but no luck.
I am using Laravel DomPdf.
I have checked my dompdf core file DOMPDF_UNICODE_ENABLED and its value is "DOMPDF_UNICODE_ENABLED" => true, still not abel to get the solution.
Here is my blade file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
</head>
<body>
<table class="lead" cellspacing="0" width="100%" style="font-size: 12px; font-family: 'firefly, DejaVu Sans, sans-serif'; ">
<thead>
<tr>
<th width="10%" style="font-weight: bold;">Date</th>
<th width="15%" style="font-weight: bold;">Name</th>
<th width="20%" style="font-weight: bold;">Details</th>
<th width="10%" style="font-weight: bold;">Contact Origin</th>
<th width="15%" style="font-weight: bold;">Status</th>
<th width="10%" style="font-weight: bold;">Comment</th>
<th width="10%" style="font-weight: bold;">Country</th>
</tr>
</thead>
<tbody>
<?php
foreach($leadInfo as $k=>$v){
$continent = getAllContinentName($v->country);
if(strtolower($continent) == strtolower("Asia")){
$backGround = "#FFB300";
} else if(strtolower($continent) == strtolower("Africa")){
$backGround = "#FFB300";
} else if(strtolower($continent) == strtolower("North America")){
$backGround = "#009792";
} else if(strtolower($continent) == strtolower("South America")){
$backGround = "#FF7E00";
} else if(strtolower($continent) == strtolower("Antarctica")){
$backGround = "#15E6E8";
} else if(strtolower($continent) == strtolower("Europe")){
$backGround = "#0074FF";
} else if(strtolower($continent) == strtolower("Australia")){
$backGround = "#05A900";
} else {
$backGround = "#FFFFFF";
}
if($v->email_status_id == 10){
$statusBackGround = "#a9d18d";
} else if($v->email_status_id == 11){
$statusBackGround = "#ff0000";
} else if($v->email_status_id == 12){
$statusBackGround = "#b3c6e7";
} else if($v->email_status_id == 13){
$statusBackGround = "#c09200";
} else if($v->email_status_id == 14){
$statusBackGround = "#ffff00";
} else {
$statusBackGround = "#FFFFFF";
}
?>
<tr>
<td> {{ date('m-d-Y',strtotime($v->created_date)) }} </td>
<td>{{ $v->name }}</td>
<td>{{ mb_substr($v->message, 0, 300) }}</td> <!-- This line has combination of english and hebrew language-->
<td>{{ $v->contact_origin }}</td>
<td style="direction: rtl !important; unicode-bidi: bidi-override; color:black; background-color: {{ $statusBackGround }};">{{ $v->status_name }}</td> <!-- This line has only hebrew language -->
<td>{{ $v->comment }}</td>
<td style="color:black; background-color: {{ $backGround }}" >{{ getAllCountryName($v->country) }}</td>
</tr>
<?php } ?>
</tbody>
</table>
</body>
</html>
It would be great if anyone helps me to get out of this.
Dompdf (up to and including 0.8.1) does not currently support RTL text (see issue 1009). There is a work around, but the results are passable at best.
If you're interested in trying it out modify the Text rendered by adding the following code at line 83:
if (strtolower($style->direction) === 'rtl') {
preg_match_all('/./us', $text, $ar);
$text = join('',array_reverse($ar[0]));
// if there are numbers in the string so the next line reverse the number back treat also numbers with dot (decimal) and email
$text = preg_replace_callback('/\d+-\d+|\d+|\d+\.\d+|\S+#\S+/', function (array $m) { return strrev($m[0]); }, $text);
}
you can use this package which supports rtl languages such as persian and arabic
https://github.com/barryvdh/laravel-snappy
in order to change the direction , just within the html tag which is going to be converted to pdf , use dir="rtl"
Related
I am going to create a pdf file from HTML using the Barryvdh Laravel package. I need to add a header and footer to each page as this is a multi-page document.
I've looked around a bit and I think that the two links below will help you solve your problem:
1- https://github.com/barryvdh/laravel-snappy/issues/139#issuecomment-369050826
Create a route that renders the html for the header/footer, and pass the full url to that route as option.
$html = view()->make("juiztramp.exporter.pdf.grupos")
->with("provas",$ordens_de_passagem)
->render();
$headerHtml = view()->make('juiztramp.exporter.pdf.header')
->with('nomeEvento', $nomeEvento)
->with('dataEvento', $dataEvento)
->with('localEvento', $localEvento)
->render();
$footerHtml = view()->make('juiztramp.exporter.pdf.footer')
->with('organizacao', $organizacao)
->render();
And later on
$options = [
'orientation' => 'portrait',
'encoding' => 'UTF-8',
'header-html' => $headerHtml,
'footer-html' => $footerHtml,
// further options....
];
return response(
$snappy->getOutputFromHtml($html, $options),
200,
[
'Content-Type' => 'application/pdf',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
'Content-Disposition' => 'filename="'.$filename.'"',
]
);
example header view
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<table>
<tbody>
<tr>
<td style="width: 200px; background-color: #00be67;"> {{ $nomeEvento }} </td>
<td style="width: 500px; background-color: #0a94e3;" align="center"> {{ $localEvento }} </td>
<td style="width: 200px; background-color: #7b3f25" align="right"> {{ $dataEvento }} </td>
</tr>
</tbody>
</table>
</body>
</html>an
i am building an asset management system.I would like to have the following calculations done in the controller to be displayed in the view.
public function depreciation()
{
$assets = Asset::all();
$price = DB::table('assets')
->where('category_id', 1)
->sum('purchase_price');
$dep = $price * 0.3333;
$netprice = $price - $dep;
return $netprice;
return view('admin.assets.index')->with(['price','dep', 'netprice' => $netprice]);
}
My Route
Route::post('assets_depreciation', ['uses' => 'Admin\AssetsController#depreciation', 'as' => 'assets.depreciation']);
My View
<tbody>
#if (count($assets) > 0)
#foreach ($assets as $asset)
<tr data-entry-id="{{ $asset->id }}">
#can('asset_delete')
<td></td>
#endcan
<td field-key='title'>{{ $asset->title }}</td>
<td field-key='serial_number'>{{ $asset->serial_number }}</td>
<td field-key='barcode'>{{ $asset->barcode }}</td>
<td field-key='photo1'>#if($asset->photo1)<img src="{{ asset(env('UPLOAD_PATH').'/thumb/' . $asset->photo1) }}"/>#endif</td>
<td field-key='category'>{{ $asset->category->title ?? '' }}</td>
<td field-key='status'>{{ $asset->status->title ?? '' }}</td>
<td field-key='location'>{{ $asset->location->title ?? '' }}</td>
<td field-key='assigned_user'>{{ $asset->assigned_user->name ?? '' }}</td>
<td field-key='vendor'>{{ $asset->vendor->name ?? '' }}</td>
<td field-key='purchase_price'>{{ $asset->purchase_price }}</td>
<td field-key='warranty'>{{ $asset->warranty }}</td>
<td field-key='depreciation'>{{ $netprice }}</td>
<td>
How can This be achieved?
You should be using a GET request instead of a POST for your route. It should look like this:
Route::get('assets_depreciation', ['uses' => 'Admin\AssetsController#depreciation',
'as' => 'assets.depreciation']);
Laravel's documentation gives you correct usage examples of their framework components, you can check it out here: Laravel/Routing. Hope this helps!
If you are looking to send the price, dep and netprice to the admin.assets.index view then you can use this:
public function depreciation()
{
$assets = Asset::all();
$price = DB::table('assets')
->where('category_id', 1)
->sum('purchase_price');
$dep = $price * 0.3333;
$netprice = $price - $dep;
return view('admin.assets.index')->with(['price' => $price,'dep' => $dep, 'netprice' => $netprice]);
}
Then you can use these variables in you view file {{ $price }}, {{ $dep }}, {{ $netprice }}
You need to create file index.blade.php in your_project/resources/views/admin/assets/ with html-blade content e.g:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>my page</title>
</head>
<body>
<div>Price: {{ $price }}</div>
<div>Dep: {{ $dep }}</div>
<div>Net price: {{ $netprice }}</div>
</body>
</html>
more info here. And remove first return statement and change last return to
return view('admin.assets.index', compact('price','dep','netprice'));
I am working on Xamarin forms IOS application calling HTML pages, styles and scripts by using Hybrid WebView. I am not able to render styles and scripts and my code is
HybridWebViewRenderer.cs
protected override void OnElementChanged (ElementChangedEventArgs<HybridWebView> e)
{
base.OnElementChanged (e);
if (Control == null) {
userController = new WKUserContentController ();
var script = new WKUserScript (new NSString (JavaScriptFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
userController.AddUserScript (script);
userController.AddScriptMessageHandler (this, "invokeAction");
var config = new WKWebViewConfiguration { UserContentController = userController };
var webView = new WKWebView (Frame, config);
SetNativeControl (webView);
}
if (e.OldElement != null) {
userController.RemoveAllUserScripts ();
userController.RemoveScriptMessageHandler ("invokeAction");
var hybridWebView = e.OldElement as HybridWebView;
hybridWebView.Cleanup ();
}
if (e.NewElement != null) {
string fileName = Path.Combine (NSBundle.MainBundle.BundlePath, string.Format ("Content/{0}", Element.Uri));
//fileName = "/var/containers/Bundle/Application/2DC89563-D118-4092-B7A5-4549AF07F3B2/StoneApplication.iOS.app/Content/index.html"
Control.LoadRequest (new NSUrlRequest (new NSUrl (fileName, false)));
}
}
public void DidReceiveScriptMessage (WKUserContentController userContentController, WKScriptMessage message)
{
Element.InvokeAction (message.Body.ToString ());
}
and my index.html, here I am calling scripts, Images and styles
<html>
<head>
<title>STONEAPP TEMPLATE</title>
<!--Scripts-->
<script src="/Scripts/angular.min.js"></script>
<script src="/Scripts/jquery.min.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/fileServer.js"></script>
<script src="/Scripts/fileupload.js"></script>
<script src="/Scripts/ng-cordova.js"></script>
<script src="/Scripts/app.js"></script>
<!--Styles-->
<link href="/Styles/bootstrap.css" rel="stylesheet"/>
<link href="/Styles/main.css" rel="stylesheet"/>
</head>
<body ng-app="stoneApp" style="background-color: #ffffff;">
<div ng-controller="templateCtrl">
<div id="Header" style="background-color:#293846;min-height:50px">
<table style="width:100%;padding-top:5px;padding-left:5px;padding-right:5px">
<tr>
<td align="center" width="5%" valign="middle" ng-if="jobView == true" ng-click="showActList()">
<img src="/Images/arrow-back.png" alt="" style="height:50px;width:50px"/>
</td>
<td align="center" width="5%" valign="middle">
<img src="/Images/wifi_on.png" alt="" style="height:50px;width:50px" ng-click="ShowWifiSettings()"/>
</td>
<td align="center" width="5%" valign="middle" ng-click="ShowTabSettings()">
<img src="/Images/settings.png" alt="" style="height:50px;width:50px" ng-if="loginView == false"/>
</td>
<td width="5%" valign="middle" ng-if="activityView == true"></td>
<td width="60%" valign="middle"></td>
<td width="20%" valign="middle" align="right">
<span style="color:white" ng-if="loginView == false">{{userName}} !</span>
</td>
<td width="5%" align="right" valign="middle" ng-click="logout()" >
<img src="/Images/power_button.png" style="height:50px;width:50px" ng-if="loginView == false"/>
</td>
</tr>
</table>
</div>
</div>
</body>
I gave build action as bundle resource for styles and scripts even though I am not able to call styles and scripts and program structure is as attached image.
I am using iOS 10.2 tablet. How can I investigate my issue and make call the scripts styles and images as the links given in the HTML page?
You can't do that with Control.LoadRequest
You're problem is that you can't define baseUrl for your webview with this method and no other method let you define it.
So when your index.html is loaded into the webview, the webview can't retrieve script or css because the baseUrl is not defined and it doesn't know where to load them.
A workaround is to use LoadHtmlString (String htmlContent, NSUrl baseUrl)
Where htmlContent is your index.html content loaded into a var and baseUrl NSUrl baseurl = new NSUrl(NSBundle.MainBundle.BundlePath, true);
I want to show a dynamic table which has records coming from a custom search.
Now I want to make the table row as an inline editable row.
I also need pagination with the table since I have 30 to 40 table columns which I need to display on the same table (scroll for columns).
I used Handsontable to achieve this as seen below, however, the image is not coming as I have entered in the table cell.
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title>Scroll - Handsontable</title>
<script data-jsfiddle="common" src="handsontable.full.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="handsontable.full.css">
</head>
<body>
<div id="example1" style="width: 700px; height: 400px; overflow: auto">
<table id="example" class="row-border hover order-column" cellspacing="0" style="Display: none;" >
<thead>
<tr>
<th>Action</th>
<th>ID</th>
<th>Name</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="edit.jpg" height="20" width="20"/></td>
<td>1</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td><img src="edit.jpg" height="20" width="20"/></td>
<td>2</td>
<td>test2</td>
<td>test2</td>
</tr>
<tr>
<td><img src="edit.jpg" height="20" width="20"/></td>
<td>3</td>
<td>test3</td>
<td>test3</td>
</tr>
</tbody>
</table>
</div>
<script data-jsfiddle="example1">
var data=$('#example tr').map(function(tr){
return [$(this).children().map(function(td){return $(this).text()}).get()]
}).get()
var
example = document.getElementById('example1'),
maximize = document.querySelector('.maximize'),
maxed = false,
resizeTimeout,
availableWidth,
availableHeight,
hot1;
hot1 = new Handsontable(example,{
data: data,
// colWidths: [55, 80, 80, 80, 80, 80, 80], //can also be a number or a function
rowHeaders: false,
colHeaders: false,
fixedColumnsLeft: 2,
fixedRowsTop: 1,
minSpareRows: 1,
contextMenu: true
});
function calculateSize() {
var offset;
if (maxed) {
offset = Handsontable.Dom.offset(example);
availableWidth = Handsontable.Dom.innerWidth(document.body) - offset.left + window.scrollX;
availableHeight = Handsontable.Dom.innerHeight(document.body) - offset.top + window.scrollY;
example.style.width = availableWidth + 'px';
example.style.height = availableHeight + 'px';
}
}
</script>
</div>
</body>
</html>
From the looks of it, your definition of the Handsontable is correct. Are you pasting that HTML after it's rendered or is that what Handsontable is creating for you? I'm not sure if you knew or not but you don't need to define the table in the HTML for this to work. As a matter of fact you should NOT be defining it.
If this was just the rendered code, could you please elaborate on what you mean by "I have used Handsontable for achieve this as below. but image not coming as i have entered in table cell."? What parts are wrong and what do you need changed?
Try this:
cells : function (row, col, prop) { return { renderer: 'html' }; }
as an option in your hot1 definition.
So far bcrypt has had no problems until now. For some reason the following password won't work. UIO78349%^&(]\\';= This is the first time I've had a password not work and I hope somebody has an explanation. I hunted the net and read about the character limit but this is well below that. Not sure if it makes any difference but the user input for password is going through mysqli_real_escape_string.
First batch of code where the login form is located:
<?php
session_start();
?>
<html>
<body>
<form method="post" action="sidebar-signin-block.php">
<table width="90%" border="0" align="center" bgcolor="white">
<tr>
<td bgcolor="ffffff" colspan="2" align="center"><h2>User Login</h2></td>
</tr>
<tr>
<td align="right">Email:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="login" value="Login"></td>
</tr>
<tr>
<td colspan="2" align="center"><h3 style="margin-top:7px;">Forgot Password?</h3></td>
</tr>
<tr>
<td bgcolor="#ffffff" colspan="2" align="center"><div style="padding-top:5px;"><span style="font-size:20px;">Don't have an account?<br />Sign Up is <em>quick</em> and <em>easy</em>!</span></div></td>
</table>
</form>
<?php
// Connecting to the database and making the Bcrypt functions available
include("admin/includes/connect.php");
include ("lib/password.php");
// Gathering and sanitizing user login input
if(isset($_POST['login'])){
$email = trim(((isset($conn) && is_object($conn)) ? mysqli_real_escape_string($conn, $_POST['email']) :((trigger_error ("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")));
$pass = trim(((isset($conn) && is_object($conn)) ? mysqli_real_escape_string($conn, $_POST['password']) : ((trigger_error ("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")));
// Checking the database records for the user login input
$hash_query = "select nonadmin_user_pass from nonadmin_user_login where email='$email'";{
$run_query = mysqli_query($conn, $hash_query);}
while ($row = mysqli_fetch_assoc($run_query)) {
$fetch_pass = $row['nonadmin_user_pass'];
}
// If the user email and password matches we start a session
if ((password_verify($pass, $fetch_pass)) == 1){
// Verifying user login success with splash page then sending user back to the home page
$_SESSION['email']=$email;
echo "<script>window.open('login-success.php','_self')</script>";}
// When the user login fails an alert is given to inform them
else {
echo "<script>alert('Email or password is incorrect please try again')</script>";
echo "<script>window.open('index.php','_self')</script>";}
}
?>
</body>
</html>
Here the js.
<script>$(document).ready(function(){
$("#login").click(function(){
var email = $("#email").val();
var password = $("#password").val();
// Checking for blank fields.
if( email =='' || password ==''){
$('input[type="text"],input[type="password"]');
$('input[type="text"],input[type="password"]');
alert("Please fill all fields.");
}else {
$.post("log-me-in.php",{ email1: email, password1:password},
function(data) {
if(data=='Invalid Email.......') {
$('input[type="text"]');
$('input[type="password"]');
alert(data);
}else if(data=='Email or Password is wrong please try again.'){
$('input[type="text"],input[type="password"]');
alert(data);
} else if(data=='Successfully Logged in.'){
window.location.reload();
$("form")[0].reset();
$('input[type="text"],input[type="password"]');
alert(data);
} else{
alert(data);
}
});
}
});
});</script>
Here's the php being called:
<?php
session_start();
// Connecting to the database and making the Bcrypt functions available
include("admin/includes/connect.php");
include ("lib/password.php");
$email=$_POST['email1']; // Fetching Values from URL.
$password= ($_POST['password1']);
// check if e-mail address syntax is valid or not
//$email = filter_var($email, FILTER_SANITIZE_EMAIL); // sanitizing email(Remove unexpected symbol like <,>,?,#,!, etc.)
//if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
//echo "Invalid Email.......";
//}else{
// Matching user input email and password with stored email and password in database.
$result = mysqli_query($conn, "SELECT * FROM nonadmin_user_login WHERE email='$email'");
$data = mysqli_fetch_array($result);
$bcrypt_pass = $data['nonadmin_user_pass'];
$email_match = $data['email'];
if (password_verify ($password, $bcrypt_pass) == 1 AND $email == $email_match) {
$_SESSION['email']=$email;
echo "Successfully Logged in.";
}
else{
echo "Email or Password is wrong please try again";
}
//}
?>
Here is the user registration code where the password initially gets entered before mail verification:
<html>
<head>
<title>Register at Recycling Kansas City</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/styles/register-user.css" media="all">
<!-- ie compatibility -->
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<!--[if lt IE 9]>
<script src="Site/javascript/bootstrap/html5shiv.js"></script>
<![endif]-->
<meta content="recycling kansas city, recycling centers, recycling locations" name="keywords">
<meta content="Recycling Kansas City is an efficient resource to help you quickly find a recycle center that is nearby. Use our map to find locations and accepted items." name="description">
</head>
<h1 class="center">Why register at Recycling Kansas City?</h1>
<p>By registering here you will gain access to additional features. Once registered you can create your own custom profile, submit and comment on blog articles, advertise your products or services and have the choice to opt in for email announcements.</p>
<p>All of your information will be securely stored in our database and you can delete your account at any time. Also, rest assured that we will never share any of your submitted details with anyone ever.</p>
<form method="post" action="register-user.php">
<table width="520" border="10" align="center" bgcolor="white">
<tr>
<td bgcolor="ffffff" colspan="2" align="center"><h1>Registration</h1></td>
</tr>
<tr>
<td align="right">Email</td>
<td><input type="text" name="email" size="53"></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="pwd" size="53"></td>
</tr>
<tr>
<td align="right">User Name:</td>
<td><input type="text" name="name" size="53"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="register" value="Register"></td>
</tr>
</table>
</form>
</html>
<?php
include ("../admin/includes/connect.php");
include ("../lib/password.php");
$con = new mysqli("localhost", "$username", "$password", "$database");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if(isset($_POST['register'])){
$email = trim(mysql_escape_string($_POST['email']));
$nonadmin_user_pass = trim(mysql_escape_string($_POST['pwd']));
$password = password_hash($nonadmin_user_pass, PASSWORD_BCRYPT);
$nonadmin_user_name = trim(mysql_escape_string($_POST['name']));
$query_verify_email = "SELECT * FROM nonadmin_user_login WHERE email ='$email' and verified = 1";
$verified_email = mysqli_query($con,$query_verify_email);
if (!$verified_email) {
echo ' System Error';
}
if (mysqli_num_rows($verified_email) == 0) {
// Generate a unique code:
$hash = md5(uniqid(rand(), true));
$query_create_user = "INSERT INTO `nonadmin_user_login` (`email`, `nonadmin_user_pass`, `nonadmin_user_name`, `hash`) VALUES ('$email', '$password', '$nonadmin_user_name', '$hash')";
$created_user = mysqli_query($con,$query_create_user);
if (!$created_user) {
echo 'Query Failed ';
}
if (mysqli_affected_rows($con) == 1) { //If the Insert Query was successfull.
$subject = 'Activate Your Email';
$headers = "From: admin#recyclingkansascity.com \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$url= 'http://recyclingkansascity.com/includes/register-verify.php?email=' . urlencode($email) . "&key=$hash";
$message ='<p>To activate your account please click on Activate buttton</p>';
$message.='<table cellspacing="0" cellpadding="0"> <tr>';
$message .= '<td align="center" width="300" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
color: #ffffff; display: block;">';
$message .= '<a href="'.$url.'" style="color: #ffffff; font-size:16px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-decoration: none;
line-height:40px; width:100%; display:inline-block">Click to Activate</a>';
$message .= '</td> </tr> </table>';
mail($email, $subject, $message, $headers);
echo '<p class="center">A confirmation email
has been sent to <b>'. $email.' </b></p><p class="center">Please <strong>click</strong> on the <strong><em>Activate</em> Button</strong> to Activate your account.</p> ';
} else { // If it did not run OK.
echo '<div>You could not be registered due to a system
error. We apologize for any
inconvenience.</div>';
}
}
else{
echo '<div>Email already registered</div>';}
}
?>
So far never a hiccup on any password until the password at the top of the post? Weird if you ask me.
Remove all calls to mysqli_real_escape_string() for password input, the functions password_hash() and password_verify() accept even binary input and are not prone to SQL-injection. I assume this already solves your problem. Escaping should be done as late as possible and only for the given target system, so the function mysqli_real_escape_string() should only be called to build an SQL query.
Then the function password_verify() already returns a boolean, no need to compare it with == 1.
if (password_verify($pass, $fetch_pass))
{
...
}
If this doesn't solve your problem, i would make sure that every page uses UTF-8 as file format and defined it in the header.