├── project ├── assets │ ├── css │ │ └── style.css │ └── images │ │ ├── banner.webp │ │ └── products │ │ ├── 1726679946oppo-a60.png │ │ ├── 1726679907Realme-C53.jpg │ │ ├── 1726679977nokia 3310.png │ │ ├── 1726679865Samsung-A55.jpg │ │ ├── 1726680038xiaomi-poco-x2.jpg │ │ ├── 1726680088Motorola_RAZR_V3i_01.jpeg │ │ └── 1726683627iPhone-15-Plus-(2)-(1)-6945.jpg ├── index.php ├── pages │ ├── logout.php │ ├── update-profile.php │ ├── product.php │ ├── index.php │ ├── login.php │ ├── password-change.php │ ├── my-orders.php │ ├── register.php │ ├── cart.php │ └── checkout.php ├── admin │ ├── footer.php │ ├── index.php │ ├── style.css │ ├── components │ │ ├── slidebar.php │ │ └── navbar.php │ ├── header.php │ ├── add-product.php │ ├── orders.php │ └── all-products.php ├── footer.php ├── header.php └── components │ └── navbar.php ├── test.txt ├── test2.txt ├── test3.txt ├── File inclusion ├── footer.php ├── index.php └── header.php ├── php hw 1 ├── work.zip ├── all plugin.zip ├── Wasim-Assignment EP-7.zip ├── class7 │ ├── vote.php │ ├── odd.php │ ├── number.php │ ├── switch case.php │ ├── bill.php │ └── marriage.php ├── work │ └── work │ │ ├── bill.php │ │ ├── number.php │ │ ├── numchk.php │ │ ├── vote.php │ │ ├── Marriage.php │ │ └── calculator.php └── Wasim-Assignment EP-7 │ └── Wasim-Assignment EP-7.php ├── jquery ├── images │ ├── p1.png │ ├── p2.png │ └── p3.png ├── js │ └── mixed-media-gallery │ │ └── mixed-media-gallery │ │ ├── main-js.js │ │ ├── main-css.css │ │ ├── lightbox-js │ │ ├── cwa-image-lightbox.js │ │ ├── cwa-video-lightbox.js │ │ └── cwa-media-lightbox.js │ │ ├── lightbox-css │ │ └── cwa-lightbox.css │ │ ├── index.html │ │ └── README.md └── index.html ├── uploads ├── 668ecc570dc132.18191594.jpg └── 668ecc74320f19.18334274.jpg ├── namespace ├── class1.php ├── class2.php └── index.php ├── L6-superGlobal.php ├── L13 - Json.php ├── L7-request.php ├── L12 - date.php ├── L10 - sending-email.php ├── L11 - try-catch.php ├── L5-Regular-expression.php ├── L16 - oop.php ├── L9-file-upload.php ├── L1-php-systex.php ├── L14 - file-system.php ├── L17 - oop.php ├── L4-randomPass.php ├── L2-quotes.php ├── php hw 3 └── crud │ └── Shohag │ ├── style.css │ └── crud.php ├── L3-loop.php ├── problems ├── Wasim-Assignment EP-7.php └── array_problems.php ├── L18 - oop.php ├── cmbd257.sql ├── L15 - crud.php ├── php hw 2 ├── Shohag │ └── form.php └── Wasim form Validation Assignment │ └── cc.php └── L8-form-validation.php /project/assets/css/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test.txt: -------------------------------------------------------------------------------- 1 | ha ha ha 2 | ho ho ho 3 | hu hu hu -------------------------------------------------------------------------------- /test2.txt: -------------------------------------------------------------------------------- 1 | Hello World 2 | Hello World 3 | -------------------------------------------------------------------------------- /test3.txt: -------------------------------------------------------------------------------- 1 | ha ha ha 2 | ho ho ho 3 | hu hu hu -------------------------------------------------------------------------------- /project/index.php: -------------------------------------------------------------------------------- 1 | 2 | Footer 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /php hw 1/work.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/php hw 1/work.zip -------------------------------------------------------------------------------- /jquery/images/p1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/jquery/images/p1.png -------------------------------------------------------------------------------- /jquery/images/p2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/jquery/images/p2.png -------------------------------------------------------------------------------- /jquery/images/p3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/jquery/images/p3.png -------------------------------------------------------------------------------- /php hw 1/all plugin.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/php hw 1/all plugin.zip -------------------------------------------------------------------------------- /project/pages/logout.php: -------------------------------------------------------------------------------- 1 | 4 |

Home Page

5 | 6 | -------------------------------------------------------------------------------- /project/assets/images/products/1726679946oppo-a60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726679946oppo-a60.png -------------------------------------------------------------------------------- /project/assets/images/products/1726679907Realme-C53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726679907Realme-C53.jpg -------------------------------------------------------------------------------- /project/assets/images/products/1726679977nokia 3310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726679977nokia 3310.png -------------------------------------------------------------------------------- /project/assets/images/products/1726679865Samsung-A55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726679865Samsung-A55.jpg -------------------------------------------------------------------------------- /project/assets/images/products/1726680038xiaomi-poco-x2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726680038xiaomi-poco-x2.jpg -------------------------------------------------------------------------------- /php hw 1/class7/vote.php: -------------------------------------------------------------------------------- 1 | =0){ 4 | echo "You are not voter"; 5 | }elseif($age >=18){ 6 | echo "You are a voter"; 7 | } 8 | 9 | ?> -------------------------------------------------------------------------------- /project/assets/images/products/1726680088Motorola_RAZR_V3i_01.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726680088Motorola_RAZR_V3i_01.jpeg -------------------------------------------------------------------------------- /project/pages/update-profile.php: -------------------------------------------------------------------------------- 1 | 5 |

Profile

6 | -------------------------------------------------------------------------------- /project/assets/images/products/1726683627iPhone-15-Plus-(2)-(1)-6945.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/cmbd257/HEAD/project/assets/images/products/1726683627iPhone-15-Plus-(2)-(1)-6945.jpg -------------------------------------------------------------------------------- /php hw 1/class7/odd.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /php hw 1/class7/number.php: -------------------------------------------------------------------------------- 1 | 0) { 4 | echo "It's a positive number"; 5 | } elseif ($num < 0) { 6 | echo "It's a negative number"; 7 | } else { 8 | echo "It's zero"; 9 | } 10 | -------------------------------------------------------------------------------- /namespace/class1.php: -------------------------------------------------------------------------------- 1 | name; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /namespace/class2.php: -------------------------------------------------------------------------------- 1 | name; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project/admin/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /project/admin/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 |
7 | -------------------------------------------------------------------------------- /File inclusion/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |
12 | 13 |
-------------------------------------------------------------------------------- /namespace/index.php: -------------------------------------------------------------------------------- 1 | myInfo(); 14 | echo "
"; 15 | echo $myObj2->myInfo(); 16 | -------------------------------------------------------------------------------- /project/admin/style.css: -------------------------------------------------------------------------------- 1 | .panel { 2 | width: 100%; 3 | min-height: 100vh; 4 | } 5 | 6 | .sidebar { 7 | width: 250px; 8 | height: 100%; 9 | color: #fff; 10 | position: fixed; 11 | top: 0; 12 | left: 0; 13 | transition: 0.5s; 14 | overflow-y: auto; 15 | padding: 40px 0; 16 | } 17 | 18 | .main-content { 19 | margin-left: 250px; 20 | padding: 80px 20px; 21 | transition: 0.5s; 22 | } -------------------------------------------------------------------------------- /php hw 1/class7/switch case.php: -------------------------------------------------------------------------------- 1 | 50 && $units <= 150) { 6 | $bill = (50 * 3.50) + ($units - 50) * 4.00; 7 | } elseif ($units > 150 && $units <= 250) { 8 | $bill = (50 * 3.50) + (100 * 4.00) + ($units - 50 - 100) * 5.20; 9 | } elseif ($units > 250) { 10 | $bill = (50 * 3.50) + (100 * 4.00) + (100 * 5.20) + ($units - 250) * 6.20; 11 | } 12 | 13 | echo $bill; 14 | -------------------------------------------------------------------------------- /L6-superGlobal.php: -------------------------------------------------------------------------------- 1 | "; 15 | print_r($_SERVER); 16 | echo ""; 17 | 18 | echo $_SERVER['HTTP_HOST']; 19 | echo $_SERVER['PHP_SELF']; 20 | ?> 21 | 22 |
23 | 24 | 25 |
-------------------------------------------------------------------------------- /project/footer.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /L13 - Json.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | "John", 15 | "age" => 30, 16 | "city" => "New York" 17 | ]; 18 | 19 | echo json_encode($myData); 20 | echo "
"; 21 | print_r(json_decode('{"name":"John","age":30,"city":"New York"}', true)); 22 | 23 | ?> -------------------------------------------------------------------------------- /L7-request.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 | "; 15 | print_r($_ENV); 16 | echo ""; 17 | 18 | echo $_ENV['myName']; 19 | 20 | $arr = []; 21 | $arr['city'] = "Dhaka"; 22 | $arr['country'] = "Bangladesh"; 23 | 24 | echo "
";
25 | print_r($arr);
26 | echo "
"; 27 | 28 | ?> -------------------------------------------------------------------------------- /L12 - date.php: -------------------------------------------------------------------------------- 1 | "; 4 | echo date("M-d-Y l H:i:s") . "
"; 5 | echo date("F-d-Y l h:i:s A") . "
"; 6 | 7 | // mktime(hour, minute, second, month, day, year) 8 | $myTime = mktime(0, 0, 0, 9, 10, 2024); 9 | echo date("d/m/y D", $myTime) . "
"; 10 | 11 | // strtotime(time) 12 | $myTime2 = strtotime("now"); 13 | echo date("d/m/y D h:i:s a", $myTime2) . "
"; 14 | 15 | $myTime3 = strtotime("tomorrow"); 16 | echo date("d/m/y D h:i:s a", $myTime3) . "
"; 17 | 18 | $myTime4 = strtotime("next Sunday"); 19 | echo date("d/m/y D h:i:s a", $myTime4) . "
"; 20 | 21 | $myTime5 = strtotime("+3 years 2 months 1 day"); 22 | echo date("d/m/y D h:i:s a", $myTime5) . "
"; 23 | -------------------------------------------------------------------------------- /php hw 1/work/work/bill.php: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /php hw 1/class7/marriage.php: -------------------------------------------------------------------------------- 1 | = 21) { 7 | echo "You are qualified for married!"; 8 | } elseif ($man == "female" && $age < 18) { 9 | echo "You are not qualified for married!"; 10 | } elseif ($man == "female" && $age >= 18) { 11 | echo "You are qualified for married!"; 12 | } 13 | 14 | if ($man == "male") { 15 | if ($age < 21) { 16 | echo "You are not qualified for married!"; 17 | } else { 18 | echo "You are qualified for married!"; 19 | } 20 | } elseif ($man = "female") { 21 | if ($age < 18) { 22 | echo "You are not qualified for married!"; 23 | } else { 24 | echo "You are qualified for married!"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /L10 - sending-email.php: -------------------------------------------------------------------------------- 1 | 20 | 21 |
22 | 23 |

24 | 25 |

26 | 27 |

28 | 29 |
-------------------------------------------------------------------------------- /project/pages/product.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `products` WHERE `id` = $id")->fetch_assoc(); 6 | 7 | ?> 8 |
9 |
10 |
11 | 12 |
13 |
14 |

15 |

16 |

$

