
How To Configure A Sendinblue SMTP Relay in Postfix?
Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …
Technical Blogs & News
Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …
You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …
Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …
Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method.
First Create a email using your Cyberpanel Under Emai Tab
Create Email
Second go to the SSL tab and click on MailServer SSL, then select your domain and press Issue SSL button.
Third Create a free account in https://account.sendinblue.com/
And add your domain
Click on Domain and Add your domain. After adding the domain you need to verify txt SPF and DKAIM
one by one copy the key and paste it on you cyber panel domain under the DNS tab Add/Delete Records .
Once completed the task you can see your domain is verified.
Download putty and open your server using SSH
sudo su -
nano /etc/postfix/main.c
Scroll to the bottom of the config and paste in the additional config. If you’re not using Sendinblue, you should change the server address in the first line:
relayhost = [smtp-relay.sendinblue.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = static:ideaspot.youremail.com:xsmtpsib-f46cf5b98745cba535588fc1535175c0dbbdb15632719b79a695a99c6f3586bf-vbOKyBJn2Wh90QSx
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
CLt+X -> Y->Enter
smtp_sasl_password_maps: you will get the details from your sendinblue account.
Thanks for reading….
You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …
You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. In this tutorial we’ll be building a password strength indicator like the following
Let’s start with the HTML creating a password input field and a password strength <div>
that we can style later on to give a visual representation of password strength:
<div id="password">
<label for="password-input">Password</label>
<input
id="password-input"
name="password-input"
type="password"
required
/>
<div id="password-strength"><span></span></div>
</div>
To determine the password strength we’ll be using the zxcvbn JavaScript library which i’ve included via CDN. It’s also available as a standalone download and NPM package:
<script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.2.0/zxcvbn.js"></script>
Now for the JavaScript, first let’s define variables for the password input and password strength:
const pwd = document.getElementById("password-input");
const pwdStrength = document.getElementById("password-strength");
We’ll then use an event listener to check the password strength each time a character is added or removed from the password input field:
pwd.addEventListener("input", function () {
const pwdVal = pwd.value;
let result = zxcvbn(pwdVal);
pwdStrength.className += "strength-" + result.score;
});
The score returned from zxcvbn()
is on a scale between 0 and 4. We then add this score as a class on the password strength <div>
so we can apply different CSS styles based on the score that’s returned.
That’s completes the JavaScript, now for the CSS starting with the password label and input field:
#password {
width: 250px;
}
#password label {
display: block;
}
#password-input {
width: 230px;
padding: 10px;
margin: 10px 0 5px 0;
}
Now for the strength indicator, it’ll appear as a light grey strip until a user starts entering a password:
#password-strength {
height: 5px;
width: 100%;
display: block;
background-color: #ccc;
}
#password-strength span {
display: block;
height: 5px;
border-radius: 2px;
transition: all 500ms ease;
}
All that’s left to do is set the color and width based on the strength score:
.strength-0 span {
background-color: red;
width: 5%;
}
.strength-1 span {
background-color: orangered;
width: 25%;
}
.strength-2 span {
background-color: orange;
width: 50%;
}
.strength-3 span {
background-color: yellowgreen;
width: 75%;
}
.strength-4 span {
background-color: green;
width: 100%;
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Create a simple password strength indicator with JavaScript</title>
<link rel="stylesheet" href="style.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.2.0/zxcvbn.js"></script>
</head>
<body>
<form>
<div id="password">
<label for="password-input">Password</label>
<input
id="password-input"
name="password-input"
type="password"
required
/>
<div id="password-strength"><span></span></div>
<p id="password-feedback"></p>
</div>
</form>
<script src="script.js"></script>
</body>
</html>
script.js
const pwd = document.getElementById("password-input");
const pwdStrength = document.getElementById("password-strength");
pwd.addEventListener("input", function () {
const pwdVal = pwd.value;
let result = zxcvbn(pwdVal);
pwdStrength.className = "strength-" + result.score;
});
style.css
body {
font-family: sans-serif;
}
#password {
width: 250px;
}
#password label {
display: block;
}
#password-input {
width: 230px;
padding: 10px;
margin: 10px 0 5px 0;
}
#password-strength {
height: 5px;
width: 100%;
display: block;
background-color: #ccc;
}
#password-strength span {
display: block;
height: 5px;
border-radius: 2px;
transition: all 500ms ease;
}
.strength-0 span {
background-color: red;
width: 5%;
}
.strength-1 span {
background-color: orangered;
width: 25%;
}
.strength-2 span {
background-color: orange;
width: 50%;
}
.strength-3 span {
background-color: yellowgreen;
width: 75%;
}
.strength-4 span {
background-color: green;
width: 100%;
}
Hi In this Article I am going to show how to create QR code and save it to database also fetch QR Code in a Table Create a Page addqrcode.php in …
Hi In this Article I am going to show how to create QR code and save it to database also fetch QR Code in a Table
Create a Page addqrcode.php in a root directory and paste the below code.
<section class="main--content">
<div class="row gutter-20">
<div class="col-md-6 mx-auto">
<!-- Panel Start -->
<?php $id=$_GET['apartnerId'];$data=qrCode($id);?>
<div class="panel">
<div class="panel-heading">
<h3 class="panel-title">Form</h3>
</div>
<div id="apartner-form" class="panel-content">
<form method="POST" action="ajax/qrcode.php" enctype="multipart/form-data">
<div class="form-group">
<legend>Add QrCode</legend>
<?php
if(isset($_GET['msg']))
{
echo $_GET['msg'];
}
?>
</div>
<!-- Member ID -->
<div class="form-outline">
<input type="hidden" class="form-control" id="uid" name="uid"
value="<?php echo $data['uid']; ?>" readonly />
</div>
<div class="form-outline">
<input type="text" class="form-control" id="fname" name="fname"
value="<?php echo $data['first_name']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="lname" name="lname"
value="<?php echo $data['last_name']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="email" name="email"
value="<?php echo $data['email']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="bcode" name="bcode"
value="<?php echo $data['bcode']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="state" name="state"
value="<?php echo $data['sts']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="district" name="district"
value="<?php echo $data['district']; ?>" readonly />
</div><br>
<div class="form-outline">
<input type="text" class="form-control" id="city" name="city"
value="<?php echo $data['city']; ?>" readonly />
</div><br>
<!-- Submit button -->
<button type="submit" class="btn btn-primary btn-sm mt-3" name="submit">Submit</button>
</form>
</div>
</div>
</div>
</section>
<!-- Main Content End -->
Create a Folder under root directory Connection/Functions.php
Functions.php
<?php
include('DBClass.php');// Database Connection
function qrCode ($id){
$db= new DBClass();
$result= $db->query('SELECT * FROM `tbl_accounts` where `uid`= "'.$id.'"');
return mysqli_fetch_array($result);
}
Create a Folder ajax/qrcode.php and paste the below code
qrcode.php
<?php
include('../libs/phpqrcode/qrlib.php');
if(isset($_POST['uid'])){
$path ='../temp/';
$uid=$_POST['uid'];
$time=time();
$file=$uid.$time.".png";
$email= $_POST['email'];
$subject= $_POST['bcode'];
// $fname= $_POST['fname'];
$lname= $_POST['lname'];
$sts= $_POST['sts'];
$district= $_POST['district'];
$city= $_POST['city'];
$body = $_POST['fname'];
$codeContents = 'mailto:'.$email.'?subject='.urlencode($subject).'&body='.urlencode($body);
include('../Connection/Functions.php');
$conn = new DBClass();
// $sql="UPDATE `tbl_accounts` SET `qrcode`="'.$file.'" WHERE `uid`="'.$uid.'"');
$sql="UPDATE tbl_accounts SET `qrcode` = '$file' WHERE `uid` = '$uid'";
if($conn->query($sql)===true){
QRcode::png($codeContents, $path.''.$file, QR_ECLEVEL_L, 5);
header('location:../apartnerQrcode?msg= Data added Successfully');
}
else{
header('location:../apartnerQrcode?msg= Faild!!');
}
}
?>
Download Php qrcode libery fro github and include it on qrcode.php page
https://github.com/giansalex/phpqrcode/tree/master/src
include(‘../libs/phpqrcode/qrlib.php’);
Create a folder where you want to save the QRcode
$path =’../temp/’;
If you want to full source code you can msg or comment me.
Thanks..
Hi in this article i am going to show how to send multiple files attachment mail in Laravel. It’s simple example of Laravel send multiple attachment in mail. I explained simply …
so, let’s follow bellow steps:
Step 1 – Install Laravel Fresh Application
Use this command then download laravel project setup :
Step 2 - Set Mail Configuration You have to add your gmail smtp configuration, open your .env file and add your configration. .envcomposer create-project --prefer-dist laravel/laravel blog
MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=your_username MAIL_PASSWORD=your_password MAIL_ENCRYPTION=tls
Step 3 - Create Mailable Class with Markdown
php artisan make:mail SendEmail --markdown=emails.mail
app/Mail/SendEmail.php
<?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendEmail extends Mailable { use Queueable, SerializesModels; public $maildata; /** * Create a new message instance. * * @return void */ public function __construct($maildata) { $this->maildata = $maildata; } /** * Build the message. * * @return $this */ public function build() { $email = $this->markdown('emails.mail')->with('maildata', $this->maildata); $attachments = [ // first attachment public_path('\images\img1.jpg'), // second attachment public_path('\images\img2.jpg'), // third attachment public_path('\images\img3.jpg'), ]; // $attachments is an array with file paths of attachments foreach ($attachments as $filePath) { $email->attach($filePath); } return $email; } }
Step 4 - Add Route
<?php use Illuminate\Support\Facades\Route; use App\Http\Controllers\MailController; Route::get('send-mail', [MailController::class, 'sendMail']);Step 5 - Create Controller php artisan make:controller MailController<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Mail\SendEmail; use Mail; class MailController extends Controller { /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function sendMail() { $email = 'xyz@gmail.com'; $maildata = [ 'title' => 'Laravel Mail Attach Multiple Files', ]; Mail::to($email)->send(new SendEmail($maildata)); dd("Mail has been sent successfully"); } }
Step 6 - Add View File resources/views/emails/sendMail.blade.php
@component('mail::message') # {{ $maildata['title'] }} Hello Dev. Thanks, {{ config('app.name') }} @endcomponent
You can run your project by using following command: php artisan serve Now open this url: http://localhost:8000/send-mail
Hi in this article I am going to show how to implement Email SMTP using PHP Mailer. First you have to download PHPmailer library from github link is given below. https://github.com/PHPMailer/PHPMailer/tree/5.2-stable …
First you have to download PHPmailer library from github link is given below.
https://github.com/PHPMailer/PHPMailer/tree/5.2-stable
Chose stable version
Go to your public_html folder and upload the Library and extract the file.
Create a file contact.php in a root director. You can create a file name whatever you want.
contact.php
<div class=”col-md-8″><div class=”cp-wrapper”><h4>Leave A Message!</h4><h2 class=”mail-failed text-danger”></h2><h2 class=”mail-status text-success”></h2><form class=”cf” id=”FormC”><div class=”row”><div class=”col-md-6″><div class=”form-group”><label>Your Name*</label><input type=”text” id=”name” name=”name” class=”form-control” placeholder=”Your Name Here”></div></div><div class=”col-md-6″><div class=”form-group”><label>Email Address*</label><input type=”email” id=”email” name=”email” class=”form-control” placeholder=”Email Address Here”></div></div><div class=”col-md-6″><div class=”form-group”><label>Subject Line*</label><input type=”text” class=”form-control” id=”subject” name=”subject” placeholder=”Subject Of Massage”></div></div><div class=”col-md-6″><div class=”form-group”><label>Telephone Number*</label><input type=”text” id=”phone” name=”phone” class=”form-control” placeholder=”Phone Number”></div></div><div class=”col-md-12″><div class=”form-group”><label>Your Message*</label><textarea class=”form-control” id=”body” name=”body” placeholder=”Write Your Message”></textarea></div><button type=”button” id=”contactUS” name=”contactUS” class=”cf-btn”>Send Now</button><!– <div class=”cf-msg” style=”display: none;”></div> –></div></div></form></div></div>
<?phpinclude(‘script.js.php’);?>
<script>$(document).ready(function() {$(‘#contactUS’).click(function(e){e.preventDefault();// alert(“hjkhkjhkj”);var name =$(“#name”).val();var email =$(“#email”).val();var phone =$(“#phone”).val();var subject =$(“#subject”).val();var body =$(“#body”).val();// console.log(name);// console.log(email);// console.log(phone);// console.log(subject);// console.log(body);if(name==null || name==””,email==null || email==””,phone==null || phone==””,subject==null || subject==””,body==null || body==””){alert(“Please Fill All Required Field”);return false;}else{$.ajax({url:’/ajax/sendEmail.php’,method:’POST’,data:{name: name,email: email,phone: phone,subject: subject,body: body},dataType:’json’,success: function(result){if(result == 1){console.log(result);$(‘#FormC’)[0].reset();$(‘.mail-status’).show();$(‘.mail-status’).html(‘Your Message has been Sent!!’);$(‘.mail-status’).delay(4000).fadeOut(‘slow’);}else{$(‘.mail-failed’).show();$(“.mail-failed”).html(‘Something Error!! Your Message not been Sent!!’);$(‘.mail-failed’).delay(4000).fadeOut(‘slow’);}}});}});});</script>
Now Create a folder name ajax and under the ajax folder create a file
<?phpheader(‘Content-Type: application/json’);include(‘../Connection/Functions.php’); //Database Conectivityrequire “../PHPMailer/PHPMailerAutoload.php”;// Data Come from database$edata = ShowEmailSetting();$oEmail = $edata[’emailUser’];$oPass = $edata[’emailPass’];$osmtp = $edata[‘esmtp’];$oPort = $edata[‘eport’];$oEmailEnc= $edata[’emailenc’];$oreply= $edata[’emsilreply’];function smtpmailer($to, $from, $from_name, $subject, $body){global $oEmail,$oPass,$osmtp,$oPort,$oEmailEnc;$mail = new PHPMailer();// $mail->SMTPDebug =3;$mail->IsSMTP();$mail->SMTPAuth = true;$mail->SMTPSecure = $oEmailEnc;$mail->Host =$osmtp;$mail->Port = $oPort;$mail->Username = $oEmail;$mail->Password = $oPass;// $mail->SMTPAuth = true;// $mail->SMTPSecure = ‘ssl’;// $mail->Host =’mail.example.com’;// $mail->Port = 465;// $mail->Username = ‘contact@example.com’;// $mail->Password = ‘yourpass’;$mail->IsHTML(true);$mail->From=$oEmail;$mail->FromName=$from_name;$mail->Sender=$from;$mail->AddReplyTo($from, $from_name);$mail->Subject = $subject;$mail->Body = “<table><tr><th>Name</th><th>Email</th><th>Phone</th><th>Subject</th><th>Message</th></tr><tr><td>”.$_POST[“name”].”</td><td>”.$_POST[“email”].”</td><td>”.$_POST[“phone”].” </td><td>”.$_POST[“subject”].”</td><td>”.$_POST[“body”].”</td></tr></table>”;$mail->AddAddress($to);if(!$mail->Send()){echo ‘0’;}else{echo ‘1’;}}$to =$oreply;$from = $_POST[’email’];$name = $_POST[‘name’];$subj = $_POST[‘subject’];$msg = $_POST[‘body’];$error=smtpmailer($to,$from, $name,$subj,$msg);?>
Implement Limit login with Mysql Database using Core PHP Hi, In this article i am going to show how to implement limit login system using PHP. Create the Database Open your PHPMyAdmin and …
Hi, In this article i am going to show how to implement limit login system using PHP.
Open your PHPMyAdmin and create a new databse naming dbase. Then navigate to database SQL Tab and paste the SQL script below
CREATE TABLE `loginlogs` (
`id` int(11) NOT NULL,
`IpAddress` varbinary(16) NOT NULL,
`TryTime` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `tbl_user` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`salt` varchar(50) NOT NULL,
`password` varchar(200) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Here I am using salt for more secure your password. you can avoid it or simple using MD5 . Here I am only try to explain how to implement login attempts restriction.
Login Page
<?phpsession_start();if (isset($_SESSION[’email’])){?><script>window.location.href=”/admin”</script><?}else{?><meta name=”viewport” content=”width=device-width, initial-scale=1.0″><!– Latest compiled and minified CSS –><link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css”><!– jQuery library –><script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js”></script><!– Latest compiled JavaScript –><script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js”></script><!—— Include the above in your HEAD tag ———-><script type=”text/javascript” src=”script/validation.min.js”></script><script type=”text/javascript” src=”script/login.js”></script><style>/* BASIC */body {font-family: “Poppins”, sans-serif;height: 100vh;}a {color: #92badd;display:inline-block;text-decoration: none;font-weight: 400;}h2 {text-align: center;font-size: 16px;font-weight: 600;text-transform: uppercase;display:inline-block;margin: 40px 8px 10px 8px;color: #cccccc;}/* STRUCTURE */.wrapper {display: flex;align-items: center;flex-direction: column;justify-content: center;width: 100%;min-height: 100%;padding: 20px;}#formContent {-webkit-border-radius: 10px 10px 10px 10px;border-radius: 10px 10px 10px 10px;background: #fff;padding: 30px;width: 90%;max-width: 450px;position: relative;padding: 0px;-webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);text-align: center;}#formFooter {background-color: #f6f6f6;border-top: 1px solid #dce8f1;padding: 25px;text-align: center;-webkit-border-radius: 0 0 10px 10px;border-radius: 0 0 10px 10px;}/* TABS */h2.inactive {color: #cccccc;}h2.active {color: #0d0d0d;border-bottom: 2px solid #5fbae9;}/* FORM TYPOGRAPHY*/input[type=button], input[type=submit], input[type=reset] {background-color: #56baed;border: none;color: white;padding: 15px 80px;text-align: center;text-decoration: none;display: inline-block;text-transform: uppercase;font-size: 13px;-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);-webkit-border-radius: 5px 5px 5px 5px;border-radius: 5px 5px 5px 5px;margin: 5px 20px 40px 20px;-webkit-transition: all 0.3s ease-in-out;-moz-transition: all 0.3s ease-in-out;-ms-transition: all 0.3s ease-in-out;-o-transition: all 0.3s ease-in-out;transition: all 0.3s ease-in-out;}input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {background-color: #39ace7;}input[type=button]:active, input[type=submit]:active, input[type=reset]:active {-moz-transform: scale(0.95);-webkit-transform: scale(0.95);-o-transform: scale(0.95);-ms-transform: scale(0.95);transform: scale(0.95);}input[type=text],[type=password] {background-color: #f6f6f6;border: none;color: #0d0d0d;padding: 15px 32px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 5px;width: 85%;border: 2px solid #f6f6f6;-webkit-transition: all 0.5s ease-in-out;-moz-transition: all 0.5s ease-in-out;-ms-transition: all 0.5s ease-in-out;-o-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;-webkit-border-radius: 5px 5px 5px 5px;border-radius: 5px 5px 5px 5px;}input[type=text],[type=password]:focus {background-color: #fff;border-bottom: 2px solid #5fbae9;}input[type=text],[type=password]:placeholder {color: #cccccc;}/* ANIMATIONS *//* Simple CSS3 Fade-in-down Animation */.fadeInDown {-webkit-animation-name: fadeInDown;animation-name: fadeInDown;-webkit-animation-duration: 1s;animation-duration: 1s;-webkit-animation-fill-mode: both;animation-fill-mode: both;}@-webkit-keyframes fadeInDown {0% {opacity: 0;-webkit-transform: translate3d(0, -100%, 0);transform: translate3d(0, -100%, 0);}100% {opacity: 1;-webkit-transform: none;transform: none;}}@keyframes fadeInDown {0% {opacity: 0;-webkit-transform: translate3d(0, -100%, 0);transform: translate3d(0, -100%, 0);}100% {opacity: 1;-webkit-transform: none;transform: none;}}/* Simple CSS3 Fade-in Animation */@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }.fadeIn {opacity:0;-webkit-animation:fadeIn ease-in 1;-moz-animation:fadeIn ease-in 1;animation:fadeIn ease-in 1;-webkit-animation-fill-mode:forwards;-moz-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-duration:1s;-moz-animation-duration:1s;animation-duration:1s;}.fadeIn.first {-webkit-animation-delay: 0.4s;-moz-animation-delay: 0.4s;animation-delay: 0.4s;}.fadeIn.second {-webkit-animation-delay: 0.6s;-moz-animation-delay: 0.6s;animation-delay: 0.6s;}.fadeIn.third {-webkit-animation-delay: 0.8s;-moz-animation-delay: 0.8s;animation-delay: 0.8s;}.fadeIn.fourth {-webkit-animation-delay: 1s;-moz-animation-delay: 1s;animation-delay: 1s;}/* Simple CSS3 Fade-in Animation */.underlineHover:after {display: block;left: 0;bottom: -10px;width: 0;height: 2px;background-color: #56baed;content: “”;transition: width 0.2s;}.underlineHover:hover {color: #0d0d0d;}.underlineHover:hover:after{width: 100%;}/* OTHERS */*:focus {outline: none;}#icon {width:60%;}</style><div class=”wrapper fadeInDown”><div id=”formContent”><!– Tabs Titles –><!– Icon –><div class=”fadeIn first”><img src=”/admin/logo.png” id=”icon” alt=”User Icon” /></div><div id=”error”></div><!– Login Form –><form class=”form-login” method=”post” id=”login-form”><input type=”text” id=”user_email” class=”fadeIn second” name=”user_email” placeholder=”Email”><span id=”check-e”></span><input type=”password” id=”password” class=”fadeIn third” name=”password” placeholder=”Password”><button type=”submit” class=”btn btn-success” name=”login_button” id=”login_button”><span class=”glyphicon glyphicon-log-in”></span> Sign In</button><div id=”result”><?php echo $msg?></div></form><!– Remind Passowrd –><div id=”formFooter”><a class=”underlineHover” href=”#”>Forgot Password?</a></div></div></div><?}?>
First we have to start session
$(‘document’).ready(function() {/* handling form validation */$(“#login-form”).validate({rules: {password: {required: true,},user_email: {required: true,email: true},},messages: {password:{required: “please enter your password”},user_email: “please enter your email address”,},submitHandler: submitForm});/* Handling login functionality */function submitForm() {var data = $(“#login-form”).serialize();$.ajax({type : ‘POST’,url : ‘login.php’,data : data,beforeSend: function(){$(“#error”).fadeOut();$(“#login_button”).html(‘<span class=”glyphicon glyphicon-transfer”></span> sending …’);},success : function(response){if(response==”ok”){$(“#login_button”).html(‘<img src=”ajax-loader.gif” /> Signing In …’);setTimeout(‘ window.location.href = “/admin”; ‘,4000);} else {$(“#error”).fadeIn(1000, function(){$(“#error”).html(‘<div class=”alert alert-danger”> <span class=”glyphicon glyphicon-info-sign”></span> ‘+response+’ !</div>’);$(“#login_button”).html(‘<span class=”glyphicon glyphicon-log-in”></span> Sign In’);});}}});return false;}});
<?phpsession_start();require(‘../admin/Connection/DBClass.php’);$db = new DBClass();// $msg=”;if(isset($_POST[‘login_button’])) {$time=time()-60;$ip_address=getIpAddr();// Getting total count of hits on the basis of IP$ipcount= $db->query(“select count(*) as total_count from loginlogs where TryTime > $time and IpAddress=’$ip_address'”);$check_login_row=mysqli_fetch_assoc($ipcount);$total_count=$check_login_row[‘total_count’];if($total_count==3){// $msg=”To many failed login attempts. Please login after 30 sec”;echo “To many failed login attempts. Please login after 60 sec <br/>”;}else{$user_email = trim($_POST[‘user_email’]);$resultset = $db->query(“SELECT * FROM `tbl_user` WHERE `email`=’$user_email'”);if($resultset->num_rows >0){$data = $resultset->fetch_assoc();$salt = $data[‘salt’];$password = $_POST[“password”];$dbpassword = $data[“password”];if(sha1($salt.$password)== $dbpassword){echo “ok”;$_SESSION[‘userid’] = $data[‘id’];$_SESSION[’email’] = $data[’email’];// print_r($_SESSION);$db->query(“delete from loginlogs where IpAddress=’$ip_address'”);}else{$total_count++;$rem_attm=3-$total_count;if($rem_attm==0){// $msg=”To many failed login attempts. Please login after 300 sec”;echo “To many failed login attempts. Please login after 60 sec”;}else{// $msg=”Please enter valid login details.<br/>$rem_attm attempts remaining”;echo “Please enter valid login details.<br/>$rem_attm attempts remaining”;}$try_time=time();$db->query(“INSERT INTO `loginlogs`(`IpAddress`, `TryTime`) VALUES (‘$ip_address’,’$try_time’)”);// echo ‘Wrong Password’;}}}}// Getting IP Addressfunction getIpAddr(){if (!empty($_SERVER[‘HTTP_CLIENT_IP’])){$ipAddr=$_SERVER[‘HTTP_CLIENT_IP’];}elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])){$ipAddr=$_SERVER[‘HTTP_X_FORWARDED_FOR’];}else{$ipAddr=$_SERVER[‘REMOTE_ADDR’];}return $ipAddr;}?>
Database Connectivityrequire(‘../admin/Connection/DBClass.php’);DBClass.php
<?phprequire_once( ‘DBSettings.php’ );class DBClass extends DatabaseSettings{var $classQuery;var $link;var $errno = ”;var $error = ”;function __construct(){$settings = DatabaseSettings::getSettings();$host = $settings[‘dbhost’];$name = $settings[‘dbname’];$user = $settings[‘dbusername’];$pass = $settings[‘dbpassword’];$this->link = new mysqli( $host , $user , $pass , $name );}function query( $query ) {$this->classQuery = $query;return $this->link->query( $query );}function lastInsertedID(){if($this->link->insert_id)return $this->link->insert_id;else$this->link->errno;}}?>
Disable PHP Errors PHP warnings and notices help builders debug troubles with their code. but it seems extremely unprofessional while they may be seen to all of your website visitors. In this article, we are able to show you how to without difficulty flip off PHP mistakes in WordPress. Why Should Turn off PHP Errors in …
PHP warnings and notices help builders debug troubles with their code. but it seems extremely unprofessional while they may be seen to all of your website visitors. In this article, we are able to show you how to without difficulty flip off PHP mistakes in WordPress.
Why Should Turn off PHP Errors in WordPress?
occasionally the WordPress errors log file will create huge headache for a few users since it creates huge file in a few instances. it’s going to once in a while have an effect on the hosting too when you have most effective less area for your server. in order to avoid logging of blunders
For this part, you will need to edit the wp-config.php file.
Go to public_html directory and find wp-config.php file.
define(
'WP_DEBUG'
, true);
It is also possible, that this line is already set to false. In that case, you’ll see the following code:
define(
'WP_DEBUG'
, false);
In either case, you need to replace this line with the following code:
ini_set
(
'display_errors'
,
'Off'
);
ini_set
(
'error_reporting'
, E_ALL );
define(
'WP_DEBUG'
, false);
define(
'WP_DEBUG_DISPLAY'
, false);
Save the changes.
If you are working on a local server or staging area, then you should turn on error reporting.
define(
'WP_DEBUG'
, true);
define(
'WP_DEBUG_DISPLAY'
, true);
This code will allow WordPress to start displaying PHP errors, warnings, and notices again.
Thanks for reading….
Adding multiple white areas and line breaks in PHP code is vital for data format and displaying text properly on an online page. Strings from alternative software system is also victimisation …
Adding multiple white areas and line breaks in PHP code is vital for data format and displaying text properly on an online page. Strings from alternative software system is also victimisation totally different spacing characters and wish to be born-again to HTML tags. sadly, some pc architectures use totally different spacing characters than others. making areas in PHP is completed principally through the “echo” perform.
Open the PHP file in a text editor, such as Windows Notepad.
Add a single space between PHP variables by adding the code “echo $variable1 .” “. $variable2;.”
Add multiple spaces by adding the code “echo $variable1 .” “. $variable2;.” The ” ” entity represents a non-breaking space. Using ” ” frequently doesn’t work because web browsers collapse multiple spaces into one.
Add a space as a line break with the code “echo “\r\n””, “echo ”
“” or “echo “\n”.” The “\n” character represents a new line and the “\r” character represents a carriage return.
Call the PHP “nl2br” function to replace every “\r”, “\n”, “\n\r” and “\r\n” entity in a string with an HTML line break, ” ” or ”
“, by adding the code “echo nl2br(“line1\nline2″);.” This will output “line1 ” and then “” on the next line.
Save the PHP file, close it and then load it on your server.
is used for adding space in html and php
You can add
html in between name and profession
$spName .= $row['firstname'];
$spPro = $row['profession'];
$options .= '<option value='. $spName . '' . $spPro .'>' . $row['firstname'] . ' ' . $row['lastname'] . ' - ' . $row['profession'] . '</option>';
// or i could also do it this way.
$options .= '<option value='. $row['firstname'] . ' ' . $row['profession'] .'>' . $row['firstname'] . ' ' . $row['lastname'] . ' - ' . $row['profession'] . '</option>';
The following HTML5 tags provide the required components to add a file selector and an upload button to any web page: <input id=”fileupload” type=”file” name=”fileupload” /> <button id=”upload-button” onclick=”uploadFile()”> Upload </button> …
The following HTML5 tags provide the required components to add a file selector and an upload button to any web page:
<input id="fileupload" type="file" name="fileupload" /> <button id="upload-button" onclick="uploadFile()"> Upload </button>
The button kicks off a method named uploadFile(), which contains the JavaScript file upload logic.
<script> async function uploadFile() { let formData = new FormData(); formData.append("file", fileupload.files[0]); await fetch('/upload.php', { method: "POST", body: formData }); alert('The file has been uploaded successfully.'); } </script>
The above script tag contains nothing but pure JavaScript. There’s no jQuery or Dojo thrown into the mix and the logic is straightforward:
All the HTML and JavaScript logic will be contained in a single file named uploader.html. The complete HTML looks as follows:
<!DOCTYPE html> <html> <head> <title> Ajax JavaScript File Upload Example </title> </head> <body> <!-- HTML5 Input Form Elements --> <input id="fileupload" type="file" name="fileupload" /> <button id="upload-button" onclick="uploadFile()"> Upload </button> <!-- Ajax JavaScript File Upload Logic --> <script> async function uploadFile() { let formData = new FormData(); formData.append("file", fileupload.files[0]); await fetch('/upload.php', { method: "POST", body: formData }); alert('The file has been uploaded successfully.'); } </script> </body> </html>
When an asynchronous JavaScript file upload happens, a server-side component must exist to handle the incoming file and store it.it requires a file named upload.php that contains a small PHP script to save the incoming file to a folder named uploads:
<?php /* Get the name of the uploaded file */ $filename = $_FILES['file']['name']; /* Choose where to save the uploaded file */ $location = "upload/".$filename; /* Save the uploaded file to the local filesystem */ if ( move_uploaded_file($_FILES['file']['tmp_name'], $location) ) { echo 'Success'; } else { echo 'Failure'; } ?>
The PHP script is also straightforward. It obtains the name of the file being uploaded, and then creates a spot in a folder named upload to save the file. PHP’s move_uploaded_file method is then used to save the uploaded file to this new location.
The files used in this example, along with a folder named upload, must be added to the htdocs folder of AHS. When a client accesses the uploader.html file through a browser, the client will be able to upload a file to the server using Ajax and pure JavaScript.
In this short instructional exercise we will cover a htaccess deny admittance to document augmentation. we should examine about htaccess limit admittance to document augmentation. This article will give you straightforward …
In this short instructional exercise we will cover a htaccess deny admittance to document augmentation. we should examine about htaccess limit admittance to document augmentation. This article will give you straightforward illustration of htaccess deny admittance to php records in transfers organizer. bit by bit make sense of forestall direct admittance to php document htaccess. You simply need to a stage to done htaccess cripple document expansion access.
# Deny access to .htaccess
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
To conceal every one of the substance of the catalog without illegal message, utilize the IndexIgnore order essentially.
# Hide the contents of directories
IndexIgnore *
To hide some filetypes only, use
# Hide files of type .png, .zip, .jpg, .gif and .doc from listing
IndexIgnore *.png *.zip *.jpg *.gif *.doc
3. Prevent access to certain files
Even if you remove directories and files from listing, they are still accessible if you type the path.
To remove unauthorized access to certain file extensions, use
# Deny access to files with extensions .jpg, .psd, .log, .sh,jpg
<FilesMatch "\.(?:inc|jpg|jpeg|rb)$">
Order allow,deny
Deny from all
</FilesMatch>
# Deny access to filenames starting with dot(.)
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>
You may also password protect files and directories and store the passwords in a .htpasswd file.
# Password protect files
<FilesMatch "^(execute|index|myfile|anotherfile)*$">
AuthType Basic
AuthName "Mypassword"
AuthUserFile <Full Server Path to .htpasswd file>/.htpasswd
Require valid-user
</FilesMatch>