Basic login function example in php?
Basic login function example in php //redirect to dashboard if session is active code session_start(); if(isset($_SESSION[‘ID’])){ dashboard(); } //dashboard redirect code used in function.php function dashboard(){ echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().’/dashboard/”;</script>’; } //php code if(isset($_POST[‘login’])){ extract($_POST); global $wpdb; $table_name = $wpdb->prefix . “shopkeeper_signup”; $results = $wpdb->get_results(“select * from $table_name where phonenumber LIKE BINARY ‘$phonenumber’ and pass LIKE […]
How to make password case sensitive in php ?
Make password case sensitive in php You can use LIKE BINARY in your query.. Like this: SELECT * FROM table_name WHERE column_name LIKE BINARY ‘search_string’ this will check “search_string” data in case sensitive
How to make auto filled place transparent in css?
Make auto filled place transparent in css //paste this code in stylesheet (for input fields) @-webkit-keyframes autofill { to { color: #fff; background: transparent; } } input:-webkit-autofill { -webkit-transition-delay: 99999s; -webkit-animation-name: autofill; -webkit-animation-fill-mode: both; }
How to validate a form using jquery?
Validate a form using jquery //contact form validation jquery code $(“.contact-submit”).click(function(e){ //e.preventDefault(); var firstname = $(“.contact-firstname”).val(); var lastname = $(“.contact-lastname”).val(); var email = $(“.contact-email”).val(); var phone = $(“.contact-phone”).val(); var message = $(“.contact-message”).val(); if(firstname == “”){ $(“.contact-firstname”).focus(); $(“.first-i”).html(“Please input firstname here”); return false; } if(lastname == “”){ $(“.contact-lastname”).focus(); $(“.contact-lastname”).after(“<i>Please input lastname here</i>”) return false; } if(email […]
What is a ajax basic tutorial for form submit?
ajax basic tutorial for form submit //ajax tutorial starts here <script> $(“.submit-btn”).click(function(e){ $(‘.popup’).css(“display”,”flex”); var username = $(“.username”).val(); var data = { ‘action’:’form_action’, ‘username’:username, } $.post(myajax.ajaxurl,data,function(response){ $(“.result”).html(response); $(‘.popup’).css(“display”,”none”); }); e.preventDefault(); }); </script> //function.php <?php function grahak_scripts(){ wp_enqueue_script(“grahak-script”,get_stylesheet_directory_uri().’/custom.js’, array(‘jquery’)); wp_localize_script(‘grahak-script’,’myajax’,array(‘ajaxurl’=>admin_url(‘admin-ajax.php’))); wp_enqueue_style(“grahak-style”,get_stylesheet_directory_uri().’/font-awesome.css’); } add_action(“wp_enqueue_scripts”,”grahak_scripts”); function form_action(){ $username = $_POST[‘username’]; global $wpdb; $table_name = $wpdb->prefix . “ajaxtest”; if(($wpdb->insert($table_name, array( […]
How to get time difference and active status in chatting system using php?
Get time difference and active status in chatting system using php <?php $now_timestamp = strtotime(date(‘Y-m-d H:i:s’)); $diff_timestamp = $now_timestamp – strtotime($end_time); if($diff_timestamp < 60){ echo “active now”; } if($diff_timestamp>=60 && $diff_timestamp<3600){ $get_diff = $diff_timestamp/60; echo “active ” . intval($get_diff) . “m ago”; } if($diff_timestamp>=3600 && $diff_timestamp<86400){ $get_diff = $diff_timestamp/3600; echo “active ” . intval($get_diff) . […]