17 | Add to cart 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /L11 - try-catch.php: -------------------------------------------------------------------------------- 1 | 5) { 6 | throw new Exception("kaaz hoynai"); 7 | } 8 | echo "kaaz hoise"; 9 | } catch (Exception $e) { 10 | echo $e->getMessage(); 11 | } 12 | 13 | echo "
"; 14 | 15 | class MyException extends Exception 16 | { 17 | public function errorMessage() 18 | { 19 | $this->getMessage(); 20 | } 21 | } 22 | 23 | try { 24 | if ($x > 10) { 25 | throw new MyException("kaaz hoinai"); 26 | } 27 | echo "kaaz hoise"; 28 | } catch (MyException $me) { 29 | echo $me->errorMessage(); 30 | } 31 | 32 | echo "
"; 33 | 34 | filter_var(123, FILTER_VALIDATE_URL); 35 | 36 | $associativeArr = ["name" => "asif", "age" => 25, "location" => "Dhaka"]; 37 | 38 | echo json_encode($associativeArr); 39 | 40 | echo "
"; 41 | 42 | // json decode 43 | $json = '{"name":"asif","age":25,"location":"Dhaka"}'; 44 | $decoded = json_decode($json, true); 45 | echo "
";
46 | print_r($decoded);
47 | echo "
"; 48 | -------------------------------------------------------------------------------- /L5-Regular-expression.php: -------------------------------------------------------------------------------- 1 | "; 7 | var_dump(preg_match("/world/", "world")); 8 | echo "
"; 9 | var_dump(preg_match("/123/", "123")); 10 | echo "
"; 11 | var_dump(preg_match("/[0-9]/", "123")); 12 | echo "
"; 13 | var_dump(preg_match("/^1/", "123")); 14 | echo "
"; 15 | var_dump(preg_match("/3$/", "123")); 16 | echo "
"; 17 | var_dump(preg_match("/[0-9]{3}/", "123")); 18 | echo "
"; 19 | 20 | $email = "abir@gmail.com"; 21 | $emailPattern = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i"; 22 | var_dump(preg_match($emailPattern, $email)); 23 | echo "
"; 24 | 25 | // strong password 26 | $password = "Abc@1234"; 27 | $passwordPattern = "/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@#$%^&*()_+])[a-zA-Z0-9@#$%^&*()_+]{8,}$/"; 28 | var_dump(preg_match($passwordPattern, $password)); 29 | echo "
"; 30 | var_dump(preg_match("/^[A-Za-z. ]*$/", "Asif Abir")); 31 | -------------------------------------------------------------------------------- /project/admin/components/slidebar.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /L16 - oop.php: -------------------------------------------------------------------------------- 1 | city; 14 | } 15 | 16 | public function __destruct() 17 | { 18 | echo "
This is a destructor"; 19 | } 20 | 21 | public function __construct() 22 | { 23 | echo "This is a constructor
"; 24 | } 25 | } 26 | 27 | $myInfoObj = new myInfo; 28 | echo $myInfoObj->name; 29 | echo "
"; 30 | echo $myInfoObj->city; 31 | echo "
"; 32 | echo $myInfoObj->myAddress(); 33 | echo "
"; 34 | echo myInfo::country; 35 | echo "
"; 36 | echo myInfo::$age; 37 | 38 | 39 | class myChild extends myInfo 40 | { 41 | public function myChildInfo() 42 | { 43 | return "My father's city is " . $this->city; 44 | } 45 | } 46 | 47 | echo "
"; 48 | $myChildObj = new myChild; 49 | echo $myChildObj->myChildInfo(); 50 | -------------------------------------------------------------------------------- /project/pages/index.php: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 |
8 |
9 | All Products 10 |
11 |
12 |
13 | query("SELECT * FROM `products`"); 15 | while ($product = $getProducts->fetch_assoc()) { 16 | ?> 17 |
18 |
19 | 20 |
21 |
22 |

23 |
$
24 | View 25 |
26 |
27 |
28 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /L9-file-upload.php: -------------------------------------------------------------------------------- 1 | Please select a file"; 12 | } elseif (!in_array($fileActualExt, $allowed)) { 13 | $errMesg = "File type not allowed"; 14 | } elseif ($fileSize > 2000000) { 15 | $errMesg = "File size too large"; 16 | } else { 17 | $newFileName = uniqid('', true) . "." . $fileActualExt; 18 | $fileDestination = "uploads/" . $newFileName; 19 | $move = move_uploaded_file($fileTmp, $fileDestination); 20 | if ($move) { 21 | $errMesg = "File uploaded successfully"; 22 | } else { 23 | $errMesg = "File upload failed"; 24 | } 25 | } 26 | } 27 | ?> 28 |
29 | 30 | 31 |
32 | -------------------------------------------------------------------------------- /project/admin/components/navbar.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /L1-php-systex.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |
12 | ", "Hello World 2!
", "Hello World 3!
"; 14 | print "Hello World!"; 15 | if (print("Hello World 4!")) { 16 | echo "Print function return true"; 17 | } 18 | echo "
"; 19 | var_dump("Hello World"); 20 | echo "
"; 21 | var_dump(123); 22 | echo "
"; 23 | var_dump(123.45); 24 | echo "
"; 25 | var_dump(true); 26 | echo "
"; 27 | var_dump([1, 2, 3]); 28 | echo "
"; 29 | class Person 30 | { 31 | public $name = "John"; 32 | } 33 | $person = new Person(); 34 | var_dump($person); 35 | echo "
"; 36 | var_dump(null); 37 | echo "
"; 38 | // resource 39 | $file = fopen("test.txt", "r"); 40 | var_dump($file); 41 | echo "
"; 42 | 43 | // Variables - Start with $, letter or _, case sensitive, no number at start 44 | $name = "John"; 45 | echo $name; 46 | echo "
"; 47 | // constants 48 | define("city", "Dhaka"); 49 | echo city; 50 | 51 | // single line comment 52 | # single line comment 53 | /* 54 | multi 55 | line 56 | comment 57 | */ 58 | ?> 59 |
60 | 61 | 62 | -------------------------------------------------------------------------------- /L14 - file-system.php: -------------------------------------------------------------------------------- 1 | "; 4 | 5 | // dirname() - returns the directory name component of a path 6 | echo dirname($_SERVER['PHP_SELF']) . "
"; 7 | 8 | // copy() - copies a file 9 | copy("test.txt", "test2.txt"); 10 | 11 | // file() - reads a file into an array 12 | $lines = file("test.txt"); 13 | echo "
";
14 | print_r($lines);
15 | echo "
"; 16 | 17 | // file_exists() - checks whether a file or directory exists 18 | echo file_exists("test.txt") ? "File exists" : "File does not exist"; 19 | echo "
"; 20 | 21 | // file_get_contents() - reads a file into a string 22 | echo file_get_contents("test.txt") . "
"; 23 | 24 | // file_put_contents() - writes a string to a file 25 | file_put_contents("test2.txt", "Hello World\nHello World\n"); 26 | 27 | // filesize() - gets the file size 28 | echo filesize("test.txt") . "
"; 29 | 30 | // filetype() - gets the file type 31 | echo filetype("test.txt") . "
"; 32 | 33 | // is_dir() - checks whether the file is a directory 34 | echo is_dir("test.txt") ? "It is a directory" : "It is not a directory"; 35 | echo "
"; 36 | 37 | // is_file() - checks whether the file is a file 38 | echo is_file("test.txt") ? "It is a file" : "It is not a file"; 39 | echo "
"; 40 | 41 | // link() - creates a hard link 42 | echo is_file("test3.txt") ? "File already exicts
" : link("test.txt", "test3.txt"); 43 | 44 | // mkdir() - creates a directory 45 | is_dir("testDir") ? null : mkdir("testDir"); 46 | 47 | // rmdir() - removes a directory 48 | is_dir("testDir") ? rmdir("testDir") : null; 49 | 50 | // pathinfo() - returns information about a file path 51 | echo "
";
52 | print_r(pathinfo("test.txt"));
53 | echo "
"; 54 | -------------------------------------------------------------------------------- /php hw 1/work/work/number.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Check if Number is Positive or Negative 7 | 8 | 27 | 28 | 29 |
30 |

Check if Number is Positive or Negative

31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |
39 | 0) { 43 | echo "

$number is a positive number.

"; 44 | } elseif ($number < 0) { 45 | echo "

$number is a negative number.

"; 46 | } else { 47 | echo "

$number is zero.

"; 48 | } 49 | } 50 | ?> 51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /L17 - oop.php: -------------------------------------------------------------------------------- 1 | $property; 20 | } elseif (array_key_exists($property, $this->newProperties)) { 21 | return $this->newProperties[$property]; 22 | } else { 23 | return "$property property does not exist"; 24 | } 25 | } 26 | 27 | public function __set($property, $value) 28 | { 29 | if (property_exists($this, $property)) { 30 | $this->$property = $value; 31 | } else { 32 | $this->newProperties[$property] = $value; 33 | } 34 | } 35 | } 36 | 37 | // interface myInterface 38 | 39 | interface myInterface 40 | { 41 | public function myOtherInfo(): void; 42 | public function myOtherInfo2(string $msg): string; 43 | } 44 | 45 | final class myInfo extends myClass implements myInterface 46 | { 47 | public function myInfo(): string 48 | { 49 | return "My name is " . $this->name; 50 | } 51 | 52 | public function myOtherInfo(): void 53 | { 54 | echo "This is my other info"; 55 | } 56 | 57 | public function myOtherInfo2(string $msg = "Other info 2 message"): string 58 | { 59 | return $msg; 60 | } 61 | } 62 | 63 | $myInfoObj = new myInfo; 64 | $myInfoObj->name = "Shohag Rana"; 65 | echo $myInfoObj->myInfo() . "
"; 66 | $myInfoObj->myOtherInfo() . "
"; 67 | echo $myInfoObj->myOtherInfo2() . "
"; 68 | echo $myInfoObj->phone; 69 | $myInfoObj->gender = "Male"; 70 | echo "
";
71 | print_r($myInfoObj->newProperties);
72 | echo "
"; 73 | echo $myInfoObj->gender; 74 | -------------------------------------------------------------------------------- /project/admin/header.php: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Bootstrap demo 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /L4-randomPass.php: -------------------------------------------------------------------------------- 1 | "; 11 | echo uniqid(); 12 | echo "
"; 13 | echo rand(100000, 999999); 14 | 15 | // 16 | echo "
"; 17 | echo ceil(5.2); 18 | echo "
"; 19 | echo floor(5.8); 20 | echo "
"; 21 | echo round(5.4); 22 | echo "
"; 23 | echo abs(-5); 24 | echo "
"; 25 | echo max(5, 10, 15); 26 | 27 | // Incrementing and decrementing 28 | echo "
"; 29 | $a = 5; 30 | --$a; 31 | $a += 2; 32 | echo $a; 33 | echo "
"; 34 | 35 | trim("Hello World"); 36 | echo stripslashes("/kazz korena/"); 37 | echo "
"; 38 | echo htmlspecialchars("

Hello World

"); 39 | 40 | // str functions 41 | echo "
"; 42 | echo strlen("Hello World"); 43 | $myArr = explode(" ", "Hello World"); 44 | $totalCar = 0; 45 | echo "
"; 46 | foreach ($myArr as $word) { 47 | $totalCar += strlen($word); 48 | } 49 | echo $totalCar; 50 | echo "
"; 51 | echo str_replace("World", "Bangladesh", "Hello World"); 52 | echo "
"; 53 | echo substr("Hello World", 6, 5); 54 | echo "
"; 55 | echo strtolower("Hello World"); 56 | echo "
"; 57 | echo strtoupper("Hello World"); 58 | echo "
"; 59 | echo ucfirst("hello world"); 60 | echo "
"; 61 | echo ucwords("hello world"); 62 | echo "
"; 63 | echo str_repeat("Hello World ", 3); 64 | echo "
"; 65 | echo strrev("Hello World"); 66 | 67 | // function 68 | echo "
"; 69 | function myFunc($age = 15, $name = "Mokles") 70 | { 71 | if ($age >= 18) { 72 | return "Welcome $name
"; 73 | } 74 | return "Sorry $name, you are not allowed
"; 75 | } 76 | 77 | echo myFunc(16, "Aslam"); 78 | echo myFunc(19, "Ashfaq"); 79 | echo myFunc(); 80 | echo myFunc(20); 81 | echo myFunc(name: "Kamal", age: 20); 82 | -------------------------------------------------------------------------------- /project/header.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Bootstrap demo 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /project/pages/login.php: -------------------------------------------------------------------------------- 1 | real_escape_string(secureData($_POST['email'])); 11 | $password = $conn->real_escape_string(secureData($_POST['password'])); 12 | $sql = "SELECT * FROM `users` WHERE `email` = '$email'"; 13 | $result = mysqli_query($conn, $sql); 14 | if ($result->num_rows > 0) { 15 | $user = $result->fetch_assoc(); 16 | if (password_verify($password, $user['password'])) { 17 | $_SESSION['user'] = $user; 18 | $_SESSION['token'] = "cmbd257"; 19 | echo ""; 20 | } else { 21 | echo ""; 22 | } 23 | } 24 | } 25 | ?> 26 |
27 |
28 |
29 |

Login

30 |
31 |
32 | 33 | 34 |
35 |
36 | 37 | 38 |
39 |
40 | 41 |
42 |
43 | Don't have account? Register Here 44 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /php hw 1/work/work/numchk.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Number Checker 7 | 8 | 9 | 37 | 38 | 39 |
40 |

Number Checker

41 |
"> 42 |
43 | 44 | 45 |
46 | 47 |
48 |
49 | The number $number is even.
"; 56 | } else { 57 | echo ""; 58 | } 59 | } else { 60 | echo ""; 61 | } 62 | } 63 | ?> 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /L2-quotes.php: -------------------------------------------------------------------------------- 1 | "; 4 | echo 'Hello ' . $city . ' 2!
'; 5 | 6 | // Arithmetic operators 7 | /** 8 | * + 9 | * - 10 | * * 11 | * / 12 | * % 13 | * ** 14 | */ 15 | 16 | // Logical operators 17 | /** 18 | * and 19 | * && 20 | * or 21 | * || 22 | * ! 23 | */ 24 | 25 | // Comparison operators 26 | /** 27 | * == 28 | * === 29 | * != 30 | * !== 31 | * > 32 | * < 33 | * >= 34 | * <= 35 | */ 36 | 37 | // Operator precedence 38 | /** 39 | * () 40 | * ** 41 | * * / % 42 | * + - 43 | * = += -= *= /= 44 | */ 45 | 46 | // Mathematical functions 47 | /** 48 | * abs() 49 | * ceil() 50 | * floor() 51 | * round() 52 | * max() 53 | * min() 54 | * pow() 55 | * sqrt() 56 | */ 57 | 58 | // Control Statements 59 | $age = 45; 60 | if ($age <= 12 && $age >= 0) { 61 | echo "You are a child"; 62 | } elseif ($age > 12 && $age <= 19) { 63 | echo "You are a teenager"; 64 | } elseif ($age > 19 && $age <= 30) { 65 | echo "You are an young adult"; 66 | } elseif ($age > 30 && $age <= 50) { 67 | echo "You are an adult"; 68 | } elseif ($age > 50 && $age <= 140) { 69 | echo "You are an old person"; 70 | } else { 71 | echo "You are not a human"; 72 | } 73 | echo "
"; 74 | // switch case 75 | $day = "Wednesday"; 76 | switch ($day) { 77 | case "Saturday": 78 | echo "Today is Saturday"; 79 | break; 80 | case "Sunday": 81 | echo "Today is Sunday"; 82 | break; 83 | case "Monday": 84 | echo "Today is Monday"; 85 | break; 86 | case "Tuesday": 87 | echo "Today is Tuesday"; 88 | break; 89 | case "Wednesday": 90 | echo "Today is Wednesday"; 91 | break; 92 | case "Thursday": 93 | echo "Today is Thursday"; 94 | break; 95 | case "Friday": 96 | echo "Today is Friday"; 97 | break; 98 | default: 99 | echo "Invalid day"; 100 | } 101 | 102 | echo "
"; 103 | 104 | // ternary operator 105 | $age = 20; 106 | echo $age > 18 ? "You are an adult" : "You are not an adult"; 107 | 108 | // A PHP calculator using switch case (Addition, Subtraction, Multiplication, Division) 109 | 110 | echo $country ?? null; 111 | -------------------------------------------------------------------------------- /php hw 3/crud/Shohag/style.css: -------------------------------------------------------------------------------- 1 | /* All User */ 2 | a{ 3 | text-decoration: none; 4 | } 5 | 6 | .container { 7 | background-color: #fff; 8 | padding: 20px; 9 | border-radius: 5px; 10 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 11 | width: 300px; 12 | margin-left:88px; 13 | 14 | } 15 | body { 16 | font-family: Arial, sans-serif; 17 | background-color: #f4f4f4; 18 | display: flex; 19 | justify-content: center; 20 | align-items: center; 21 | margin: 0; 22 | } 23 | h2{ 24 | text-align:center; 25 | } 26 | 27 | input[type="text"], 28 | input[type="email"]{ 29 | width: 100%; 30 | padding: 10px; 31 | margin-top: 5px; 32 | border: 1px solid #ddd; 33 | border-radius: 4px; 34 | display: flex; 35 | 36 | } 37 | .btn{ 38 | width: 100%; 39 | padding: 10px; 40 | margin-top: 15px; 41 | background-color: #5cb85c; 42 | border: none; 43 | border-radius: 4px; 44 | color: white; 45 | font-size: 16px; 46 | cursor: pointer; 47 | } 48 | .btn:hover{ 49 | background-color: #4cae4c; 50 | 51 | } 52 | .btn2{ 53 | margin-top: 20px; 54 | width: 100%; 55 | padding: 10px; 56 | margin-top: 15px; 57 | background-color: #5cb85c; 58 | border: none; 59 | border-radius: 4px; 60 | color: white; 61 | font-size: 16px; 62 | cursor: pointer; 63 | } 64 | .btn2:hover{ 65 | background-color: #4cae4c; 66 | 67 | } 68 | /* delete button */ 69 | .btn3{ 70 | width: 100%; 71 | padding: 10px; 72 | margin-top: 15px; 73 | background-color: #5cb85c; 74 | border: none; 75 | border-radius: 4px; 76 | color: white; 77 | font-size: 16px; 78 | cursor: pointer; 79 | } 80 | .btn4{ 81 | display: block; 82 | width: 120px; 83 | padding: 10px; 84 | margin-top: 15px; 85 | background-color: #5cb85c; 86 | border: none; 87 | border-radius: 4px; 88 | color: white; 89 | font-size: 16px; 90 | cursor: pointer; 91 | } 92 | .btn3:hover{ 93 | background-color: #4cae4c; 94 | 95 | } 96 | .btn4:hover{ 97 | background-color: #4cae4c; 98 | 99 | } 100 | 101 | .form-box{ 102 | display: flex; 103 | justify-content: space-evenly; 104 | gap: 10px; 105 | } 106 | 107 | 108 | -------------------------------------------------------------------------------- /project/pages/password-change.php: -------------------------------------------------------------------------------- 1 | real_escape_string(secureData($_POST['currentPassword'])); 6 | $newPassword = $conn->real_escape_string(secureData($_POST['newPassword'])); 7 | $confirmPassword = $conn->real_escape_string(secureData($_POST['confirmPassword'])); 8 | 9 | $id = $_SESSION['user']['id']; 10 | $selectUserQuery = $conn->query("SELECT * FROM `users` WHERE `id` = $id"); 11 | $selectUser = $selectUserQuery->fetch_assoc(); 12 | if (password_verify($currentPassword, $selectUser['password'])) { 13 | if ($newPassword == $confirmPassword) { 14 | $newPassword = password_hash($newPassword, PASSWORD_BCRYPT); 15 | $updatePasswordQuery = $conn->query("UPDATE `users` SET `password` = '$newPassword' WHERE `id` = $id"); 16 | if ($updatePasswordQuery) { 17 | echo ""; 18 | } else { 19 | echo ""; 20 | } 21 | } else { 22 | echo ""; 23 | } 24 | } else { 25 | echo ""; 26 | } 27 | } 28 | ?> 29 |
30 |
31 |
32 |

Change Password

33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /L3-loop.php: -------------------------------------------------------------------------------- 1 | "; 13 | 14 | // for, foreach, while, do, do while 15 | 16 | // starting point, incremtnet, endpoint 17 | 18 | $sp = 1; 19 | do { 20 | echo $sp . "
"; 21 | $sp += 2; 22 | } while ($sp <= 10); 23 | 24 | echo "
"; 25 | 26 | for ($i = 0; $i < 10; $i++) { 27 | echo $i . "
"; 28 | } 29 | 30 | // array 31 | // indexed array 32 | // associative array 33 | // multidimensional array 34 | 35 | // $names = array("John", "Doe", "Jane"); 36 | $names = ["John", "Doe", "Jane"]; 37 | echo $names[2] . "
"; 38 | $banglaNames = ["আবুল", "বাবুল", "কাবুল"]; 39 | 40 | foreach ($names as $chacha) { 41 | echo $chacha . "
"; 42 | } 43 | 44 | $person = ["name" => "John", "age" => 45, "city" => "Dhaka"]; 45 | echo $person["city"]; 46 | 47 | echo "
"; 48 | 49 | // multidimensional array 50 | $persons = [ 51 | ["Abul", 45, "Dhaka"], 52 | ["Babul", 35, "Chittagong"], 53 | ["Kabul", 25, "Sylhet"] 54 | ]; 55 | 56 | echo $persons[2][2] . "
"; 57 | echo "
";
 58 | print_r($persons);
 59 | echo "
"; 60 | 61 | // in_array() 62 | var_dump(is_array($sp)); 63 | 64 | // array_merge() 65 | $mergedName = array_merge($names, $banglaNames); 66 | echo "
";
 67 | print_r($mergedName);
 68 | echo "
"; 69 | 70 | // array_keys() 71 | $keys = array_keys($person); 72 | echo "
";
 73 | print_r($keys);
 74 | echo "
"; 75 | 76 | // array_key_exists 77 | var_dump(array_key_exists("country", $person)); 78 | 79 | array_shift($names); 80 | array_unshift($names, "Kabul"); 81 | array_pop($names); 82 | array_push($names, "Abdul"); 83 | echo "
";
 84 | print_r($names);
 85 | echo "
"; 86 | 87 | // array_map() 88 | function myFunc($n) 89 | { 90 | return $n * $n; 91 | } 92 | $numbers = [1, 2, 3, 4, 5]; 93 | $squaredNumbers = array_map("myFunc", $numbers); 94 | echo "
";
 95 | print_r($squaredNumbers);
 96 | echo "
"; 97 | 98 | // array_unique() 99 | $city = ["Dhaka", "Chittagong", "Dhaka", "Sylhet", "Chittagong", "Dhaka"]; 100 | $uniqueCities = array_unique($city); 101 | echo "
";
102 | print_r($uniqueCities);
103 | echo "
"; 104 | 105 | // array_diff 106 | 107 | $countries = ["Bangladesh", "India", "Pakistan", "Nepal"]; 108 | array_slice($countries, 1, 2); 109 | -------------------------------------------------------------------------------- /project/admin/add-product.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | real_escape_string(secureData($_POST['name'])); 6 | $price = $conn->real_escape_string(secureData($_POST['price'])); 7 | $description = $conn->real_escape_string(secureData($_POST['description'])); 8 | $image = $_FILES['image']['name']; 9 | $imageTmp = $_FILES['image']['tmp_name']; 10 | $image = time() . $image; 11 | $imagePath = "../assets/images/products/$image"; 12 | move_uploaded_file($imageTmp, $imagePath); 13 | $addProductQuery = $conn->query("INSERT INTO `products`(`name`, `price`, `description`, `image`) VALUES ('$name', '$price', '$description', '$image')"); 14 | if ($addProductQuery) { 15 | echo ""; 16 | } else { 17 | echo ""; 18 | } 19 | } 20 | ?> 21 |
22 | 23 |
24 |
25 |
26 |
27 |

Add Product

28 |
29 |
30 | 31 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 39 | 40 |
41 |
42 | 43 | 44 |
45 |
46 | 47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | -------------------------------------------------------------------------------- /project/components/navbar.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /problems/Wasim-Assignment EP-7.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Php Bill Assignment 7 | 8 | 9 |

i. Electrick Bill Calculator NO

10 | 50 && $units<=150){ 16 | $bill=50*3.50+($units-50)*4.00; 17 | 18 | }elseif($units>150 && $units<=250){ 19 | $bill=50*3.50+ 100*4.00+($units-150)*5.20; 20 | 21 | }elseif($units>=250 ){ 22 | $bill=50*3.50+ 100*4.00+100*5.20+($units-250)*6.50; 23 | } 24 | 25 | echo $bill; 26 | ?> 27 |

