Posts

Showing posts with the label Coding Help

How To Secure Apache with Let's Encrypt on Ubuntu (Digital Ocean)

Image
  Introduction This tutorial will show you how to set up a TLS/SSL certificate from Let’s Encrypt on an Ubuntu 16.04 server running Apache as a web server. SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free. Prerequisites In order to complete this guide, you will need: An Ubuntu 16.04 server with a non-root sudo-enabled user, which you can set up by following our Initial Server Setup guide The Apache web server installed with one or more domain names properly configured through Virtual Hosts that specify ServerName . When you are ready to move on, log into your server using your sudo-enabled account. Step 1 — Install the Let’s Encrypt Client Let’s Encrypt certificates are fetched via client software running on your server. The official client is called Certbot, and i...

PHP Barcode Generator

Image
  Step 1 :- First we have to create a form named index.php and paste below code : - <!DOCTYPE html> <html> <head>     <title></title>     <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> </head> <body>     <div class="container">             <div class="row">                 <div class="col-md-4">                             <form method="post">                                     <div class="row">           ...

Indian Mobile No. Validation using Javascript and Jquery

Image
  Type 1 Validation using Javascript : - <!DOCTYPE html> <html> <head>     <title>Indian Mobile No. Validation</title> </head> <body> <h1 style="text-align:center">Indian Mobile No. Validation</h1> <form>     <table align="center" border="30">              <tr>             <td>Mobile No.</td>             <td><input type="text" id="mobile" maxlength="10"  placeholder="Enter Your Mobile No."  /></td>         </tr>                  <tr>             <td colspan="2">                 <input type="button"...

How to get URL data in Codeigniter

Image
  This is the example for it  :-  http://websitename.com/controller_name/function_name/parameter1/parameter2/parameter3 it will return $this ->uri->segment( 1 ); // controller $this ->uri->segment( 2 ); // function To get parameter1 in codeigniter : - $this->uri->segment(3); To get parameter2 in codeigniter : - $this->uri->segment(4);  To get parameter3 in codeigniter : - $this->uri->segment(5);  

How can I refresh a form JQuery

Image
   Do you have this? < form id = "form" > ..... </ form > If you do, it should work.   $( "#form" )[ 0 ].reset();   If you don't have an "id" for your form tag, you should use    < form > ..... </ form > $( "form" )[ 0 ].reset();  

Indian Rupee Sign in HTML CODE

Image
  <!DOCTYPE html> <html> <style> body {   font-size: 20px; } </style> <body> <span style='font-size:100px;'>&#8377;</span> <p>I will display &#8377;</p> <p>I will display &#x20B9;</p> </body> </html>

Logout Function in PHP

Image
   This is for Codeigniter :- function logout ( ) { $user_data = $this ->session->all_userdata(); foreach ($user_data as $key => $value) { $this ->session->unset_userdata($key); } $this ->session->sess_destroy(); /////Here you have to write redirect url example : redirect("login");   }     This is for Core PHP:- function logout ( ) { session_start();  $_SESSION['email']=""; /// Here we are showing example to set empty to session key's value  session_destroy(); /////Here you have to write redirect url example : header("Location: login.php");    }  

Remove warning messages in PHP

 You really should fix whatever's causing the warning, but you can control visibility of errors with error_reporting() . To skip warning messages, you could use something like:   error_reporting(E_ERROR | E_PARSE);

Base URL Setting in Codeigniter

Copy below code and paste inside the config.php file in Codeigniter . You will get this file in Application/Config/config.php  $config['base_url'] = $config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ?  "https" : "http")."://".$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Form Validation in Pure JS using Form Element Name

 In this post you will learn how to get value from form elements and how to validate whether it filled or not and selected or not . We are trying to show you all basic tags with validation . <!DOCTYPE html> <html> <head>     <title></title> </head> <body>     <h1>Pure Javascript Form Validation using form Element Name</h1>     <form name="myform">         <table align="center" border="30">             <tr>             <td>Gender</td>             <td>                 <input type="radio" name="gender" value="Female" />&nbsp;&nbsp;Female &nbsp;&nbsp;             ...

How to take photo from mobile camera and upload it using php ?

 First we write front end code : - <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             }         ...

How to take photo from camera and its preview in Jquery Mobile ?

 Here you will get code for preview of image captured by your device.   <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             ...

how to upload file in jquery mobile using php ?

 First of all we need a folder to store uploaded file . Here I have upd named folder but its your choice to whatever you can named it . below is working code for file upload in jquery mobile . <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {          ...

How to upload file in core php ?

 Create any file name but care about its extension should be .php    <!DOCTYPE html> <html>     <head>         <title>File Upload</title>     </head>     <body>         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">             <input type="file" name="csv_file">             <input type="submit" name="submit">         </form>         <?php         if (isset($_POST['submit'])) {             echo "<p>" . $_POST['csv_file'] . " => file input successfull</p>"; ...

How to protect a class to be inherited ?

  Answer : By adding a final keyword in before class name . Example :                                  Class final Class_name                          { Code will be here }

Code for Google Translator for Website with Indian Languages

Paste this code onto your website Copy and paste the following code snippets onto every page you want to translate Place this meta tag before the closing </head>:- ————————————————————————————- <meta name=”google-translate-customization” content=”76732106efc70d8b-05ad2fc8af3e500b-ge0b18d68b0571536-16″ /> ————————————————————————————– Place this snippet where you’d like to display the Website Translator plugin on your page:- ————————————————————————————- <div id=”google_translate_element”></div><script type=”text/javascript”> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: ‘en’, includedLanguages: ‘bn,en,gu,hi,kn,pa,ta,te,ur’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, ‘google_translate_element’); } </script><script type=”text/javascript” src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>