Posts

JavaScript Password Strength Checker

JavaScript Password Strength Checker  document.addEventListener("DOMContentLoaded", function () {     const passwordInput = document.getElementById("password");     const strengthContainer = document.getElementById("oneid-password-strength-container");     passwordInput.addEventListener("input", function () {         const strength = checkPasswordStrength(passwordInput.value);         strengthContainer.textContent = `Strength: ${strength}`;         updateStrengthColor(strengthContainer, strength);     });     function checkPasswordStrength(password) {         let strength = 0;         if (password.length >= 8) strength++;         if (/[A-Z]/.test(password)) strength++;     ...

Hosting a Laravel 11 project on cPanel shared hosting

  Hosting a Laravel 11 project on cPanel shared hosting involves several steps since Laravel is built to work with a virtual host setup (like localhost with public/ as root), but cPanel typically uses public_html/ as the root directory. Here’s a full guide to help you: ✅ Prerequisites Laravel 11 project ready on your local machine. cPanel access (via your hosting provider). PHP version on server must be PHP 8.2+ . Composer installed on server (optional but helpful). MySQL database (if needed) created in cPanel. 📁 Step-by-Step Hosting Guide 1. Structure Your Project for cPanel By default, Laravel uses public/ as the web root. But cPanel uses public_html/ . So you need to move the contents of Laravel's public/ folder into public_html/ , and update paths accordingly. Let’s say your project folder is called laravel11app . Option A: Simple Adjustment (Recommended for shared hosting) Compress your entire Laravel project , excluding the vendor folder (optiona...

fixHTML

 <?php function fixHTML($html) {     libxml_use_internal_errors(true);     $doc = new DOMDocument();     $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);     libxml_clear_errors();     return $doc->saveHTML(); }  ?> ---------------------------------------------------------------------- <? = fixHTML ( htmlspecialchars_decode ( stripslashes ( $a [ 'body' ]))) ?>

Battery report using cmd

 powercfg /batteryreport    

php - get vimeo video id from url

 function getVimeoVideoIdFromUrl($url = '') {     $regs = array();     $id = '';     if (preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\#?)(?:[?]?.*)$%im', $url, $regs)) {         $id =   $regs[3];     } //    else //    { //        $id = substr($url,10,strlen($url)); //    }     return $id; }

Musk Email Id in PHP

  function obfuscate_email ( $email ) { $em = explode ( "@" , $email ); $name = implode ( '@' , array_slice ( $em , 0 , count ( $em )- 1 )); $len = floor ( strlen ( $name )/ 2 ); return substr ( $name , 0 , $len ) . str_repeat ( '*' , $len ) . "@" . end ( $em ); }