ii. A PHP calculator using switch case (Addition, Subtraction, Multiplication, Division)

28 | 41 | 42 | 43 | 44 |

iii. Check if a person is eligible to vote by age

45 | =18 ? "You are Eligible to vote" : "Your Are Not Eligible to vote"; 48 | ?> 49 | 50 | 51 | 52 |

iv. Married Or Unmarried NO

53 | =21){ 59 | echo "Your are Qulified Man for Married"; 60 | }else{ 61 | echo "Your are Not Qulified Man for Married"; 62 | } 63 | }elseif($man=="femail"){ 64 | if($age>=18){ 65 | echo "You are Qulified Women for married"; 66 | }else{ 67 | echo "You are not Qulified Women for Married"; 68 | } 69 | } 70 | ?> 71 |

V. Check if number is positive or negetive

72 | 0){ 75 | echo "Number is positive"; 76 | 77 | } elseif($number < 0 ){ 78 | echo "Your Number is negetive"; 79 | } else{ 80 | echo "It's Just A ZERO"; 81 | } 82 | 83 | ?> 84 | 85 |

vi. Check if number is odd or even

86 | EVEN"; 90 | }else{ 91 | echo "The Number is ODD"; 92 | } 93 | ?> 94 | 95 | 96 | -------------------------------------------------------------------------------- /php hw 1/Wasim-Assignment EP-7/Wasim-Assignment EP-7.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Php Bill Assignment 7 | 8 | 9 |

i. Electrick Bill Calculator NO

10 | 50 && $units<=150){ 16 | $bill=50*3.50+($units-50)*4.00; 17 | 18 | }elseif($units>150 && $units<=250){ 19 | $bill=50*3.50+ 100*4.00+($units-150)*5.20; 20 | 21 | }elseif($units>=250 ){ 22 | $bill=50*3.50+ 100*4.00+100*5.20+($units-250)*6.50; 23 | } 24 | 25 | echo $bill; 26 | ?> 27 |

ii. A PHP calculator using switch case (Addition, Subtraction, Multiplication, Division)

28 | 41 | 42 | 43 | 44 |

iii. Check if a person is eligible to vote by age

45 | =18 ? "You are Eligible to vote" : "Your Are Not Eligible to vote"; 48 | ?> 49 | 50 | 51 | 52 |

iv. Married Or Unmarried NO

53 | =21){ 59 | echo "Your are Qulified Man for Married"; 60 | }else{ 61 | echo "Your are Not Qulified Man for Married"; 62 | } 63 | }elseif($man=="femail"){ 64 | if($age>=18){ 65 | echo "You are Qulified Women for married"; 66 | }else{ 67 | echo "You are not Qulified Women for Married"; 68 | } 69 | } 70 | ?> 71 |

V. Check if number is positive or negetive

72 | 0){ 75 | echo "Number is positive"; 76 | 77 | } elseif($number < 0 ){ 78 | echo "Your Number is negetive"; 79 | } else{ 80 | echo "It's Just A ZERO"; 81 | } 82 | 83 | ?> 84 | 85 |

vi. Check if number is odd or even

86 | EVEN"; 90 | }else{ 91 | echo "The Number is ODD"; 92 | } 93 | ?> 94 | 95 | 96 | -------------------------------------------------------------------------------- /php hw 1/work/work/vote.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Voting Eligibility Checker 7 | 8 | 9 | 40 | 41 | 42 |
43 |
44 |
45 |

Check Your Voting Eligibility

