Posts

Showing posts from August, 2020

Add backend validation in wordpress using php

Validations  :-                     validation checks given input is valid or not. There are two types of validation.                     1) Frontend Validation i.e.  client side Validation.                     2) Backend Validation i.e. Server side validation.  (if you want to check frontend validation code go to this url:  https://programmingtechnologys.blogspot.com/2020/08/realtime-front-end-validations.html )             Code :- <?php include_once '../wp-load.php'; global $wpdb;    class userInformation{ $firstName = $_POST['first_name']; $lastName = $_POST['last_name']; $mobileNum = $_POST['mobile_num']; $emailId = $_POST['email']; $password = $_POST['password']; $cPassword = $_POST['cpassword']; public function __construct(){ } /** * User registration fu...

Generate tambola (housie) game ticket using php

Image
Tambola game logic :- Tambola ticket consists 3 rows and 9 columns which makes 27 spaces.   Each row has a total 5 numbers printed and total 4 spaces are empty. And column can have 1,2 or 3 numbers printed on it. Number should not be repeat in each spaces. Code :- <?php $numberOfRows = 3;          //decides number of rows $totalNumber = 100;           //decides total number $numberOfColoumn = 9;   // decides number of coloums $emptySpace = 4;              // decides empty spaces  $number = array_chunk(range(1,$totalNumber), 10); $col1 = []; $array1 = $number[0]; $randIndex1 = array_rand($array1,$numberOfRows); for ($i=0; $i < $numberOfRows; $i++) {  $col1[$i] =  $array1[$randIndex1[$i]]; } $col2 = []; $array1 = $number[1]; $randIndex1 = array_rand($array1,$numberOfRows); for ($i=0; $i < $numberOfRows; $i++) {  $col2[$i] =  $array1[$randIndex1[...