<?php// Write your IP instead of xxx.xxx.xxx.xxx if(@$_SERVER[‘REMOTE_ADDR’] == ‘xxx.xxx.xxx.xxx’|| @$_SERVER[‘HTTP_X_FORWARDED_FOR’] == ‘xxx.xxx.xxx.xxx’ ){ define( ‘TESTINGMOD’,TRUE);}else{ define( ‘TESTINGMOD’,FALSE);} if(TESTINGMOD){ error_reporting(E_ALL); ini_set(‘display_errors’, 1); // Write test […]
How can I remove a particular value from an array in JavaScript with Example?
<!DOCTYPE html><html> <head> <title>How can I remove a particular value from an array in JavaScript with Example? -PHP Kishan</title> <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js” crossorigin=”anonymous”></script> <script> jQuery(document).ready(function(){ […]
How to redirect another webpage using JavaScript?
<!DOCTYPE html><html> <head> <title>How to redirect another webpage using JavaScript? -PHP Kishan</title> <script> function new_Location(newurl) { /* The wwindow.location […]
How to prevent SQL injection in PHP?
<?php$con = mysqli_connect(“localhost”,”my_user”,”my_password”,”my_db”);// Check connectionif (mysqli_connect_errno()) { echo “Failed to connect to MySQL: ” . mysqli_connect_error();}if ($_SERVER[“REQUEST_METHOD”] == “POST”) { //unsafe data $unsafe_name = mysqli_real_escape_string($con, […]
How to connect to mysqli database in php?
Create connection.php file and include all CRUD operation’s file for connect database. <?phperror_reporting(0);$DB_HOST = ‘localhost’;$DB_USER = ‘root’; $DB_PASS = ”;$DB_NAME = ‘mysql’;$conn = mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME);// Check […]
How to Replace Text of the_content in WordPress
If you want to replace keywords and text in the_content? Add the following code to the functions.php file of your WordPress active theme OR in […]
How to define an empty object in PHP?
<?php $ObjAraay = new stdClass(); $ObjAraay->fname = “PHP”; $ObjAraay->lname = “Beginner”; echo “<pre>”; print_r($ObjAraay); echo “</pre>”;?> Result:
How to compare dates greater than in php?
<?php$today = date(‘d-m-Y’); // Date must be in ‘d-m-Y’ format$date = “07-07-2020”; if(strtotime($date) < strtotime($today)){ echo $date .’ date is smaller than today ‘.$today […]
How do I set and get a cookie with jQuery?
<script type=’text/javascript’>function setCookie(key, value) { var expires = new Date(); expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000)); document.cookie = key + […]