46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 | 54 |
55 |
56 | = 18) { 66 | return "You are eligible to vote."; 67 | } else { 68 | return "You are not eligible to vote."; 69 | } 70 | } 71 | 72 | echo '
' . checkVotingEligibility($age) . '
'; 73 | } 74 | ?> 75 |
76 |
77 |
78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/main-js.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | const arrImages = [ 3 | { 4 | src: "https://www.jqueryscript.net/dummy/1.jpg", 5 | desc: "Image Description 1" 6 | }, 7 | { 8 | src: "https://www.jqueryscript.net/dummy/2.jpg", 9 | desc: "Image Description 2" 10 | }, 11 | { 12 | src: "https://www.jqueryscript.net/dummy/3.jpg", 13 | desc: "Image Description 3" 14 | }, 15 | { 16 | src: "https://www.jqueryscript.net/dummy/4.jpg", 17 | desc: "Image Description 4" 18 | }, 19 | { 20 | src: "https://www.jqueryscript.net/dummy/5.jpg", 21 | desc: "Image Description 5" 22 | } 23 | ] 24 | 25 | const arrVideos = [ 26 | { 27 | src: "https://www.jqueryscript.net/dummy/1.mp4", 28 | desc: "Video Description 1" 29 | }, 30 | { 31 | src: "https://www.jqueryscript.net/dummy/example.mp4", 32 | desc: "Video Description 2" 33 | }, 34 | ] 35 | 36 | const arrMedia = [ 37 | { 38 | src: "https://www.jqueryscript.net/dummy/1.jpg", 39 | type: "image", 40 | desc: "Image Description" 41 | }, 42 | { 43 | src: "https://www.jqueryscript.net/dummy/1.mp4", 44 | type: "video", 45 | desc: "Video Description" 46 | }, 47 | { 48 | src: "https://www.youtube.com/embed/KQUcvnFaNwM?si=DGjAiLeQc2yZoMgm", 49 | type: "iframe", 50 | desc: "40 MIN Intermediate Ashtanga Fire Flow" 51 | } 52 | ] 53 | 54 | const imageSectionContainer = $('.image-section'); 55 | const videoSectionContainer = $('.video-section'); 56 | const imageGallery = $(``); 57 | const videoGallery = $(``); 58 | const btnOpenMediaLightbox = $('#btn-open-media-lightbox'); 59 | 60 | $.each(arrImages, function (key, image) { 61 | let imageSrc = image.src; 62 | 63 | let imageLink = $(` 64 | 65 | gallery-img_${key} 66 | `); 67 | 68 | imageLink.on('click', function (e) { 69 | e.preventDefault(); 70 | e.stopImmediatePropagation(); 71 | imageLightbox(arrImages, key); 72 | }); 73 | 74 | imageGallery.append(imageLink); 75 | imageSectionContainer.append(imageGallery); 76 | }); 77 | 78 | $.each(arrVideos, function (key, video) { 79 | let videoSrc = video.src; 80 | 81 | let videoLink = $(` 82 | 83 | 84 | `); 85 | 86 | videoLink.on('click', function (e) { 87 | e.preventDefault(); 88 | e.stopImmediatePropagation(); 89 | videoLightbox(arrVideos, key); 90 | }); 91 | 92 | videoGallery.append(videoLink); 93 | videoSectionContainer.append(videoGallery); 94 | }); 95 | 96 | btnOpenMediaLightbox.on('click', function () { 97 | mediaLightbox(arrMedia); 98 | }); 99 | }); 100 | -------------------------------------------------------------------------------- /L18 - oop.php: -------------------------------------------------------------------------------- 1 | name; 13 | } 14 | } 15 | 16 | $myObj = new myClass(); 17 | 18 | $cloneObj = clone $myObj; 19 | 20 | echo $cloneObj->myInfo(); // Output: My name is Asif Abir 21 | 22 | // Comparing Objects 23 | // To compare two objects, use the == operator: 24 | 25 | class myClass2 26 | { 27 | public $name = "Asif Abir"; 28 | 29 | public function myInfo(): string 30 | { 31 | return "My name is " . $this->name; 32 | } 33 | } 34 | 35 | $myObj2 = new myClass2(); 36 | echo "
"; 37 | if ($cloneObj == $myObj) { 38 | echo "They are the same"; 39 | } else { 40 | echo "They are not the same"; 41 | } 42 | 43 | // Late Static Bindings 44 | 45 | class myClass3 46 | { 47 | public static $name = "Abir"; 48 | public static function myInfo(): string 49 | { 50 | return "My name is " . self::$name; 51 | } 52 | } 53 | 54 | echo "
"; 55 | echo myClass3::myInfo(); 56 | 57 | // Objects and references 58 | // When an object is passed as an argument to a function, the function receives a reference to the object. 59 | echo "
"; 60 | class myClass4 61 | { 62 | public $name = "Asif Abir"; 63 | public function myInfo(): string 64 | { 65 | return "My name is " . $this->name; 66 | } 67 | } 68 | 69 | function myFunction(myClass4 $obj) 70 | { 71 | $obj->name = "Mohammad"; 72 | echo $obj->myInfo(); 73 | } 74 | 75 | $myObj4 = new myClass4(); 76 | myFunction($myObj4); 77 | 78 | 79 | // Object Serialization 80 | // Serialization is the process of converting an object into a string. 81 | // To serialize an object, use the serialize() function: 82 | 83 | class myClass5 84 | { 85 | public $name = "Asif Abir"; 86 | public function myInfo(): string 87 | { 88 | return "My name is " . $this->name; 89 | } 90 | } 91 | 92 | $myObj5 = new myClass5(); 93 | $serializedObj = serialize($myObj5); 94 | echo "
"; 95 | echo $serializedObj; 96 | 97 | // Traits 98 | // Traits are a mechanism for code reuse in single inheritance languages such as PHP. 99 | 100 | trait myTrait 101 | { 102 | public function myInfo(): string 103 | { 104 | return "My name is AA"; 105 | } 106 | } 107 | 108 | class myClass6 109 | { 110 | use myTrait; 111 | } 112 | 113 | $myObj6 = new myClass6(); 114 | echo "
"; 115 | echo $myObj6->myInfo(); 116 | 117 | // Namespace 118 | // Namespaces are used to avoid name collisions between classes, interfaces, functions, and constants. 119 | // To declare a namespace, use the namespace keyword: 120 | 121 | 122 | // Exceptions 123 | // Exceptions are used to handle errors in PHP. 124 | // To throw an exception, use the throw keyword: 125 | 126 | class myClass7 127 | { 128 | public function myFunction(int $num): int 129 | { 130 | if ($num <= 1) { 131 | throw new Exception("Number must be greater than 1"); 132 | } 133 | return $num; 134 | } 135 | } 136 | 137 | $myObj7 = new myClass7(); 138 | try { 139 | echo "
"; 140 | echo $myObj7->myFunction(1); 141 | } catch (Exception $e) { 142 | echo "Error: " . $e->getMessage(); 143 | } 144 | -------------------------------------------------------------------------------- /project/pages/my-orders.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `orders` WHERE `email` = '$email'"); 11 | $orderItems = []; 12 | while ($order = $orders->fetch_assoc()) { 13 | $orderId = $order['id']; 14 | $orderItems[$orderId] = []; 15 | $orderItemsQuery = $conn->query("SELECT * FROM `order_items` WHERE `order_id` = $orderId"); 16 | while ($orderItem = $orderItemsQuery->fetch_assoc()) { 17 | $productId = $orderItem['product_id']; 18 | $product = $conn->query("SELECT * FROM `products` WHERE `id` = $productId")->fetch_assoc(); 19 | $orderItems[$orderId][] = [ 20 | 'product' => $product, 21 | 'quantity' => $orderItem['quantity'], 22 | 'status' => $orderItem['status'], 23 | 'total' => $order['total'] 24 | ]; 25 | } 26 | } 27 | 28 | 29 | ?> 30 |
31 |
32 |
33 |

My Orders

34 |
35 |
36 | $items) { 38 | ?> 39 |
40 |
41 |
42 | Order ID: 43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
SNProductQuantityTotalStatus
75 |
76 |
77 |
78 | 79 |
80 |
81 |
82 | -------------------------------------------------------------------------------- /project/pages/register.php: -------------------------------------------------------------------------------- 1 | toastr.error('All fields are required')"; 16 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 17 | echo ""; 18 | } else { 19 | // check email is unique 20 | $sql = "SELECT * FROM `users` WHERE `email` = '$email'"; 21 | $result = mysqli_query($conn, $sql); 22 | if (mysqli_num_rows($result) > 0) { 23 | echo ""; 24 | } else { 25 | $password = password_hash($password, PASSWORD_BCRYPT); 26 | $sql = "INSERT INTO `users` (`name`, `email`, `password`) VALUES ('$name', '$email', '$password')"; 27 | if (mysqli_query($conn, $sql)) { 28 | echo ""; 29 | } else { 30 | echo ""; 31 | } 32 | } 33 | } 34 | } 35 | ?> 36 |
37 |
38 |
39 |

Register

40 |
41 |
42 | 43 | 44 |
45 |
46 | 47 | 48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 | 56 | 57 |
58 |
59 |
60 | 61 |
62 |
63 | Already have account? Login Here 64 |
65 |
66 |
67 | 77 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/main-css.css: -------------------------------------------------------------------------------- 1 | /****************************************** VARIABLES ******************************************/ 2 | /* Fonts */ 3 | @import url('https://fonts.googleapis.com/css2?family=Gabarito&display=swap'); 4 | 5 | /******************************************* MAIN *******************************************/ 6 | * { 7 | box-sizing: border-box; 8 | transition: color .1s ease, background-color 0.2s ease; 9 | font-family: 'Gabarito', cursive; 10 | } 11 | 12 | html { scroll-behavior: smooth; } 13 | 14 | body 15 | { 16 | padding: 0; 17 | margin: 0; 18 | width: 100%; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | background-color: #e2e2e2; 23 | } 24 | 25 | .main-title{ 26 | margin: 20px auto 5px; 27 | font-size: 2em; 28 | text-align: center; 29 | } 30 | 31 | .by{ 32 | font-size: 1.3em; 33 | text-align: center; 34 | } 35 | 36 | a{ 37 | text-decoration: none; 38 | } 39 | 40 | .gallery-heading a{ 41 | color: black; 42 | } 43 | 44 | .by a, .sample-source a, p a, .image-section a:not(.gallery-heading a), .video-section a:not(.gallery-heading a), .media-section a:not(.gallery-heading a){ 45 | color: #616336; 46 | } 47 | 48 | a:not(.gallery-heading a):hover{ 49 | text-decoration: underline; 50 | text-underline-offset: 3px; 51 | } 52 | 53 | .sample-source{ 54 | text-align: center; 55 | font-size: 1.2em; 56 | margin-block: 5px; 57 | } 58 | 59 | .ko-fi-redirect{ 60 | position: fixed; 61 | bottom: 10px; 62 | right: 10px; 63 | z-index: 10; 64 | } 65 | .ko-fi-redirect img{ 66 | height: 40px; 67 | filter: drop-shadow(1px 4px 2px black); 68 | } 69 | 70 | /* GALLERIES */ 71 | .gallery-heading{ 72 | font-size: 1.8em; 73 | margin: 5px 5px 10px 5px; 74 | } 75 | 76 | .image-section, .video-section, .media-section{ 77 | width: 95%; 78 | height: auto; 79 | background-color: #fbfbfb; 80 | padding: 20px; 81 | border-radius: 8px; 82 | margin: 10px auto; 83 | } 84 | 85 | .image-gallery{ 86 | width: 100%; 87 | display: grid; 88 | grid-template-columns: repeat(4, 1fr); /* 3 columns per row */ 89 | gap: 5px; 90 | transition: .2s; 91 | } 92 | 93 | .video-gallery{ 94 | display: grid; 95 | grid-template-columns: repeat(4, 1fr); /* 2 columns per row */ 96 | gap: 5px; 97 | transition: .2s; 98 | } 99 | 100 | .thumbnail-box.gallery-images img, .thumbnail-box.gallery-videos video{ 101 | display: block; 102 | position: relative; 103 | transition: .5s ease; 104 | max-height: auto; 105 | width: 100%; 106 | transition: .2s; 107 | } 108 | 109 | #btn-open-media-lightbox{ 110 | transition: .2s; 111 | padding: 8px 10px; 112 | border-radius: 5px; 113 | border: solid 2px black; 114 | outline: none; 115 | font-weight: 600; 116 | font-size: .9em; 117 | letter-spacing: 1px; 118 | } 119 | 120 | #btn-open-media-lightbox:hover{ 121 | border: solid 2px #616336; 122 | background-color: #616336; 123 | color: white; 124 | cursor: pointer; 125 | } 126 | 127 | /*Tablet*/ 128 | @media screen and (max-width: 768px){ 129 | .image-gallery{ 130 | width: 100%; 131 | display: grid; 132 | grid-template-columns: repeat(3, 1fr); /* 3 columns per row */ 133 | gap: 5px; 134 | } 135 | 136 | .video-gallery{ 137 | display: grid; 138 | grid-template-columns: repeat(2, 1fr); /* 2 columns per row */ 139 | gap: 5px; 140 | } 141 | } 142 | 143 | /*Mobile*/ 144 | @media screen and (max-width: 425px){ 145 | 146 | } -------------------------------------------------------------------------------- /php hw 1/work/work/Marriage.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Marriage Eligibility Checker 7 | 8 | 9 | 10 | 51 | 52 | 53 | 54 |
55 |

Marriage Eligibility Checker

56 |
57 |
58 | 59 | 63 |
64 |
65 | 66 | 67 |
68 | 69 |
70 | 71 | = $minAgeForMale; 82 | } elseif ($gender === 'female') { 83 | return $age >= $minAgeForFemale; 84 | } else { 85 | return false; 86 | } 87 | } 88 | 89 | if (isEligibleForMarriage($gender, $age)) { 90 | echo ''; 91 | } else { 92 | echo ''; 93 | } 94 | } 95 | ?> 96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /project/pages/cart.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `products` WHERE `id` = $id")->fetch_assoc(); 7 | $cart = $_SESSION['cart']; 8 | if (isset($cart[$id])) { 9 | $cart[$id]['quantity'] += 1; 10 | } else { 11 | $cart[$id] = [ 12 | 'quantity' => 1, 13 | 'product' => $product 14 | ]; 15 | } 16 | $_SESSION['cart'] = $cart; 17 | // toaster with setTimeout for 2 seconds 18 | echo ""; 19 | } 20 | ?> 21 | toastr.success('Item removed from cart');setTimeout(()=> location.href='./cart.php', 2000)"; 30 | } 31 | 32 | // if session cart has no item 33 | if (!isset($_SESSION['cart']) || count($_SESSION['cart']) == 0) { 34 | echo "

No item in cart

"; 35 | } else { 36 | ?> 37 |
38 |
39 |
40 |

Cart

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | $item) { 58 | $product = $item['product']; 59 | $quantity = $item['quantity']; 60 | $total += $product['price'] * $quantity; 61 | ?> 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
SNNameImagePriceQuantityTotalAction
70 | Remove 71 |
Total
81 |
82 |
83 | 84 |
85 |
86 | Checkout 87 |
88 |
89 |
90 | 91 | 92 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/lightbox-js/cwa-image-lightbox.js: -------------------------------------------------------------------------------- 1 | function imageLightbox(arrImages, selectedIndex){ 2 | let arrayLength = arrImages.length; 3 | let currentIndex = selectedIndex; 4 | const body = $('body'); 5 | 6 | /* HTML LIGHTBOX COMPONENTS */ 7 | body.append(''); 8 | const lightboxOverlay = $('.lightbox-overlay'); 9 | let lightboxContent = $('.lightbox-content'); 10 | 11 | //navigation buttons 12 | if(arrayLength > 1){ 13 | lightboxOverlay.append(''); 14 | lightboxOverlay.append(''); 15 | } 16 | 17 | //close button 18 | lightboxOverlay.append(''); 19 | 20 | //index counter 21 | lightboxContent.append(` 22 |
23 | | 24 |
`); 25 | 26 | $(".totalPg").text(arrayLength); 27 | 28 | lightboxContent.append('
'); 29 | lightboxContent.append(''); 30 | 31 | //content/image description 32 | lightboxContent.append('
'); 33 | 34 | showLightbox(currentIndex); 35 | 36 | // disables scrolling in window 37 | body.addClass('lightbox-scroll'); 38 | 39 | function showLightbox(index){ 40 | let desc = $('.desc'); 41 | let currentPage = $('.pgNum'); 42 | let lightboxContent = $('.lightbox-content'); 43 | let loader = $(".lightbox-content .lightbox-loader"); 44 | let mediaContainer = $(".media-container"); 45 | 46 | currentIndex = (index + arrayLength) % arrayLength; 47 | 48 | //shows loader 49 | lightboxContent.css('justify-content', 'center'); 50 | loader.show(); 51 | $('.index-counter').css("position", "absolute"); 52 | //hides media container 53 | mediaContainer.hide(); 54 | desc.hide(); 55 | 56 | let descText = arrImages[currentIndex].desc; 57 | 58 | // Find occurrences of http/https links in the text and replace them with tags 59 | descText = descText.replace(/(https?:\/\/[^\s]+)/g, function(displayedLink) { 60 | return `${displayedLink}`; 61 | }); 62 | 63 | let imageContainer = $(''); 64 | let newImg = new Image(); 65 | newImg.src = arrImages[currentIndex].src; 66 | 67 | newImg.onload = function() { 68 | lightboxContent.css('justify-content', 'space-between'); 69 | mediaContainer.hide().fadeIn(); 70 | desc.hide().fadeIn(); 71 | imageContainer.attr("src", newImg.src); 72 | 73 | mediaContainer.empty().append(imageContainer); 74 | 75 | loader.hide(); 76 | $('.index-counter').css("position", "relative"); 77 | 78 | desc.empty().append(descText); 79 | currentPage.text(currentIndex + 1); 80 | }; 81 | } 82 | 83 | //CLICK EVENTS 84 | // Function to close the lightbox 85 | function closeLightbox() { 86 | $(".lightbox-overlay").remove(); 87 | // enables scrolling in window 88 | body.removeClass('lightbox-scroll'); 89 | } 90 | 91 | // Listen for the "popstate" event (back button) 92 | window.history.pushState({id:1}, null, null); 93 | window.addEventListener('popstate', function(){ 94 | closeLightbox(); 95 | }); 96 | 97 | $(".close").on('click', function(){ 98 | closeLightbox(); 99 | }); 100 | 101 | $(".prev").on('click', function(){ 102 | showLightbox(currentIndex -= 1); 103 | }); 104 | 105 | $(".next").on('click', function(){ 106 | showLightbox(currentIndex += 1); 107 | }); 108 | 109 | $(document).on( "keydown", function(e) { 110 | if (e.key === "ArrowLeft") { // Left keyboard arrow key 111 | showLightbox(currentIndex -= 1); 112 | } 113 | else if (e.key === "ArrowRight") { // Right keyboard arrow key 114 | showLightbox(currentIndex += 1); 115 | } 116 | }); 117 | } -------------------------------------------------------------------------------- /php hw 1/work/work/calculator.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PHP Calculator 5 | 6 | 31 | 32 | 33 |
34 |
35 |

Simple PHP Calculator

36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 47 | 50 | 53 | 56 |
57 | 58 |
59 | 60 | Result: $result
"; 90 | } else { 91 | echo "
Please enter valid numbers.
"; 92 | } 93 | } 94 | ?> 95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /jquery/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 77 | 78 | 79 | 80 |
81 |
82 |
Hello World
83 | 84 | 85 | 86 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/lightbox-css/cwa-lightbox.css: -------------------------------------------------------------------------------- 1 | /****************************************** VARIABLES ******************************************/ 2 | /* Fonts */ 3 | @import url('https://fonts.googleapis.com/css2?family=Gabarito&display=swap'); 4 | 5 | /************************************** LIGHTBOX STYLING **************************************/ 6 | .lightbox-scroll{ 7 | overflow-y: hidden; 8 | } 9 | 10 | .lightbox-overlay { 11 | display: flex; 12 | justify-content: center; 13 | align-items: center; 14 | position: fixed; 15 | z-index: 100; 16 | top: 0; 17 | width: 100%; 18 | height: 100vh; 19 | overflow: hidden; 20 | background-color: #000000f4; /* Black w/ opacity */ 21 | font-family: 'Gabarito', cursive; 22 | } 23 | 24 | .lightbox-content{ 25 | display: inline-flex; 26 | flex-direction: column; 27 | align-items: center; 28 | justify-content: space-evenly; 29 | height: 100%; 30 | width: 100%; 31 | } 32 | 33 | .index-counter{ 34 | top: 10px; 35 | color: white; 36 | z-index: 103; 37 | font-size: 16px; 38 | transition: 0.5s; 39 | height: max-content; 40 | text-align: center; 41 | } 42 | 43 | .lbTerm{ 44 | font-weight:500; 45 | } 46 | 47 | .media-container{ 48 | position: relative; 49 | z-index: 101; 50 | background-color: #eeeeee; 51 | max-height: 75vh; 52 | max-width: 95%; 53 | padding: 2px; 54 | margin-top: 10px; 55 | min-height: max-content; 56 | min-width: 20%; 57 | } 58 | 59 | .media-container img, .media-container video{ 60 | height: 100%; 61 | width: 100%; 62 | max-height: 100%; 63 | max-width: 100%; 64 | } 65 | 66 | .media-container iframe{ 67 | width: 100%; 68 | aspect-ratio: 16/9; 69 | min-height: 60vh; 70 | margin-bottom: -4px; 71 | } 72 | 73 | .desc{ 74 | position: relative; 75 | color: white; 76 | padding: 5px 0 20px 0; 77 | font-size: 1rem; 78 | text-align: center; 79 | transition: 0.5s; 80 | } 81 | 82 | .desc a{ 83 | color: #c5921a; 84 | text-decoration: none; 85 | } 86 | 87 | .desc a:hover{ 88 | text-decoration: underline; 89 | } 90 | 91 | .lightbox-content .lightbox-loader { 92 | position: absolute; 93 | z-index: 102; 94 | width: 80px; 95 | height: 80px; 96 | margin: auto; 97 | border-radius: 50%; 98 | border: 10px solid #404040a2; 99 | border-top-color: #00a8df; 100 | animation: spin 1s linear infinite; 101 | } 102 | 103 | @keyframes spin { 104 | 100% { transform: rotate(360deg); } 105 | } 106 | 107 | /************************************** CUSTOM SCROLL BAR **************************************/ 108 | /* width */ 109 | .lightbox-overlay::-webkit-scrollbar { 110 | width: 0; 111 | height: 0; 112 | } 113 | 114 | /*Tablet*/ 115 | @media screen and (max-width: 768px){ 116 | .media-container iframe{ 117 | min-height: 50vh; 118 | } 119 | } 120 | 121 | /*Mobile*/ 122 | @media screen and (max-width: 425px){ 123 | .media-container iframe{ 124 | min-height: 35vh; 125 | } 126 | } 127 | 128 | /*Mobile (landscape mode)*/ 129 | @media screen and (max-height: 340px){ 130 | .lightbox-overlay { 131 | overflow-y: auto; 132 | } 133 | } 134 | /************************************* LIGHTBOX BUTTONS ************************************/ 135 | .close { 136 | background-color: transparent; 137 | border: none; 138 | color: #f8f9fa; 139 | position: absolute; 140 | top: 5px; 141 | right: 10px; 142 | font-size: 40px; 143 | font-weight: bold; 144 | transition: 0.5s; 145 | text-decoration: none; 146 | cursor: pointer; 147 | } 148 | 149 | .close:hover, .close:focus 150 | { 151 | color: #adb5bd; 152 | } 153 | 154 | /* Next & previous buttons */ 155 | .next, .prev{ 156 | cursor: pointer; 157 | position: absolute; 158 | background-color: transparent; 159 | color: #f8f9fa; 160 | width: auto; 161 | padding: 16px; 162 | z-index: 102; 163 | font-weight: bold; 164 | font-size: 35px; 165 | transition: 0.3s ease; 166 | 167 | user-select: none; 168 | -webkit-user-select: none; 169 | border: none; 170 | } 171 | 172 | .next:hover, .prev:hover{ 173 | background-color: hsla(208, 7%, 46%, 0.8); 174 | color: #f8f9fa; 175 | } 176 | 177 | /* Position the "next button" to the right */ 178 | .next { 179 | right: 0; 180 | border-radius: 5px 0 0 5px; 181 | } 182 | 183 | .prev{ 184 | left: 0; 185 | border-radius: 0 5px 5px 0; 186 | } 187 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Mixed Media Lightbox Gallery Plugin Examples 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

Mixed Media Lightbox Gallery Plugin Examples

24 | 27 |
29 | 30 | 36 |
39 |

Download This Plugin Back To jQueryScript

40 |

This jQuery gallery plugin creates fullscreen lightboxes for diverse media - great for images, videos, and iframe embeds.

41 |
42 | 43 |
44 | 45 |
46 | 47 |

48 | Lightbox section for images: 49 | >See section in Github 50 |

51 |
52 | 53 |
54 | 55 |

56 | Lightbox section for images, videos, and iframes: 57 | >See section in Github 58 |

59 | 60 |
61 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/lightbox-js/cwa-video-lightbox.js: -------------------------------------------------------------------------------- 1 | function videoLightbox(arrVideos, selectedIndex){ 2 | let arrayLength = arrVideos.length; 3 | let currentIndex = selectedIndex; 4 | const body = $('body'); 5 | 6 | /* HTML LIGHTBOX COMPONENTS */ 7 | body.append(''); 8 | const lightboxOverlay = $('.lightbox-overlay'); 9 | let lightboxContent = $('.lightbox-content'); 10 | 11 | //navigation buttons 12 | if(arrayLength > 1){ 13 | lightboxOverlay.append(''); 14 | lightboxOverlay.append(''); 15 | } 16 | 17 | //close button 18 | lightboxOverlay.append(''); 19 | 20 | //index counter 21 | lightboxContent.append(` 22 |
23 | | 24 |
`); 25 | 26 | $(".totalPg").text(arrayLength); 27 | 28 | lightboxContent.append('
'); 29 | lightboxContent.append(''); 30 | 31 | //content/image description 32 | lightboxContent.append('
'); 33 | 34 | showLightbox(currentIndex); 35 | 36 | // disables scrolling in window 37 | body.addClass('lightbox-scroll'); 38 | 39 | function showLightbox(index){ 40 | let desc = $('.desc'); 41 | let currentPage = $('.pgNum'); 42 | let lightboxContent = $('.lightbox-content'); 43 | let loader = $(".lightbox-content .lightbox-loader"); 44 | let mediaContainer = $(".media-container"); 45 | 46 | currentIndex = (index + arrayLength) % arrayLength; 47 | 48 | //shows loader 49 | lightboxContent.css('justify-content', 'center'); 50 | loader.show(); 51 | $('.index-counter').css("position", "absolute"); 52 | //hides media container 53 | mediaContainer.hide(); 54 | desc.hide(); 55 | 56 | let descText = arrVideos[currentIndex].desc; 57 | 58 | // Find occurrences of http/https links in the text and replace them with tags 59 | descText = descText.replace(/(https?:\/\/[^\s]+)/g, function(displayedLink) { 60 | return `${displayedLink}`; 61 | }); 62 | 63 | let videoContainer = $(` 64 | `); 70 | videoContainer.prop("volume", 0.35); 71 | 72 | let newVideo = document.createElement('video'); 73 | newVideo.src = arrVideos[currentIndex].src; 74 | 75 | newVideo.onloadedmetadata = function(){ 76 | lightboxContent.css('justify-content', 'space-between'); 77 | mediaContainer.hide().fadeIn(); 78 | desc.hide().fadeIn(); 79 | videoContainer.find('source').attr("src", newVideo.src); 80 | 81 | mediaContainer.empty().append(videoContainer); 82 | 83 | loader.hide(); 84 | $('.index-counter').css("position", "relative"); 85 | 86 | desc.empty().append(descText); 87 | currentPage.text(currentIndex + 1); 88 | } 89 | } 90 | 91 | //CLICK EVENTS 92 | // Function to close the lightbox 93 | function closeLightbox() { 94 | $(".lightbox-overlay").remove(); 95 | // enables scrolling in window 96 | body.removeClass('lightbox-scroll'); 97 | } 98 | 99 | // Listen for the "popstate" event (back button) 100 | window.history.pushState({id:1}, null, null); 101 | window.addEventListener('popstate', function(){ 102 | closeLightbox(); 103 | }); 104 | 105 | $(".close").on('click', function(){ 106 | closeLightbox(); 107 | }); 108 | 109 | $(".prev").on('click', function(){ 110 | showLightbox(currentIndex -= 1); 111 | }); 112 | 113 | $(".next").on('click', function(){ 114 | showLightbox(currentIndex += 1); 115 | }); 116 | 117 | $(document).on( "keydown", function(e) { 118 | if (e.key === "ArrowLeft") { // Left arrow key 119 | showLightbox(currentIndex -= 1); 120 | } 121 | else if (e.key === "ArrowRight") { // Right arrow key 122 | showLightbox(currentIndex += 1); 123 | } 124 | }); 125 | } -------------------------------------------------------------------------------- /problems/array_problems.php: -------------------------------------------------------------------------------- 1 | $max) { 8 | $max = $arr[$i]; 9 | } 10 | } 11 | 12 | echo "Maximum number is: " . $max . "
"; 13 | 14 | // Find 2nd max number from an array 15 | $arr = [3, 1, 5, 9, 2, 7, 8, 4, 6]; 16 | $max = $arr[0]; 17 | $secondMax = $arr[0]; 18 | 19 | for ($i = 1; $i < count($arr); $i++) { 20 | if ($arr[$i] > $max) { 21 | $secondMax = $max; 22 | $max = $arr[$i]; 23 | } elseif ($arr[$i] > $secondMax) { 24 | $secondMax = $arr[$i]; 25 | } 26 | } 27 | echo "Second maximum number is: " . $secondMax . "
"; 28 | 29 | $max = 9; 30 | $secondMax = 8; 31 | 32 | // Sort array from min to max 33 | $arr = [34, 15, 51, 92, 27, 74, 85, 43, 61]; 34 | sort($arr); 35 | echo "
";
 36 | print_r($arr);
 37 | echo "
"; 38 | 39 | // Calculate average number of an array 40 | $arr = [3, 1, 5, 9, 2, 7, 8, 4, 6]; 41 | $sum = 0; 42 | for ($i = 0; $i < count($arr); $i++) { 43 | $sum += $arr[$i]; 44 | } 45 | $average = $sum / count($arr); 46 | echo "Average number is: " . $average . "
"; 47 | 48 | // Merging 2 different types of array together 49 | $arr1 = [3, 1, 5, 9, 2, 7, 8, 4, 6]; 50 | $arr2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']; 51 | $arr3 = array_merge($arr1, $arr2); 52 | echo "
";
 53 | print_r($arr3);
 54 | echo "
"; 55 | 56 | // Search data from an array 57 | $arr = [3, 1, 5, 9, 2, 7, 8, 4, 6]; 58 | echo in_array(5, $arr) ? "Data found" : "Data not found"; 59 | echo "
"; 60 | 61 | // strtoupper(), strtolower() 62 | $cities = ['Dhaka', 'Chittagong', 'Sylhet', 'Khulna', 'Rajshahi']; 63 | foreach ($cities as $city) { 64 | echo strtoupper($city) . "
"; 65 | } 66 | 67 | foreach ($cities as $city) { 68 | echo strtolower($city) . "
"; 69 | } 70 | 71 | // Get unique values 72 | $arr = [3, 1, 5, 9, 2, 7, 8, 4, 6, 3, 1, 5, 9, 2, 7, 8, 4, 6]; 73 | $arr = array_unique($arr); 74 | echo "
";
 75 | print_r($arr);
 76 | echo "
"; 77 | 78 | // Merge 2 comma separated lists with unique value only 79 | $list1 = "3, 1, 5, 9, 2, 7, 8, 4, 6"; 80 | $list2 = "3, 1, 5, 9, 2, 7, 8, 4, 6, 10, 11, 12, 13, 14, 15"; 81 | $arr1 = explode(", ", $list1); 82 | $arr2 = explode(", ", $list2); 83 | $arr3 = array_merge($arr1, $arr2); 84 | $arr3 = array_unique($arr3); 85 | echo "
";
 86 | print_r($arr3);
 87 | echo "
"; 88 | 89 | // Difference between 2 multi-dimensional arrays 90 | $arr1 = [ 91 | ['a', 'b', 'c'], 92 | ['d', 'e', 'f'], 93 | ['g', 'h', 'i'] 94 | ]; 95 | $arr2 = [ 96 | ['a', 'b', 'c'], 97 | ['d', 'e', 'f'] 98 | ]; 99 | // $arr3 = array_diff($arr1, $arr2); 100 | echo "
";
101 | print_r($arr3);
102 | echo "
"; 103 | 104 | // Check if all values are string or not 105 | $arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']; 106 | function isAllString($arr) 107 | { 108 | foreach ($arr as $value) { 109 | if (!is_string($value)) { 110 | return "Not all values are string"; 111 | } 112 | } 113 | return "All values are string"; 114 | } 115 | echo isAllString($arr); 116 | 117 | // Filter out array data with some specific keys 118 | 119 | 120 | $ages = [10, 20, 30, 40, 50, 60, 70, 80, 90]; 121 | $filteredAges = array_filter($ages, function ($age) { 122 | return $age > 50; 123 | }); 124 | 125 | // Filter a multi-dimensional array 126 | $students = [ 127 | ['name' => 'John', 'age' => 20], 128 | ['name' => 'Doe', 'age' => 30], 129 | ['name' => 'Smith', 'age' => 40], 130 | ['name' => 'Alex', 'age' => 50], 131 | ['name' => 'Martin', 'age' => 60], 132 | ['name' => 'Stuart', 'age' => 70], 133 | ['name' => 'Micheal', 'age' => 80], 134 | ['name' => 'Robert', 'age' => 90], 135 | ['name' => 'William', 'age' => 100], 136 | ]; 137 | $filteredStudents = array_filter($students, function ($student) { 138 | return $student['age'] > 50; 139 | }); 140 | echo "
";
141 | print_r($filteredStudents);
142 | echo "
"; 143 | 144 | // Remove all white spaces from an array 145 | $arr = [' a ', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']; 146 | $arr = array_map('trim', $arr); 147 | echo "
";
148 | print_r($arr);
149 | echo "
"; 150 | 151 | $x = [2, 4, 6]; 152 | function square($n) 153 | { 154 | return $n * $n; 155 | } 156 | $y = array_map('square', $x); 157 | echo "
";
158 | print_r($y);
159 | echo "
"; 160 | 161 | // ombine 2 array and use one array data as keys and others as values 162 | $names = ['John', 'Doe', 'Smith', 'Alex', 'Martin']; 163 | $ages = [20, 30, 40, 50, 60]; 164 | $combined = array_combine($names, $ages); 165 | echo "
";
166 | print_r($combined);
167 | echo "
"; 168 | 169 | // Convert string to array 170 | $str = "Ami vaat khai"; 171 | $arr = explode(" ", $str); 172 | echo "
";
173 | print_r($arr);
174 | echo "
"; 175 | -------------------------------------------------------------------------------- /cmbd257.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.2.1 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Aug 21, 2024 at 06:46 PM 7 | -- Server version: 10.4.28-MariaDB 8 | -- PHP Version: 8.1.0 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | START TRANSACTION; 12 | SET time_zone = "+00:00"; 13 | 14 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 18 | /*!40101 SET NAMES utf8mb4 */; 19 | 20 | -- 21 | -- Database: `cmbd257` 22 | -- 23 | 24 | -- -------------------------------------------------------- 25 | 26 | -- 27 | -- Table structure for table `deleted_user` 28 | -- 29 | 30 | CREATE TABLE `deleted_user` ( 31 | `id` int(11) NOT NULL, 32 | `name` varchar(255) NOT NULL, 33 | `email` varchar(255) NOT NULL, 34 | `created_at` timestamp NOT NULL DEFAULT current_timestamp() 35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 36 | 37 | -- 38 | -- Dumping data for table `deleted_user` 39 | -- 40 | 41 | INSERT INTO `deleted_user` (`id`, `name`, `email`, `created_at`) VALUES 42 | (2, 'Asif Abir', 'abir@gmail.com', '2024-08-07 17:16:39'); 43 | 44 | -- -------------------------------------------------------- 45 | 46 | -- 47 | -- Table structure for table `history` 48 | -- 49 | 50 | CREATE TABLE `history` ( 51 | `id` int(11) NOT NULL, 52 | `user_id` int(11) NOT NULL, 53 | `name` varchar(255) NOT NULL, 54 | `email` varchar(255) NOT NULL, 55 | `creatd_at` timestamp NOT NULL DEFAULT current_timestamp() 56 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 57 | 58 | -- 59 | -- Dumping data for table `history` 60 | -- 61 | 62 | INSERT INTO `history` (`id`, `user_id`, `name`, `email`, `creatd_at`) VALUES 63 | (1, 1, 'Dr Younus', 'younus@gmail.com', '2024-08-11 17:28:21'), 64 | (2, 1, 'Dr Md Younus', 'younus@gmail.com', '2024-08-11 17:30:08'), 65 | (3, 3, 'Shohag Gazi', 'shohag@gmail.com', '2024-08-11 17:33:22'); 66 | 67 | -- -------------------------------------------------------- 68 | 69 | -- 70 | -- Table structure for table `products` 71 | -- 72 | 73 | CREATE TABLE `products` ( 74 | `id` int(11) NOT NULL, 75 | `name` varchar(255) NOT NULL, 76 | `price` int(11) NOT NULL, 77 | `created_at` timestamp NOT NULL DEFAULT current_timestamp() 78 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 79 | 80 | -- -------------------------------------------------------- 81 | 82 | -- 83 | -- Table structure for table `users` 84 | -- 85 | 86 | CREATE TABLE `users` ( 87 | `id` int(11) NOT NULL, 88 | `name` varchar(255) DEFAULT NULL, 89 | `email` varchar(255) NOT NULL, 90 | `created_at` timestamp NOT NULL DEFAULT current_timestamp() 91 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 92 | 93 | -- 94 | -- Dumping data for table `users` 95 | -- 96 | 97 | INSERT INTO `users` (`id`, `name`, `email`, `created_at`) VALUES 98 | (1, 'Md Younus', 'younus@gmail.com', '2024-08-07 17:15:39'), 99 | (3, 'Md. Shohag Gazi', 'shohag@gmail.com', '2024-08-11 16:44:43'), 100 | (4, 'Shohag Rana', 'shohag@gmail.com', '2024-08-14 18:08:01'), 101 | (5, 'Wasim Akram', 'wasim@gmail.com', '2024-08-14 18:13:44'); 102 | 103 | -- 104 | -- Indexes for dumped tables 105 | -- 106 | 107 | -- 108 | -- Indexes for table `deleted_user` 109 | -- 110 | ALTER TABLE `deleted_user` 111 | ADD PRIMARY KEY (`id`); 112 | 113 | -- 114 | -- Indexes for table `history` 115 | -- 116 | ALTER TABLE `history` 117 | ADD PRIMARY KEY (`id`), 118 | ADD KEY `user_id` (`user_id`); 119 | 120 | -- 121 | -- Indexes for table `products` 122 | -- 123 | ALTER TABLE `products` 124 | ADD PRIMARY KEY (`id`); 125 | 126 | -- 127 | -- Indexes for table `users` 128 | -- 129 | ALTER TABLE `users` 130 | ADD PRIMARY KEY (`id`); 131 | 132 | -- 133 | -- AUTO_INCREMENT for dumped tables 134 | -- 135 | 136 | -- 137 | -- AUTO_INCREMENT for table `deleted_user` 138 | -- 139 | ALTER TABLE `deleted_user` 140 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; 141 | 142 | -- 143 | -- AUTO_INCREMENT for table `history` 144 | -- 145 | ALTER TABLE `history` 146 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; 147 | 148 | -- 149 | -- AUTO_INCREMENT for table `products` 150 | -- 151 | ALTER TABLE `products` 152 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; 153 | 154 | -- 155 | -- AUTO_INCREMENT for table `users` 156 | -- 157 | ALTER TABLE `users` 158 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; 159 | 160 | -- 161 | -- Constraints for dumped tables 162 | -- 163 | 164 | -- 165 | -- Constraints for table `history` 166 | -- 167 | ALTER TABLE `history` 168 | ADD CONSTRAINT `history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); 169 | COMMIT; 170 | 171 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 172 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 173 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 174 | -------------------------------------------------------------------------------- /L15 - crud.php: -------------------------------------------------------------------------------- 1 | getMessage()); 7 | } 8 | 9 | if (isset($_POST['create'])) { 10 | $name = $_POST['name']; 11 | $email = $_POST['email']; 12 | $createQuery = "INSERT INTO `users`(`name`, `email`) VALUES ('$name', '$email')"; 13 | $create = mysqli_query($conn, $createQuery); 14 | if (!$create) { 15 | echo ""; 16 | } else { 17 | echo ""; 18 | } 19 | } 20 | 21 | $readQuery = "SELECT * FROM `users`"; 22 | $read = mysqli_query($conn, $readQuery); 23 | $users = mysqli_fetch_all($read, MYSQLI_ASSOC); 24 | 25 | 26 | 27 | ?> 28 | 29 | 30 |

All users

31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 50 | 54 | 55 | 56 |
S.N.NameEmailRegistration DateAction
48 | 49 | 51 | 52 | 53 |
57 |

58 |

Add Student

59 |
60 | 61 |

62 | 63 |

64 | 65 |
66 | 67 | 68 | Name is required"; 76 | } else { 77 | $crrName = $name; 78 | } 79 | 80 | if (empty($email)) { 81 | $errEmail = "Email is required"; 82 | } else { 83 | $crrEmail = $email; 84 | } 85 | 86 | if (!empty($crrName) && !empty($crrEmail)) { 87 | $updateQuery = "UPDATE `users` SET `name` = '$name', `email` = '$email' WHERE `id` = $uid"; 88 | $update = mysqli_query($conn, $updateQuery); 89 | if (!$update) { 90 | echo ""; 91 | } else { 92 | echo ""; 93 | } 94 | } 95 | } 96 | 97 | if (isset($_GET['uid'])) { 98 | $uid = $_GET['uid']; 99 | $userQuery = "SELECT * FROM `users` WHERE `id` = $uid"; 100 | $runUserQuery = mysqli_query($conn, $userQuery); 101 | $user = mysqli_fetch_assoc($runUserQuery); 102 | ?> 103 |

Update user

104 |
105 | 106 | 107 | 108 |

109 | 110 | 111 |

112 | 113 | 114 | 115 | 116 |
117 | 118 | 119 | alert('Something went wrong')"; 126 | } else { 127 | echo ""; 128 | } 129 | } 130 | 131 | if (isset($_GET['did'])) { 132 | $did = $_GET['did']; 133 | ?> 134 |

Do you realy want to delete the user?

135 |
136 | 137 | 138 | 139 | 140 | 141 |
142 | -------------------------------------------------------------------------------- /project/pages/checkout.php: -------------------------------------------------------------------------------- 1 | real_escape_string(secureData($_POST['name'])); 6 | $email = $conn->real_escape_string(secureData($_POST['email'])); 7 | $phone = $conn->real_escape_string(secureData($_POST['phone'])); 8 | $address = $conn->real_escape_string(secureData($_POST['address'])); 9 | $total = 0; 10 | foreach ($_SESSION['cart'] as $id => $productData) { 11 | $quantity = $productData['quantity']; 12 | $selectProductQuery = $conn->query("SELECT * FROM `products` WHERE `id` = $id"); 13 | $product = $selectProductQuery->fetch_assoc(); 14 | $total += $product['price'] * $quantity; 15 | } 16 | $insertOrderQuery = $conn->query("INSERT INTO `orders`(`name`, `email`, `phone`, `address`, `total`) VALUES ('$name', '$email', '$phone', '$address', $total)"); 17 | if ($insertOrderQuery) { 18 | $orderId = $conn->insert_id; 19 | foreach ($_SESSION['cart'] as $id => $productData) { 20 | $quantity = $productData['quantity']; 21 | $selectProductQuery = $conn->query("SELECT * FROM `products` WHERE `id` = $id"); 22 | $product = $selectProductQuery->fetch_assoc(); 23 | $price = $product['price']; 24 | $insertOrderItemQuery = $conn->query("INSERT INTO `order_items`(`order_id`, `product_id`, `quantity`, `price`) VALUES ($orderId, $id, $quantity, $price)"); 25 | } 26 | unset($_SESSION['cart']); 27 | echo ""; 33 | } else { 34 | echo ""; 35 | } 36 | } 37 | ?> 38 |
39 |
40 |
41 | Checkout 42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 | 50 |
51 |
52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 |
60 | 61 | 62 |
63 | 64 |
65 |
66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | $productData) { 81 | $quantity = $productData['quantity']; 82 | $selectProductQuery = $conn->query("SELECT * FROM `products` WHERE `id` = $id"); 83 | $product = $selectProductQuery->fetch_assoc(); 84 | $total += $product['price'] * $quantity; 85 | ?> 86 | 87 | 88 | 89 | 90 | 91 | 92 | 96 | 97 | 98 | 99 | 100 | 101 |
ProductPriceQuantityTotal
Total
102 |
103 |
104 |
105 | -------------------------------------------------------------------------------- /php hw 3/crud/Shohag/crud.php: -------------------------------------------------------------------------------- 1 | getMessage()); 6 | } 7 | if (isset($_POST['create'])) { 8 | $name = $_POST['name']; 9 | $email = $_POST['email']; 10 | $createQuery = "INSERT INTO `users`(`name`,`email`) VALUES ('$name','$email')"; 11 | $create = mysqli_query($conn, $createQuery); 12 | } 13 | $readQuery = "SELECT * FROM `users`"; 14 | $read = mysqli_query($conn, $readQuery); 15 | $users = mysqli_fetch_all($read, MYSQLI_ASSOC); 16 | 17 | ?> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 |
S.NNameEmailReg DateAction
38 | 39 | 40 |
44 |

45 | 46 |
47 |

All User

48 |
49 | 50 |

51 | 52 |

53 | 54 | 55 |
56 |
57 | 58 | 59 | Name is requerd!"; 67 | } else { 68 | $crrName = $name; 69 | } 70 | if (empty($email)) { 71 | $errEmail = "Email is requerd!"; 72 | } else { 73 | $crrEmail = $email; 74 | } 75 | if (isset($crrName) && isset($crrEmail)) { 76 | $updateQuery = "UPDATE `users` SET `name` = '$name', `email`= '$email' WHERE `id`= $uid"; 77 | $update = mysqli_query($conn, $updateQuery); 78 | 79 | if (!$update) { 80 | echo ""; 81 | } else { 82 | echo ""; 83 | } 84 | } 85 | } 86 | 87 | if (isset($_GET['uid'])) { 88 | $uid = $_GET['uid']; 89 | $userQuery = "SELECT * FROM `users`WHERE `id` = $uid"; 90 | $runuser = mysqli_query($conn, $userQuery); 91 | $user = mysqli_fetch_assoc($runuser); 92 | 93 | ?> 94 |
95 |

Update User

96 |
97 | 98 | '> 99 | 100 |

101 | '> 102 | 103 |

104 | 105 | 106 | 107 | 108 |
109 |
110 | 111 | 112 | alert ('Something went wrong')"; 120 | } else { 121 | echo ""; 122 | } 123 | } 124 | if (isset($_GET['did'])) { 125 | $did = $_GET['did']; 126 | ?> 127 | 128 |
129 |

Do you want to delete user!

130 | 131 |
132 |
133 | 134 |
135 | 136 | 137 | 138 | 139 |
140 |
141 |
142 |
143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/README.md: -------------------------------------------------------------------------------- 1 | # jQuery Lightbox Gallery [Version 2] 2 | 3 | Link to version 1: 4 | 5 | Table of Contents: 6 | - [`1. Demo`](#1-demo) 7 | 8 | - [`2. Usage`](#2-usage) 9 | - [`i. for images`](#i-for-images) 10 | - [`ii. for videos`](#ii-for-videos) 11 | - [`iii. for multimedia (images, videos, iframes)`](#iii-for-multimedia-images-videos-iframes) 12 | 13 | ## 1. Demo 14 | 15 | URL: 16 | 17 | A look at the layout of the lightbox: 18 | 19 | ![image](https://github.com/HashBrownTTM/jQuery-Lightbox-Gallery-V2/assets/93540733/bb520f8f-4ae1-4c86-a37f-9933d02e8c86) 20 | 21 | 22 | ## 2. Usage 23 | 24 | To use this jQuery script, add the following or similar jQuery plugin to your HTML 25 | 26 | ~~~ 27 | 28 | ~~~ 29 | 30 | the following css file also needs to be added: 31 | > *[cwa-lightbox.css](https://github.com/HashBrownTTM/jQuery-Lightbox-Gallery-V2/blob/main/lightbox-css/cwa-lightbox.css)* 32 | 33 | ### i. for images 34 | 35 | For the images only lightbox, add the following .js file: 36 | > *[cwa-image-lightbox.js](https://github.com/HashBrownTTM/jQuery-Lightbox-Gallery-V2/blob/main/lightbox-js/cwa-image-lightbox.js)* 37 | > 38 | > The code appends the imageContainer into the lightbox's mediaContainer 39 | 40 | ~~~ 41 | let imageContainer = $(''); 42 | let newImg = new Image(); 43 | newImg.src = arrImages[currentIndex].src; 44 | 45 | newImg.onload = function() { 46 | lightboxContent.css('justify-content', 'space-between'); 47 | mediaContainer.hide().fadeIn(); 48 | desc.hide().fadeIn(); 49 | imageContainer.attr("src", newImg.src); 50 | 51 | mediaContainer.empty().append(imageContainer); 52 | 53 | loader.hide(); 54 | $('.index-counter').css("position", "relative"); 55 | 56 | desc.empty().append(descText); 57 | currentPage.text(currentIndex + 1); 58 | }; 59 | ~~~ 60 | 61 | ### ii. for videos 62 | 63 | > *[cwa-video-lightbox.js](https://github.com/HashBrownTTM/jQuery-Lightbox-Gallery-V2/blob/main/lightbox-js/cwa-video-lightbox.js)* 64 | > 65 | > The code appends the videoContainer 66 | >> Note: the HTML video tag supports MP4, WebM, and Ogg video formats: 67 | 68 | ~~~ 69 | let videoContainer = $(` 70 | `); 76 | videoContainer.prop("volume", 0.35); 77 | 78 | let newVideo = document.createElement('video'); 79 | newVideo.src = arrVideos[currentIndex].src; 80 | 81 | newVideo.onloadedmetadata = function(){ 82 | lightboxContent.css('justify-content', 'space-between'); 83 | mediaContainer.hide().fadeIn(); 84 | desc.hide().fadeIn(); 85 | videoContainer.find('source').attr("src", newVideo.src); 86 | 87 | mediaContainer.empty().append(videoContainer); 88 | 89 | loader.hide(); 90 | $('.index-counter').css("position", "relative"); 91 | 92 | desc.empty().append(descText); 93 | currentPage.text(currentIndex + 1); 94 | } 95 | ~~~ 96 | 97 | ### iii. for multimedia (images, videos, iframes) 98 | 99 | > *[cwa-media-lightbox.js](https://github.com/HashBrownTTM/jQuery-Lightbox-Gallery-V2/blob/main/lightbox-js/cwa-media-lightbox.js)* 100 | > 101 | > In this instance, specifying what the media types are is needed, as seen in this JSON data (of course there are other ways of doing this): 102 | > 103 | >> Note for the iframe: the url/link is the link that will be in the src of the HTML iframe tag 104 | 105 | ~~~ 106 | [ 107 | { 108 | "src" : "media/images/will-4lbniAdMzcc-unsplash.webp", 109 | "type": "image", 110 | "desc" : "Photo by Will on Unsplash https://unsplash.com/photos/4lbniAdMzcc" 111 | }, 112 | { 113 | "src" : "media/videos/video (720p).mp4", 114 | "type": "video", 115 | "desc" : "Video by Pressmaster: https://www.pexels.com/video/digital-formation-of-a-dna-in-an-animated-presentation-3191572/" 116 | }, 117 | { 118 | "src" : "https://www.youtube.com/embed/dQw4w9WgXcQ?si=FmFdlBKYvNF_Evze", 119 | "type": "iframe", 120 | "desc" : "Rick Astley - Never Gonna Give You Up (Official Music Video)" 121 | } 122 | ] 123 | ~~~ 124 | 125 | > The code then checks for the media type via a switch statement, and appends the corresponding media container: 126 | 127 | ~~~ 128 | switch(mediaType){ 129 | case "video": 130 | //Code for appending the videoContainer 131 | break; 132 | 133 | case "image": 134 | //Code for appending the imageContainer 135 | break; 136 | 137 | case "iframe": 138 | let iframeContainer = $(``) 139 | let iframeSrc = arrMedia[currentIndex].src; 140 | 141 | lightboxContent.css('justify-content', 'space-between'); 142 | mediaContainer.hide().fadeIn(); 143 | desc.hide().fadeIn(); 144 | iframeContainer.attr("src", iframeSrc); 145 | 146 | mediaContainer.empty().append(iframeContainer); 147 | 148 | loader.hide(); 149 | $('.index-counter').css("position", "relative"); 150 | 151 | desc.empty().append(descText); 152 | currentPage.text(currentIndex + 1); 153 | break; 154 | } 155 | ~~~ 156 | -------------------------------------------------------------------------------- /project/admin/orders.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | real_escape_string(secureData($_POST['product_id'])); 6 | $status = $conn->real_escape_string(secureData($_POST['status'])); 7 | $updateStatusQuery = $conn->query("UPDATE `order_items` SET `status` = '$status' WHERE `product_id` = $productId"); 8 | if ($updateStatusQuery) { 9 | echo ""; 10 | } else { 11 | echo ""; 12 | } 13 | } 14 | ?> 15 |
16 | 17 |
18 |
19 |
20 |
21 | Orders 22 |
23 |
24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | query("SELECT * FROM `orders`"); 42 | while ($order = $selectOrdersQuery->fetch_assoc()) { 43 | ?> 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 |
Order IDNameEmailPhoneAddressTotalActions
52 | View 53 | Delete 54 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | query("SELECT * FROM `orders` WHERE `id` = $orderId"); 74 | $order = $selectOrderQuery->fetch_assoc(); 75 | $selectOrderItemsQuery = $conn->query("SELECT * FROM `order_items` WHERE `order_id` = $orderId"); 76 | while ($orderItem = $selectOrderItemsQuery->fetch_assoc()) { 77 | $selectProductQuery = $conn->query("SELECT * FROM `products` WHERE `id` = " . $orderItem['product_id']); 78 | $product = $selectProductQuery->fetch_assoc(); 79 | ?> 80 | 81 | 82 | 83 | 84 | 85 | 96 | 97 | 98 | 99 |
ProductPriceQuantityTotalStatus
86 |
87 | 88 | 93 | 94 |
95 |
100 | 101 |
102 |
103 |
104 |
105 |
106 | -------------------------------------------------------------------------------- /jquery/js/mixed-media-gallery/mixed-media-gallery/lightbox-js/cwa-media-lightbox.js: -------------------------------------------------------------------------------- 1 | function mediaLightbox(arrMedia){ 2 | let arrayLength = arrMedia.length; 3 | let currentIndex = 0; 4 | const body = $('body'); 5 | 6 | /* HTML LIGHTBOX COMPONENTS */ 7 | body.append(''); 8 | const lightboxOverlay = $('.lightbox-overlay'); 9 | let lightboxContent = $('.lightbox-content'); 10 | 11 | //navigation buttons 12 | if(arrayLength > 1){ 13 | lightboxOverlay.append(''); 14 | lightboxOverlay.append(''); 15 | } 16 | 17 | //close button 18 | lightboxOverlay.append(''); 19 | 20 | //index counter 21 | lightboxContent.append(` 22 |
23 | | 24 |
`); 25 | 26 | $(".totalPg").text(arrayLength); 27 | 28 | lightboxContent.append('
'); 29 | lightboxContent.append(''); 30 | 31 | //content/image description 32 | lightboxContent.append('
'); 33 | 34 | showLightbox(currentIndex); 35 | 36 | // disables scrolling in window 37 | body.addClass('lightbox-scroll'); 38 | 39 | function showLightbox(index){ 40 | let currentPage = $('.pgNum'); 41 | let loader = $(".lightbox-content .lightbox-loader"); 42 | let mediaContainer = $(".media-container"); 43 | let desc = $('.desc'); 44 | 45 | currentIndex = (index + arrayLength) % arrayLength; 46 | 47 | //shows loader 48 | lightboxContent.css('justify-content', 'center'); 49 | loader.show(); 50 | $('.index-counter').css("position", "absolute"); 51 | //hides media container 52 | mediaContainer.hide(); 53 | desc.hide(); 54 | 55 | let mediaType = arrMedia[currentIndex].type; 56 | let descText = arrMedia[currentIndex].desc; 57 | 58 | // Find occurrences of http/https links in the text and replace them with tags 59 | descText = descText.replace(/(https?:\/\/[^\s]+)/g, function(displayedLink) { 60 | return `${displayedLink}`; 61 | }); 62 | 63 | switch(mediaType){ 64 | case "video": 65 | let videoContainer = $(` 66 | `); 72 | videoContainer.prop("volume", 0.35); 73 | 74 | let newVideo = document.createElement('video'); 75 | newVideo.src = arrMedia[currentIndex].src; 76 | 77 | newVideo.onloadedmetadata = function(){ 78 | lightboxContent.css('justify-content', 'space-between'); 79 | mediaContainer.hide().fadeIn(); 80 | desc.hide().fadeIn(); 81 | videoContainer.find('source').attr("src", newVideo.src); 82 | 83 | mediaContainer.empty().append(videoContainer); 84 | 85 | loader.hide(); 86 | $('.index-counter').css("position", "relative"); 87 | 88 | desc.empty().append(descText); 89 | currentPage.text(currentIndex + 1); 90 | } 91 | break; 92 | 93 | case "image": 94 | let imageContainer = $(''); 95 | let newImg = new Image(); 96 | newImg.src = arrMedia[currentIndex].src; 97 | 98 | newImg.onload = function() { 99 | lightboxContent.css('justify-content', 'space-between'); 100 | mediaContainer.hide().fadeIn(); 101 | desc.hide().fadeIn(); 102 | imageContainer.attr("src", newImg.src); 103 | 104 | mediaContainer.empty().append(imageContainer); 105 | 106 | loader.hide(); 107 | $('.index-counter').css("position", "relative"); 108 | 109 | desc.empty().append(descText); 110 | currentPage.text(currentIndex + 1); 111 | }; 112 | break; 113 | 114 | case "iframe": 115 | let iframeContainer = $(``) 116 | let iframeSrc = arrMedia[currentIndex].src; 117 | 118 | lightboxContent.css('justify-content', 'space-between'); 119 | mediaContainer.hide().fadeIn(); 120 | desc.hide().fadeIn(); 121 | iframeContainer.attr("src", iframeSrc); 122 | 123 | mediaContainer.empty().append(iframeContainer); 124 | 125 | loader.hide(); 126 | $('.index-counter').css("position", "relative"); 127 | 128 | desc.empty().append(descText); 129 | currentPage.text(currentIndex + 1); 130 | break; 131 | } 132 | } 133 | 134 | //CLICK EVENTS 135 | // Function to close the lightbox 136 | function closeLightbox() { 137 | $(".lightbox-overlay").remove(); 138 | // enables scrolling in window 139 | body.removeClass('lightbox-scroll'); 140 | } 141 | 142 | // Listen for the "popstate" event (back button) 143 | window.history.pushState({id:1}, null, null); 144 | window.addEventListener('popstate', function(){ 145 | closeLightbox(); 146 | }); 147 | 148 | $(".close").on('click', function(){ 149 | closeLightbox(); 150 | }); 151 | 152 | $(".prev").on('click', function(){ 153 | showLightbox(currentIndex -= 1); 154 | }); 155 | 156 | $(".next").on('click', function(){ 157 | showLightbox(currentIndex += 1); 158 | }); 159 | 160 | $(document).on( "keydown", function(e) { 161 | if (e.key === "ArrowLeft") { // Left arrow key 162 | showLightbox(currentIndex -= 1); 163 | } 164 | else if (e.key === "ArrowRight") { // Right arrow key 165 | showLightbox(currentIndex += 1); 166 | } 167 | }); 168 | } -------------------------------------------------------------------------------- /php hw 2/Shohag/form.php: -------------------------------------------------------------------------------- 1 | alert(' Your submition is successful!')"; 68 | } 69 | } 70 | 71 | ?> 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Form 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 |
88 |

Sing up form

89 |
90 | 91 |
92 | 93 |
94 |
95 | 96 |
97 | 98 |
99 |
100 | 101 |
102 | 103 |
104 |
105 | 106 |
py-1 rounded px-2 position-relative"> 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
116 |
117 | 118 |
"> 119 |
120 | 121 |
122 |
123 | 126 |
127 |
128 | 131 |
132 |
133 | 136 |
137 | 138 | 139 | 140 |
141 |
142 | 143 |
144 | 151 |
152 |
153 |
154 | 155 |
156 |
157 |
158 |
159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /project/admin/all-products.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 |
7 |
8 |
9 | 10 |

All Products

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | query("SELECT * FROM `products`"); 24 | $sn = 1; 25 | while ($product = $products->fetch_assoc()) { 26 | ?> 27 | 28 | 29 | 30 | 31 | 32 | 36 | 37 | 38 | 39 |
SNNameImagePriceAction
33 | Edit 34 | Delete 35 |
40 | 41 | real_escape_string(secureData($_POST['eid'])); 44 | $name = $conn->real_escape_string(secureData($_POST['name'])); 45 | $price = $conn->real_escape_string(secureData($_POST['price'])); 46 | $description = $conn->real_escape_string(secureData($_POST['description'])); 47 | $image = $_FILES['image']['name']; 48 | $imageTmp = $_FILES['image']['tmp_name']; 49 | // check if image is emty or not 50 | if (!empty($image)) { 51 | $image = time() . $image; 52 | $imagePath = "../assets/images/products/$image"; 53 | move_uploaded_file($imageTmp, $imagePath); 54 | // unlink previous image 55 | $oldImage = $conn->query("SELECT `image` FROM `products` WHERE `id` = $eid")->fetch_assoc()['image']; 56 | unlink("../assets/images/products/$oldImage"); 57 | $updateProductQuery = $conn->query("UPDATE `products` SET `name` = '$name', `price` = '$price', `description` = '$description', `image` = '$image' WHERE `id` = $eid"); 58 | if ($updateProductQuery) { 59 | echo ""; 60 | } else { 61 | echo ""; 62 | } 63 | } else { 64 | $updateProductQuery = $conn->query("UPDATE `products` SET `name` = '$name', `price` = '$price', `description` = '$description' WHERE `id` = $eid"); 65 | if ($updateProductQuery) { 66 | echo ""; 67 | } else { 68 | echo ""; 69 | } 70 | } 71 | } 72 | 73 | if (isset($_GET['eid'])) { 74 | $eid = $_GET['eid']; 75 | $product = $conn->query("SELECT * FROM `products` WHERE `id` = $eid")->fetch_assoc(); 76 | ?> 77 |

Edit Product

78 |
79 |
80 |
81 |
82 | 83 |
84 | 85 | 86 |
87 |
88 | 89 | 90 |
91 |
92 | 93 | 94 |
95 |
96 | 97 | 98 |
99 |
100 | 101 |
102 |
103 |
104 |
105 |
106 |
107 | 108 |
109 |
110 |
111 | 112 |
113 |
114 |
115 |
116 |
117 | 129 | -------------------------------------------------------------------------------- /php hw 2/Wasim form Validation Assignment/cc.php: -------------------------------------------------------------------------------- 1 | akert('Done') "; 70 | } 71 | } 72 | ?> 73 | 74 | 75 | 76 | 77 | 78 | 79 | Practise 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 |
88 |

Sign-up

89 | 90 | 91 |
92 | 93 |
94 | 95 |
96 |
97 | 98 |
99 | 100 |
101 |
102 | 103 |
104 | 105 |
106 | 107 | 108 |
109 | 110 | 111 |
112 | 113 |
114 | 115 |
116 | 117 |
118 | 121 |
122 | 123 |
124 | 127 |
128 | 129 | 130 | 131 | 132 | 133 | 134 |
135 |
136 | 137 | 138 | 139 |
140 |
141 | 142 |
143 |
144 | 147 |
148 |
149 | 152 |
153 | 154 |
155 | 158 |
159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 |
167 |
168 | 169 |
170 | 176 |
177 |
178 | 179 | 180 | 181 |
182 | 183 |
184 |
185 |
186 |
187 |
188 | 189 | 190 | -------------------------------------------------------------------------------- /L8-form-validation.php: -------------------------------------------------------------------------------- 1 | alert('Done')"; 66 | $yname = $age = $email = $gender = $hobbies = $city = null; 67 | $crrName = $crrAge = $crrEmail = $crrGender = $crrHobbies = $crrCity = null; 68 | } 69 | } 70 | ?> 71 | 72 | 73 | 74 | 75 | 76 | 77 | Document 78 | 79 | 80 | 81 | 82 | 83 |
84 |
85 |
86 |

Registration Form

87 |
88 |
89 | 90 |
91 | 92 |
93 |
94 |
95 | 96 |
97 | 98 |
99 |
100 |
101 | 102 |
103 | 104 |
105 |
106 |
rounded py-1 position-relative"> 107 |
108 | 111 |
112 |
113 | 116 |
117 |
118 | 121 |
122 | 123 | 124 | 125 | 126 | 127 |
128 |
129 | 130 |
131 |
rounded py-1 position-relative"> 132 |
133 | 136 |
137 |
138 | 141 |
142 |
143 | 146 |
147 |
148 | 151 |
152 | 153 | 154 | 155 | 156 | 157 |
158 |
159 | 160 |
161 |
162 | 168 |
169 | 170 |
171 |
172 | 173 |
174 |
175 |
176 |
177 | 178 | 179 | --------------------------------------------------------------------------------