├── project
├── tailwind.config.js
├── assets
│ └── images
│ │ └── heroBanner.png
├── uploads
│ ├── products
│ │ ├── laptop1.webp
│ │ ├── laptop2.webp
│ │ ├── laptop3.webp
│ │ ├── laptop4.webp
│ │ └── laptop5.webp
│ ├── images
│ │ └── d204e360e7d6f5a2126a5c70a5474a62.png
│ └── profile_pictures
│ │ └── c3060c8c35a07a39cca57b32eae2d482.jpg
├── logout.php
├── index.php
├── header.php
├── components
│ ├── home
│ │ ├── hero.php
│ │ └── product-list.php
│ └── navbar.php
├── admin
│ ├── header.php
│ ├── footer.php
│ ├── add-new-product.php
│ ├── all-products.php
│ ├── index.php
│ └── sidebar.php
├── add-to-cart.php
├── cart.php
├── product-details.php
├── contact.php
├── sign-in.php
├── sign-up.php
├── shop.php
├── footer.php
└── about.php
├── removeSession.php
├── checkShassion.php
├── uploads
├── 0o2at012fT37RdOc10rc56c0fep26sbmh67bd824y2eGv2895W6nd5eAE1c29df67rJ.jpg
├── Ot90seaAo6075o4c12m70P07e08edV7n7edd945356er0n62a2f0CfW4Rdry29fY3pb.jpg
├── dWi0a5h9ed66d4690me2X952ftO26oTn9PZ3yR2xv089e2r7s058206eb9rdp4mI72c.jpg
└── r75W74dbHQd020Za5tmX22je1d68c22es5yb74Y39ef62pobns9d0dVt70O2059r649.jpg
├── day-1.php
├── day-12.php
├── day-6.php
├── day-13.php
├── day-11.php
├── day-5.php
├── day-10.php
├── day-3.php
├── day-2.php
├── day-4.php
├── day-14.php
├── day-19.php
└── day-7-8-9.php
/project/tailwind.config.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/removeSession.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/checkShassion.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/project/assets/images/heroBanner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/assets/images/heroBanner.png
--------------------------------------------------------------------------------
/project/uploads/products/laptop1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/products/laptop1.webp
--------------------------------------------------------------------------------
/project/uploads/products/laptop2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/products/laptop2.webp
--------------------------------------------------------------------------------
/project/uploads/products/laptop3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/products/laptop3.webp
--------------------------------------------------------------------------------
/project/uploads/products/laptop4.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/products/laptop4.webp
--------------------------------------------------------------------------------
/project/uploads/products/laptop5.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/products/laptop5.webp
--------------------------------------------------------------------------------
/project/uploads/images/d204e360e7d6f5a2126a5c70a5474a62.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/images/d204e360e7d6f5a2126a5c70a5474a62.png
--------------------------------------------------------------------------------
/project/uploads/profile_pictures/c3060c8c35a07a39cca57b32eae2d482.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/project/uploads/profile_pictures/c3060c8c35a07a39cca57b32eae2d482.jpg
--------------------------------------------------------------------------------
/uploads/0o2at012fT37RdOc10rc56c0fep26sbmh67bd824y2eGv2895W6nd5eAE1c29df67rJ.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/uploads/0o2at012fT37RdOc10rc56c0fep26sbmh67bd824y2eGv2895W6nd5eAE1c29df67rJ.jpg
--------------------------------------------------------------------------------
/uploads/Ot90seaAo6075o4c12m70P07e08edV7n7edd945356er0n62a2f0CfW4Rdry29fY3pb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/uploads/Ot90seaAo6075o4c12m70P07e08edV7n7edd945356er0n62a2f0CfW4Rdry29fY3pb.jpg
--------------------------------------------------------------------------------
/uploads/dWi0a5h9ed66d4690me2X952ftO26oTn9PZ3yR2xv089e2r7s058206eb9rdp4mI72c.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/uploads/dWi0a5h9ed66d4690me2X952ftO26oTn9PZ3yR2xv089e2r7s058206eb9rdp4mI72c.jpg
--------------------------------------------------------------------------------
/uploads/r75W74dbHQd020Za5tmX22je1d68c22es5yb74Y39ef62pobns9d0dVt70O2059r649.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asif-daffodil/cmbd-300plus/HEAD/uploads/r75W74dbHQd020Za5tmX22je1d68c22es5yb74Y39ef62pobns9d0dVt70O2059r649.jpg
--------------------------------------------------------------------------------
/project/logout.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/day-1.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 | ";
13 | echo "Hello World!", " ";
14 | print "Our Bangladesh ";
15 | var_dump("ha ha ha");
16 | echo " ";
17 | var_dump(123);
18 | ?>
19 |
20 |
--------------------------------------------------------------------------------
/project/index.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
22 |
--------------------------------------------------------------------------------
/day-12.php:
--------------------------------------------------------------------------------
1 | bachShift = $s;
10 | }
11 | }
12 |
13 | $obj = new students;
14 | echo $obj->batchNo."\n";
15 | $obj->shift("Morning");
16 | echo $obj->bachShift."\n";
17 | $obj->total = 2000;
18 | echo $obj->total."\n";
19 | // echo $obj->floor."\n";
20 |
21 | class candidate extends students {
22 | public function examShift () {
23 | $this->shift("Afternoon");
24 | return $this->bachShift ?? "Not Found";
25 | }
26 | }
27 | $obj2 = new candidate;
28 | echo $obj2->examShift();
29 |
30 | ?>
--------------------------------------------------------------------------------
/project/header.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/day-6.php:
--------------------------------------------------------------------------------
1 | ";
15 | // echo $myOtherName;
16 |
17 | echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
18 |
19 | echo "";
20 | print_r($_SERVER);
21 | echo " ";
22 | */
23 |
24 | // if(isset($_GET['sub123'])) {
25 | // echo $_GET['uName'];
26 | // }
27 |
28 | // if(isset($_REQUEST['sub123'])) {
29 | // echo $_REQUEST['uName'];
30 | // }
31 |
32 | if(isset($_POST['sub123'])) {
33 | echo $_POST['uName'];
34 | }
35 | ?>
36 |
37 |
41 |
42 |
--------------------------------------------------------------------------------
/day-13.php:
--------------------------------------------------------------------------------
1 | subject $msg \n";
8 | }
9 |
10 | public function myFunc () {
11 | echo "this is $this->subject\n";
12 | }
13 |
14 | public static function sFunc () {
15 | return "This is a demo data \n";
16 | }
17 |
18 | public function __destruct() {
19 | echo "this is a destruct function.\n";
20 | }
21 | }
22 |
23 | $obj = new Day_13("This is my message");
24 | $obj->subject = "JavaScript";
25 | $obj->myFunc();
26 | echo $obj::myName;
27 | echo $obj::$city;
28 | echo $obj::sFunc();
29 |
30 | class otherClass {
31 | public static string $country = "Bangladesh\n";
32 |
33 | public static function myMethod (): string {
34 | return "This is a static method\n";
35 | }
36 | private function __construct () {
37 | return ;
38 | }
39 | }
40 |
41 | // $otherObj = new otherClass;
42 | echo otherClass::$country;
43 | echo otherClass::myMethod();
44 | ?>
--------------------------------------------------------------------------------
/project/components/home/hero.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Shop Top Brands & Latest Deals Online
6 |
Browse thousands of products across categories with fast shipping, easy returns, and secure checkout. Find great deals and curated collections tailored just for you.
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/day-11.php:
--------------------------------------------------------------------------------
1 | ";
5 | echo dirname($url)." ";
6 |
7 | /*
8 | // copy()
9 | $source = "day-10.php";
10 | $destination = "day-10-copy.php";
11 | if (copy($source, $destination)) {
12 | echo "File copied successfully.";
13 | } else {
14 | echo "Failed to copy file.";
15 | }
16 |
17 | // file_get_contents
18 | $fileContent = file_get_contents("day-10.php");
19 | echo nl2br(htmlspecialchars($fileContent));
20 | */
21 |
22 | // link()
23 | // link("./day-10.php", "./day-10-link.php");
24 |
25 | // JSON (encode, decode)
26 | $data = ["name" => "John", "age" => 30];
27 | $json = json_encode($data);
28 | echo $json;
29 |
30 | $decoded = json_decode($json, true);
31 | print_r($decoded);
32 | echo " ";
33 |
34 | // Date Time
35 | date_default_timezone_set("Asia/Dhaka");
36 | echo date("Y-m-d H:i:s a D")." ";
37 | echo date("y-M-d h:i:s A l")." ";
38 | echo date("y-F-d h:i:s A l")." ";
39 |
40 | // mktime()
41 | $timestamp = mktime(15, 30, 0, 12, 25, 2024);
42 | echo date("Y-m-d H:i:s l", $timestamp)." ";
43 |
44 | // strtotime()
45 | $timeString = "next Friday";
46 | $timestamp = strtotime($timeString);
47 | echo date("Y-m-d H:i:s l", $timestamp)." ";
48 | $timestamp = strtotime("+2 weeks 3 days 5 hours");
49 | echo date("Y-m-d H:i:s l", $timestamp)." ";
50 |
51 | ?>
--------------------------------------------------------------------------------
/project/admin/header.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/day-5.php:
--------------------------------------------------------------------------------
1 | ";
12 | $num = -5.67;
13 | echo abs($num);
14 | echo " ";
15 | echo round($num);
16 | echo " ";
17 | echo ceil($num);
18 | echo " ";
19 | echo floor($num);
20 |
21 | // ++ --
22 | // .
23 | echo " " . "Hello" . " World" . "!" . " ";
24 | // trim()
25 | $text = " Hello World! ";
26 | echo trim($text) . " ";
27 | // stripslashes()
28 | $str = "Hello\\ World!";
29 | echo stripslashes($str) . " ";
30 |
31 | // built-in string functions
32 | // strlen()
33 | $string = "Hello World!";
34 | echo strlen($string) . " ";
35 |
36 | // str_word_count()
37 | echo str_word_count($string) . " ";
38 | // strrev()
39 | echo strrev($string) . " ";
40 | // substr()
41 | echo substr($string, 0, 5) . " ";
42 | // str_replace()
43 | echo str_replace("World", "PHP", $string) . " ";
44 | // strtolower()
45 | echo strtolower($string) . " ";
46 | // strtoupper()
47 | echo strtoupper($string) . " ";
48 | // strpos()
49 | echo ucfirst($string) . " ";
50 |
51 | function myInfo ($fName = "Kuddus", $lName = "Boyati") {
52 | return "My full name is " . $fName . " " . $lName;
53 | }
54 |
55 | echo myInfo("Asif", "Khan") . " ";
56 | echo myInfo("Priyongkor", "Sarkar") . " ";
57 | echo myInfo() . " ";
58 | echo myInfo("Adiba") . " ";
59 |
60 | // Regular expression
61 | $myName = "Asif";
62 | if(preg_match("/^[A-Za-z. ]*$/", $myName)) {
63 | echo "Matched perfectly";
64 | }
65 | ?>
--------------------------------------------------------------------------------
/day-10.php:
--------------------------------------------------------------------------------
1 | Please upload an image file";
11 | } else {
12 | $ext = pathinfo($imageName, PATHINFO_EXTENSION);
13 | if (!in_array($ext, $allowedExt)) {
14 | $imageMsg = "Invalid image file ";
15 | } elseif ($size > 2097152) {
16 | $imageMsg = "Image size is more then 2 MB ";
17 | } else {
18 | $capital = "ABCEFGHIJKLMNOPQRSTUVWXYZ";
19 | $small = "abcdefghijklmnopqrstuvwxyz";
20 | $numbers = "0123456789";
21 | $randomName = str_shuffle(uniqid() . date("hisalFdY") . rand(100000, 999999) . substr(str_shuffle($capital), 0, 6) . substr(str_shuffle($small), 0, 6) . substr(str_shuffle($numbers), 0, 6));
22 | $ext = pathinfo($imageName, PATHINFO_EXTENSION);
23 | $newFileName = $randomName . "." . $ext;
24 | $destination = "./uploads/" . $newFileName;
25 | if (!getimagesize($tmpName)) {
26 | $imageMsg = "Invalid image file ";
27 | } else {
28 | if (!is_dir("./uploads")) {
29 | mkdir("./uploads");
30 | }
31 | $move = move_uploaded_file($tmpName, $destination);
32 | if (!$move) {
33 | $imageMsg = "Image upload failed ";
34 | } else {
35 | $imageMsg = "Image upload successful ";
36 | }
37 | }
38 | }
39 | }
40 | }
41 | ?>
42 |
43 |
47 | = $imageMsg ?? null ?>
--------------------------------------------------------------------------------
/project/admin/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
11 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/project/add-to-cart.php:
--------------------------------------------------------------------------------
1 | history.back();";
5 | exit();
6 | }
7 | $id = intval($_GET['id']);
8 | $conn = mysqli_connect("localhost", "root", "", "project-309");
9 |
10 | if (!$conn) {
11 | echo "";
12 | exit();
13 | }
14 |
15 | $getData = $conn->query("SELECT * FROM products WHERE id = $id");
16 |
17 | if($getData && $getData->num_rows !== 1) {
18 | echo "";
19 | exit();
20 | }
21 |
22 | $product = $getData->fetch_object();
23 | $quantity = isset($_GET['quantity']) ? intval($_GET['quantity']) : 1;
24 | if ($quantity < 1) {
25 | $quantity = 1;
26 | }
27 |
28 | if (!isset($_SESSION['cart'])) {
29 | $_SESSION['cart'][$product->id] = [
30 | 'name' => $product->name,
31 | 'price' => $product->price,
32 | 'image' => $product->image,
33 | 'quantity' => $quantity
34 | ];
35 | // js history back with query param to show added to cart message
36 | echo "";
47 | exit();
48 | }
49 |
50 | if(isset($_SESSION['cart'])) {
51 | if(array_key_exists($product->id, $_SESSION['cart'])) {
52 | $_SESSION['cart'][$product->id]['quantity'] += $quantity;
53 | } else {
54 | $_SESSION['cart'][$product->id] = [
55 | 'name' => $product->name,
56 | 'price' => $product->price,
57 | 'image' => $product->image,
58 | 'quantity' => $quantity
59 | ];
60 | }
61 | // js history back with query param to show added to cart message
62 | echo "";
73 | exit();
74 | }
75 |
76 | ?>
--------------------------------------------------------------------------------
/day-3.php:
--------------------------------------------------------------------------------
1 | ";
5 | echo round(5.4);
6 | echo " ";
7 | echo floor(5.9);
8 | echo " ";
9 | echo ceil(5.1);
10 | echo " ";
11 | echo pi();
12 | echo " ";
13 | echo rand(1, max: 100);
14 | echo " ";
15 | echo sqrt(64);
16 | echo " ";
17 | echo uniqid();
18 | echo " ";
19 | echo pow(2, 3);
20 | echo " ";
21 |
22 | // if, else if, else
23 | $age = -20;
24 | if($age < 12 && $age > 0) {
25 | echo "You are a child";
26 | } else if ($age < 20 && $age > 12) {
27 | echo "You are a teenager";
28 | } else if ($age < 30 && $age > 20) {
29 | echo "You are a young adult";
30 | } else if ($age < 50 && $age > 30) {
31 | echo "You are a middle-aged adult";
32 | } else if ($age < 150 && $age > 50) {
33 | echo "You are an old person";
34 | }else {
35 | echo "You are not in this world";
36 | }
37 |
38 | echo " ";
39 |
40 | // Switch case
41 | $day = Date("l");
42 | switch($day) {
43 | case("Sunday");
44 | echo "Today is Sunday";
45 | break;
46 | case("Monday");
47 | echo "Today is Monday";
48 | break;
49 | case("Tuesday");
50 | echo "Today is Tuesday";
51 | break;
52 | case("Wednesday");
53 | echo "Today is Wednesday";
54 | break;
55 | case("Thursday");
56 | echo "Today is Thursday";
57 | break;
58 | case("Friday");
59 | echo "Today is Friday";
60 | break;
61 | case("Saturday");
62 | echo "Today is Saturday";
63 | break;
64 | }
65 |
66 | echo " ";
67 | // ternary
68 | $num = 12;
69 | echo ($num < 10) ? "The number is smaller than 10" : "The number is grater than 10";
70 | echo " ";
71 |
72 | // null safe
73 | echo $city ?? "Dhaka";
74 | echo " ";
75 |
76 | $unit = 275;
77 | $bill = 0;
78 | if($unit <= 50) {
79 | $bill = 50 * 3.50;
80 | }else if($unit > 50 && $unit <= 150) {
81 | $bill = (50 * 3.50) + (($unit-50) * 4);
82 | }else if($unit > 150 && $unit <= 250){
83 | $bill = (50 * 3.50) + (100 * 4) + (($unit - 150) * 5.20);
84 | }elseif ($unit > 250) {
85 | $bill = (50 * 3.50) + (100 * 4) + (100 * 5.20) + (($unit - 250) * 6.50);
86 | }
87 | echo $bill;
88 | ?>
--------------------------------------------------------------------------------
/day-2.php:
--------------------------------------------------------------------------------
1 | ";
6 |
7 | // integer
8 | $data2 = 123;
9 | var_dump($data2);
10 | echo " ";
11 |
12 | // float
13 | $data3 = 12.3;
14 | var_dump($data3);
15 | echo " ";
16 |
17 | // boolean
18 | $data4 = true;
19 | var_dump($data4);
20 | echo " ";
21 |
22 | // null
23 | $data5 = null;
24 | var_dump($data5);
25 | echo " ";
26 |
27 | // array
28 | $data6 = [1,2,3,4];
29 | var_dump($data6);
30 | echo " ";
31 |
32 | // object
33 | $obj = new class {
34 | public $pro;
35 | };
36 | var_dump($obj);
37 | echo " ";
38 |
39 | // resource
40 | $file = fopen("./day-1.php", "r");
41 | var_dump($file);
42 | echo " ";
43 |
44 | // Constants
45 | const x = 123;
46 | echo x." ";
47 |
48 | // define
49 | define("y", 123);
50 | echo y." ";
51 |
52 | // Comments
53 |
54 | // single line comment
55 | # this is also a single line comment
56 | /*
57 | this is
58 | a
59 | multiline
60 | comment
61 | */
62 | /**
63 | * Bangladesh
64 | * Dhaka
65 | * Chittagong
66 | * Rajshahi
67 | * Khulna
68 | */
69 |
70 | echo "$data1 ";
71 | echo '$data1 ';
72 |
73 | // operators
74 | /**
75 | * Arithmetic Operators
76 | * + Sum
77 | * - Subtract
78 | * * Multiply
79 | * / Divide
80 | * % Modulus
81 | * ** Exponentiation
82 | */
83 |
84 | /**
85 | * Assignment Operators
86 | * = Assign
87 | * += Add and Assign
88 | * -= Subtract and Assign
89 | * *= Multiply and Assign
90 | * /= Divide and Assign
91 | * %= Modulus and Assign
92 | * **= Exponentiation and Assign
93 | */
94 |
95 | /**
96 | * Comparison Operators
97 | * == Equal
98 | * === Identical
99 | * != Not Equal
100 | * !== Not Identical
101 | * > Greater Than
102 | * < Less Than
103 | * >= Greater Than or Equal To
104 | * <= Less Than or Equal To
105 | */
106 |
107 | /**
108 | * Increment / Decrement Operators
109 | * ++$a Pre-increment
110 | * $a++ Post-increment
111 | * --$a Pre-decrement
112 | * $a-- Post-decrement
113 | */
114 |
115 | /**
116 | * Logical Operators
117 | * && And
118 | * || Or
119 | * ! Not
120 | */
121 |
122 | 6 > 3 && 5 === "5"; // false
123 | 6 > 3 || 5 === "5"; // true
124 | ?>
--------------------------------------------------------------------------------
/project/cart.php:
--------------------------------------------------------------------------------
1 | Swal.fire({ title: 'Item removed', text: 'The item has been removed from your cart.', icon: 'success', showConfirmButton: false, timer: 1500 }).then(() => { window.location.href = 'cart.php'; });";
13 | }
14 | ?>
15 |
16 |
17 |
18 |
Your Cart is Empty
19 |
Add items to your cart to see them here.
20 |
21 |
22 |
23 |
24 |
25 | Product
26 | Price
27 | Quantity
28 | Total
29 | Action
30 |
31 |
32 |
33 | $item) {
36 | $total = $item['price'] * $item['quantity'];
37 | $grandTotal += $total;
38 | ?>
39 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
50 |
51 | BDT = $item['price'] ?>
52 |
53 |
54 | = $item['quantity'] ?>
55 |
56 |
57 | BDT = $total ?>
58 |
59 |
60 | Remove
61 |
62 |
63 |
64 |
65 |
66 |
67 | Total
68 |
69 |
70 | BDT = $grandTotal ?>
71 |
72 |
73 |
74 |
75 |
76 |
79 |
80 |
81 |
87 |
88 |
--------------------------------------------------------------------------------
/project/admin/add-new-product.php:
--------------------------------------------------------------------------------
1 |
18 | Swal.fire('Error', 'File is not an image.', 'error');
19 | ";
20 | } else {
21 | // Move uploaded file to target directory
22 | if (move_uploaded_file($_FILES["product_image"]["tmp_name"], $target_file)) {
23 | // remove ../ from the path to store in database
24 | $target_file = str_replace("../", "./", $target_file);
25 | // Insert product into database
26 | $sql = "INSERT INTO products (name, price, image, description) VALUES ('$product_name', '$product_price', '$target_file', '$product_description')";
27 | if (mysqli_query($conn, $sql)) {
28 | echo "";
31 | } else {
32 | echo "";
35 | }
36 | } else {
37 | echo "";
40 | }
41 | }
42 | }
43 | ?>
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
Add New Product
52 |
53 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/day-4.php:
--------------------------------------------------------------------------------
1 | ";
5 | $x++;
6 | }
7 |
8 | $y = 20;
9 | do {
10 | echo $y . " ";
11 | $y++;
12 | }while ($y < 10);
13 |
14 | for ($i=0; $i < 10; $i++) {
15 | echo $i . " ";
16 | }
17 |
18 | $cityList = ["Dhaka", "Rajshahi", "Khulna", "Rangpur"];
19 | foreach($cityList as $city) {
20 | echo $city . " ";
21 | }
22 |
23 | // Indexed array
24 | echo "";
25 | echo print_r($cityList);
26 | echo " ";
27 |
28 | // Associative array
29 | $studentInfo = ["studentName" => "Adiba Sarker", "studentCity" => "Dhaka", "studentGender" => "Female"];
30 |
31 | echo "";
32 | echo print_r($studentInfo);
33 | echo " ";
34 |
35 | echo $cityList[0] . " ";
36 | echo $studentInfo["studentName"] . " ";
37 |
38 | // Multidimensional array
39 | $students = [["Kamal", 22], ["Jamal", 23], ["Tamal", 25]];
40 | echo "";
41 | echo print_r($students);
42 | echo " ";
43 | echo $students[2][0]." ";
44 |
45 | for ($i=0; $i < count($cityList); $i++) {
46 | echo $cityList[$i] . " ";
47 | }
48 |
49 | foreach ($studentInfo as $key => $stdInfo) {
50 | echo ucfirst($key) . " : " . ucfirst($stdInfo) . " ";
51 | }
52 |
53 | foreach($students as $stds){
54 | foreach($stds as $std) {
55 | echo $std. " ";
56 | }
57 | echo " ";
58 | }
59 |
60 | // array()
61 | $countryArr = array("Bangladesh", "India", "Pakistan");
62 | echo $countryArr[0] . " ";
63 |
64 | // is_array()
65 | if (is_array($countryArr)) {
66 | echo "This is an array" . " ";
67 | } else {
68 | echo "This is not an array" . " ";
69 | }
70 |
71 | // in_array()
72 | if (in_array("India", $countryArr)) {
73 | echo "India is found in the array" . " ";
74 | } else {
75 | echo "India is not found in the array" . " ";
76 | }
77 |
78 | // array_merge()
79 | $newCountryArr = array("USA", "UK", "Canada");
80 | $allCountryArr = array_merge($countryArr, $newCountryArr);
81 | echo "";
82 | echo print_r($allCountryArr);
83 | echo " ";
84 |
85 | // array_keys()
86 | $allStudentInfoKeys = array_keys($studentInfo);
87 | echo "";
88 | echo print_r($allStudentInfoKeys);
89 | echo " ";
90 |
91 | // array_key_exists()
92 | if (array_key_exists("studentName", $studentInfo)) {
93 | echo "Key 'studentName' exists in the array" . " ";
94 | } else {
95 | echo "Key 'studentName' does not exist in the array" . " ";
96 | }
97 |
98 | // array_shift()
99 | $firstStudent = array_shift($students);
100 | echo "First Student: " . print_r($firstStudent, true) . " ";
101 | echo "";
102 | echo print_r($students);
103 | echo " ";
104 |
105 | // array_unshift()
106 | array_unshift($students, ["Salam", 24]);
107 | echo "";
108 | echo print_r($students);
109 | echo " ";
110 |
111 | // array_push()
112 | array_push($students, ["Akmal", 26]);
113 | echo "";
114 | echo print_r($students);
115 | echo " ";
116 |
117 | // array_pop()
118 | $lastStudent = array_pop($students);
119 | echo "Last Student: " . print_r($lastStudent, true) . " ";
120 | echo "";
121 | echo print_r($students);
122 | echo " ";
123 |
124 | // array_values()
125 | $studentInfoValues = array_values($studentInfo);
126 | echo "";
127 | echo print_r($studentInfoValues);
128 | echo " ";
129 |
130 | // array_map()
131 | function square($n) {
132 | return $n * $n;
133 | }
134 |
135 | $numbers = [1, 2, 3, 4, 5];
136 | $squaredNumbers = array_map("square", $numbers);
137 | echo "";
138 | echo print_r($squaredNumbers);
139 | echo " ";
140 |
141 | // array_unique()
142 | $duplicateNumbers = [1, 2, 2, 3, 4, 4, 5];
143 | $uniqueNumbers = array_unique($duplicateNumbers);
144 | echo "";
145 | echo print_r($uniqueNumbers);
146 | echo " ";
147 |
148 | // array_slice()
149 | $slicedArray = array_slice($numbers, 1, 3);
150 | echo "";
151 | echo print_r($slicedArray);
152 | echo " ";
153 |
154 | // array_diff()
155 | $array1 = [1, 2, 3, 4, 5];
156 | $array2 = [4, 5, 6, 7, 8];
157 | $difference = array_diff($array1, $array2);
158 | echo "";
159 | echo print_r($difference);
160 | echo " ";
161 |
162 | // array_search()
163 | $searchKey = array_search(3, $array1);
164 | if ($searchKey !== false) {
165 | echo "Value 3 found at index: " . $searchKey . " ";
166 | } else {
167 | echo "Value 3 not found in the array" . " ";
168 | }
169 |
170 | // array_reverse()
171 | $reversedArray = array_reverse($numbers);
172 | echo "";
173 | echo print_r($reversedArray);
174 | echo " ";
175 | ?>
--------------------------------------------------------------------------------
/project/product-details.php:
--------------------------------------------------------------------------------
1 | window.location.href = 'index.php';";
5 | exit();
6 | }
7 | $id = $_GET['id'];
8 | $getProductInfo = $conn->query("SELECT * FROM products WHERE `id` = $id");
9 |
10 | if ($getProductInfo && $getProductInfo->num_rows !== 1) {
11 | echo "";
12 | exit();
13 | }
14 |
15 | $product = $getProductInfo->fetch_object();
16 | ?>
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
= $product->name ?>
34 |
35 |
37 |
39 |
40 |
42 |
44 |
45 |
47 |
49 |
50 |
52 |
54 |
55 |
57 |
59 |
60 |
50 Reviews
61 |
62 |
63 |
= $product->description ?>
64 |
65 |
66 |
BDT = $product->price ?>
67 |
BDT = $product->price + 5000 ?> (Tax included)
68 |
69 |
70 |
71 |
72 | Quantity:
73 |
74 |
75 |
76 |
77 | Buy now
78 | Add to cart
79 |
80 |
81 |
82 |
83 |
84 |
92 |
107 |
--------------------------------------------------------------------------------
/day-14.php:
--------------------------------------------------------------------------------
1 | schoolName;
21 | }
22 |
23 | public function myClass ()
24 | {
25 | return "I am a student of ".$this->className;
26 | }
27 |
28 | public function studentName ()
29 | {
30 | return "My name is ".$this->studentName;
31 | }
32 |
33 | public function studentRoll ()
34 | {
35 | return "My roll is ".$this->studentRoll;
36 | }
37 | }
38 |
39 | $studentInfoObj = new studentInfo;
40 | echo $studentInfoObj->mySchool()."\n";
41 | echo $studentInfoObj->myClass()."\n";
42 | echo $studentInfoObj->studentName()."\n";
43 | echo $studentInfoObj->studentRoll()."\n";
44 |
45 | // Overrides
46 | class studentInfo2 extends studentInfo {
47 | protected $schoolName = "XYZ School";
48 | protected $className = "Class 9";
49 | protected $studentName = "Kuddus Boyati";
50 | protected $studentRoll = 102;
51 | }
52 |
53 | // Magic methods
54 |
55 | class studentInfo3 {
56 | public $studentName = "Kamal Khan";
57 | protected $studentRoll = 101;
58 | private $studentAge = 18;
59 |
60 | public $properties = [];
61 |
62 | public function __get ($property)
63 | {
64 | if (property_exists($this, $property)) {
65 | return $this->$property;
66 | }elseif(array_key_exists($property, $this->properties)) {
67 | return $this->properties[$property];
68 | }else{
69 | return "$property does not exist";
70 | }
71 | }
72 |
73 | public function __set ($property, $value)
74 | {
75 | if(array_key_exists($property, $this->properties)) {
76 | $this->properties[$property] = $value;
77 | }else{
78 | array_push($this->properties, $property);
79 | $this->properties[$property] = $value;
80 | }
81 | }
82 |
83 | public function __isset ($property)
84 | {
85 | return isset($this->$property);
86 | }
87 |
88 | public function __unset ($property)
89 | {
90 | if (isset($this->$property)) {
91 | unset($this->$property);
92 | }else if(array_key_exists($property, $this->properties)) {
93 | unset($this->properties[$property]);
94 | }else{
95 | return "Property does not exist";
96 | }
97 | }
98 |
99 | public function __call ($method, $args)
100 | {
101 | if (method_exists($this, $method)) {
102 | return $this->$method($args);
103 | }else{
104 | return "Method does not exist";
105 | }
106 | }
107 |
108 | public static function __callStatic ($method, $args)
109 | {
110 | return "Method name is ".$method." and arguments are ".implode(", ", $args);
111 | }
112 |
113 | public function __toString ()
114 | {
115 | return "Student roll is ".$this->studentRoll;
116 | }
117 |
118 | public function __invoke ($data)
119 | {
120 | return "Invoked with ".$data;
121 | }
122 | }
123 |
124 | $studentInfoObj3 = new studentInfo3;
125 |
126 | // __get
127 | $studentInfoObj3->getDemoDataHa;
128 |
129 | // __set
130 | $studentInfoObj3->studentCity = "Dhaka";
131 | echo $studentInfoObj3->studentCity."\n";
132 |
133 | // __isset
134 | echo isset($studentInfoObj3->studentName)."\n";
135 | echo isset($studentInfoObj3->studentCity)."\n";
136 |
137 | // __unset
138 | unset($studentInfoObj3->studentName);
139 |
140 | // __call
141 | echo $studentInfoObj3->studentAge()."\n";
142 |
143 | // __callStatic
144 | echo studentInfo3::studentCity("Dhaka", "Chittagong", "Rajshahi")."\n";
145 |
146 | // __toString
147 | echo $studentInfoObj3."\n";
148 |
149 | // __invoke
150 | echo $studentInfoObj3("Hello World")."\n";
151 |
152 | // abstraction
153 | // Namespace
154 | // namespace school1;
155 | abstract class school1 {
156 | public static string $schoolName = "ABC School";
157 | abstract public function mySchool (): string;
158 | abstract public function myClass (): mixed;
159 | }
160 |
161 | class student1 extends school1 {
162 | public function mySchool () : string
163 | {
164 | return "I am a student of ABC School";
165 | }
166 |
167 | public function myClass () : string
168 | {
169 | return "I am a student of Class 10";
170 | }
171 | }
172 |
173 | final class studentInfo1 extends student1 {
174 | public function studentName () : string
175 | {
176 | return "My name is Kamal Khan";
177 | }
178 |
179 | public function studentRoll () : int
180 | {
181 | return 101;
182 | }
183 | }
184 |
185 | $studentInfoObj = new studentInfo1;
186 |
187 | // Cloning
188 | $studentInfoObj2 = clone $studentInfoObj;
189 |
190 | // Comparing Objects
191 | if ($studentInfoObj === $studentInfoObj2) {
192 | echo "Both objects are same";
193 | } else {
194 | echo "Both objects are different";
195 | }
--------------------------------------------------------------------------------
/project/components/home/product-list.php:
--------------------------------------------------------------------------------
1 | query("SELECT * FROM products ORDER BY id DESC");
3 | $pageNo = $_GET['page'] ?? 1;
4 | $totalProduct = $result->num_rows;
5 | $productPerPage = 8;
6 | $totalPage = ceil($totalProduct / $productPerPage);
7 | $startPoint = ($pageNo - 1) * $productPerPage;
8 | $result = $conn->query("SELECT * FROM products LIMIT $startPoint, $productPerPage");
9 | ?>
10 |
11 |
Featured Products
12 | num_rows > 0) { ?>
13 |
14 | fetch_object()) { ?>
15 |
83 |
84 |
85 |
86 | 1) { ?>
87 |
Previous
88 |
89 |
Previous
90 |
91 |
92 |
Page of
93 |
94 |
95 |
Next
96 |
97 |
Next
98 |
99 |
100 |
101 |
102 |
No products found.
103 |
104 |
105 |
--------------------------------------------------------------------------------
/project/contact.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Let's Talk
6 |
Have some big idea or brand to develop and need help? Then reach out we'd love to hear about your project and provide help.
7 |
26 |
27 |
62 |
63 |
64 |
65 |
67 |
69 |
71 |
73 | Send message
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/project/sign-in.php:
--------------------------------------------------------------------------------
1 | real_escape_string($email);
21 | }
22 |
23 | // validate password
24 | if (empty($password)) {
25 | $errPassword = "Password is required.";
26 | } else {
27 | $currPassword = $conn->real_escape_string($password);
28 | }
29 |
30 | // If no errors, proceed to authenticate the user
31 | if (isset($currEmail) && isset($currPassword)) {
32 | $selectQuery = "SELECT * FROM users WHERE email='$currEmail'";
33 | $result = $conn->query($selectQuery);
34 |
35 | if ($result->num_rows > 0) {
36 | $user = $result->fetch_assoc();
37 | // Verify the password
38 | if (password_verify($currPassword, $user['password'])) {
39 | // Authentication successful, redirect to dashboard or home page
40 | $_SESSION['user'] = $user;
41 | echo "";
51 | } else {
52 | echo "";
60 | }
61 | } else {
62 | echo "";
70 | }
71 | }
72 | }
73 |
74 | ?>
75 |
76 |
77 |
78 |
79 |
84 |
85 |
86 |
87 |
Email
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
106 |
107 |
108 |
109 |
Password
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | Remember me
127 |
128 |
129 |
134 |
135 |
136 |
137 |
138 |
139 | Sign in
140 |
141 |
Don't have an account? Register here
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
Sign in
151 |
Sign in to your account and explore a world of possibilities. Your journey begins here.
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/project/sign-up.php:
--------------------------------------------------------------------------------
1 | real_escape_string($name);
25 | }
26 |
27 | // validate Email
28 | if (empty($email)) {
29 | $errEmail = "Email is required.";
30 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
31 | $errEmail = "Invalid email format.";
32 | } else {
33 | $currEmail = $conn->real_escape_string($email);
34 | }
35 |
36 | // validate password
37 | if (empty($password)) {
38 | $errPassword = "Password is required.";
39 | } elseif (strlen($password) < 6) {
40 | $errPassword = "Password must be at least 6 characters.";
41 | } else {
42 | $currPassword = $conn->real_escape_string($password);
43 | }
44 |
45 | // If no errors, proceed to register the user
46 | if (isset($currName) && isset($currEmail) && isset($currPassword)) {
47 | // Hash the password before storing
48 | $hashedPassword = password_hash($currPassword, PASSWORD_BCRYPT);
49 |
50 | // Insert user into database
51 | $insertQuery = "INSERT INTO users (`name`, `email`, `password`) VALUES ('$currName', '$currEmail', '$hashedPassword')";
52 | if ($conn->query($insertQuery) === TRUE) {
53 | // Registration successful, redirect to sign-in page
54 | echo "";
64 | } else {
65 | echo "Error: " . $conn->error;
66 | }
67 | }
68 | }
69 | }
70 |
71 | ?>
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
Join Us Today
83 |
84 | Create your free account and unlock access to powerful tools, personalized features, and exclusive content.
85 |
86 | Sign up now and take the first step toward your next big opportunity.
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
Register Now
97 |
98 |
99 |
100 |
101 |
Name
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
113 |
114 |
115 |
116 |
Email
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
135 |
136 |
137 |
138 |
Password
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
149 |
150 |
151 |
157 |
158 |
161 |
162 |
163 |
164 |
165 | Create an account
166 |
167 |
168 | Already have an account? Login here
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/project/shop.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
Filter
8 | Clear all
9 |
10 |
11 |
Brand
12 |
13 |
15 |
16 |
18 |
19 |
20 |
21 |
63 |
64 |
65 |
66 |
67 |
68 |
Size
69 |
70 | XS
71 | S
72 | M
73 | L
74 | XL
75 | XXL
76 | XXXL
77 | 4XL
78 |
79 |
80 |
81 |
82 |
83 |
84 |
Price
85 |
86 |
89 |
114 |
115 |
140 |
141 |
142 | $750
143 | $1000
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/day-19.php:
--------------------------------------------------------------------------------
1 | query($selectStudentsQuery);
13 |
14 | if (isset($_POST['submit'])) {
15 | $name = test_input($_POST['name']);
16 | $gender = test_input($_POST['gender']);
17 | $isMarried = test_input($_POST['isMarried'] ?? null);
18 | $mobile = test_input($_POST['mobile']);
19 |
20 | // validation
21 | if(empty($name)){
22 | $errName = "Name is required ";
23 | }else if(!preg_match("/^[a-zA-Z-'. ]*$/", $name)){
24 | $errName = "Only letters and white space allowed ";
25 | }else{
26 | $currName = $conn->real_escape_string($name);
27 | }
28 |
29 | // Gender enum('Male', 'Female') and required
30 | if(empty($gender)){
31 | $errGender = "Gender is required ";
32 | }else if(!in_array($gender, ['male', 'female'])){
33 | $errGender = "Invalid gender ";
34 | }else{
35 | $currGender = $conn->real_escape_string($gender);
36 | }
37 |
38 | // isMarried tinyint(1) required
39 | if(!isset($isMarried)){
40 | $errIsMarried = "Marital status is required ";
41 | }else if($isMarried !== 'yes' && $isMarried !== 'no'){
42 | $errIsMarried = "Invalid marital status ";
43 | }else{
44 | $currIsMarried = $conn->real_escape_string($isMarried === 'yes' ? 1 : 0);
45 | }
46 |
47 | // mobile varchar(11) required
48 | if(empty($mobile)){
49 | $errMobile = "Mobile number is required ";
50 | }else if(!preg_match("/^[0-9]{11}$/", $mobile)){
51 | $errMobile = "Invalid mobile number ";
52 | }else{
53 | $currMobile = $conn->real_escape_string($mobile);
54 | }
55 |
56 | // If no errors, insert into database
57 | if(isset($currName) && isset($currGender) && isset($currIsMarried) && isset($currMobile)){
58 | $insertQuery = "INSERT INTO `students` (`name`, `gender`, `isMarried`, `mobile`) VALUES ('$currName', '$currGender', $currIsMarried, '$currMobile')";
59 | $insert = $conn->query($insertQuery);
60 | if($insert){
61 | echo "";
62 | }else{
63 | echo "";
64 | }
65 | }else{
66 | echo "";
67 | }
68 | }
69 |
70 | if (isset($_POST['update'])) {
71 | $editId = $_GET['eid'];
72 | $name = test_input($_POST['name']);
73 | $gender = test_input($_POST['gender']);
74 | $isMarried = test_input($_POST['isMarried'] ?? null);
75 | $mobile = test_input($_POST['mobile']);
76 |
77 | // validation
78 | if(empty($name)){
79 | $errName = "Name is required ";
80 | }else if(!preg_match("/^[a-zA-Z-'. ]*$/", $name)){
81 | $errName = "Only letters and white space allowed ";
82 | }else{
83 | $currName = $conn->real_escape_string($name);
84 | }
85 |
86 | // Gender enum('Male', 'Female') and required
87 | if(empty($gender)){
88 | $errGender = "Gender is required ";
89 | }else if(!in_array($gender, ['male', 'female'])){
90 | $errGender = "Invalid gender ";
91 | }else{
92 | $currGender = $conn->real_escape_string($gender);
93 | }
94 |
95 | // isMarried tinyint(1) required
96 | if(!isset($isMarried)){
97 | $errIsMarried = "Marital status is required ";
98 | }else if($isMarried !== 'yes' && $isMarried !== 'no'){
99 | $errIsMarried = "Invalid marital status ";
100 | }else{
101 | $currIsMarried = $conn->real_escape_string($isMarried === 'yes' ? 1 : 0);
102 | }
103 |
104 | // mobile varchar(11) required
105 | if(empty($mobile)){
106 | $errMobile = "Mobile number is required ";
107 | }else if(!preg_match("/^[0-9]{11}$/", $mobile)){
108 | $errMobile = "Invalid mobile number ";
109 | }else{
110 | $currMobile = $conn->real_escape_string($mobile);
111 | }
112 |
113 | // If no errors, update database
114 | if(isset($currName) && isset($currGender) && isset($currIsMarried) && isset($currMobile)){
115 | $updateQuery = "UPDATE `students` SET `name` = '$currName', `gender` = '$currGender', `isMarried` = $currIsMarried, `mobile` = '$currMobile' WHERE `id` = $editId";
116 | $update = $conn->query($updateQuery);
117 | if($update){
118 | echo "";
119 | }else{
120 | echo "";
121 | }
122 | }else{
123 | echo "";
124 | }
125 | }
126 |
127 | if (isset($_GET['did'])) {
128 | $deleteId = $_GET['did'];
129 | $deleteQuery = "DELETE FROM `students` WHERE `id` = $deleteId";
130 | $delete = $conn->query($deleteQuery);
131 | if($delete){
132 | echo "";
133 | }else{
134 | echo "";
135 | }
136 | }
137 | ?>
138 |
139 |
140 |
141 | Add Student
142 |
143 | Name:
144 | = $errName ?? '' ?>
145 |
146 | Gender:
147 |
148 | Select gender
149 | Male
150 | Female
151 |
152 | = $errGender ?? '' ?>
153 |
154 | Is Married:
155 | Yes
156 | No
157 | = $errIsMarried ?? '' ?>
158 |
159 | Mobile:
160 | = $errMobile ?? '' ?>
161 |
162 | Submit
163 |
164 |
165 |
166 | num_rows > 0) {
168 | ?>
169 | Students List
170 |
171 |
172 | S.No
173 | Name
174 | Gender
175 | Marital Status
176 | Mobile
177 | Action
178 |
179 | fetch_assoc()) {
182 | ?>
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 | Edit |
191 | Delete
192 |
193 |
194 |
195 |
196 |
197 | No Students Found
198 |
199 |
200 |
201 | query($editQuery);
206 | if($editResult->num_rows === 1){
207 | $editRow = $editResult->fetch_assoc();
208 | $name = $editRow['name'];
209 | $gender = $editRow['gender'];
210 | $isMarried = $editRow['isMarried'] ? 'yes' : 'no';
211 | $mobile = $editRow['mobile'];
212 | }
213 | ?>
214 |
215 | Edit Student
216 |
217 | Name:
218 | = $errName ?? '' ?>
219 |
220 | Gender:
221 |
222 | Select gender
223 | >Male
224 | >Female
225 |
226 | = $errGender ?? '' ?>
227 |
228 | Is Married:
229 | > Yes
230 | > No
231 | = $errIsMarried ?? '' ?>
232 |
233 | Mobile:
234 | = $errMobile ?? '' ?>
235 |
236 | Update
237 |
238 | Back
239 |
240 |
241 |
--------------------------------------------------------------------------------
/day-7-8-9.php:
--------------------------------------------------------------------------------
1 | Please write your name";
37 | } elseif (!preg_match('/^[A-Za-z-. ]*$/', $name)) {
38 | $errName = "Invalid Name! ";
39 | } else {
40 | $crrName = "Your name is : $name ";
41 | }
42 |
43 | if (empty($email)) {
44 | $errEmail = "Please provide the email address ";
45 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
46 | $errEmail = "Invalid email address! ";
47 | } else {
48 | $crrEmail = "Your email is : $email ";
49 | }
50 |
51 | if (empty($gender)) {
52 | $errGender = "Please select your gender. ";
53 | } elseif (!in_array($gender, $genders)) {
54 | $errGender = "Invalid gender. ";
55 | } else {
56 | $crrGender = "Your gender is : $gender ";
57 | }
58 |
59 | if(empty($skill)){
60 | $errSkill = "Please select your skills. ";
61 | }elseif(count(array_diff($skill, $allSkill)) != 0){
62 | $errSkill = "Paknami bondho korun! ";
63 | }else{
64 | $strSkill = implode(", ", $skill);
65 | $crrSkill = "Your skills are : $strSkill ";
66 | }
67 |
68 | if(empty($cntr)) {
69 | $errCntr = "Please select your country ";
70 | }elseif(!in_array($cntr, $countries)){
71 | $errCntr = "Invalid country ";
72 | }else{
73 | $crrCntr = "Your country is : $cntr ";
74 | }
75 |
76 | if(empty($password)){
77 | $errPassword = "Please provide your password ";
78 | }elseif(!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d\s]).{8,}$/', $password)){
79 | $errPassword = "Please provide at least 1 capital letter, 1 small letter, 1 special character, 1 number asn at least 8 letters in total ";
80 | }else{
81 | $crrPassword = $password;
82 | }
83 |
84 | if(empty($confirmPassword)){
85 | $errConfirmPassword = "Please provide the confirm password ";
86 | }elseif($password != $confirmPassword){
87 | $errConfirmPassword = "Confirm password didn't match with the password ";
88 | }else{
89 | $crrConfirmPassword = $confirmPassword;
90 | }
91 |
92 | if (isset($crrName) && isset($crrEmail) && isset($crrGender) && isset($crrCntr) && isset($crrPassword) && isset($crrConfirmPassword)) {
93 | $name = $email = $gender = $skill = $cntr = $password = $confirmPassword = null;
94 | $successMsg = "
95 | $crrName
96 |
97 | $crrEmail
98 |
99 | $crrGender
100 |
101 | $crrSkill
102 |
103 | $crrCntr
104 |
105 | Password matched with the confirm password.
106 | ";
107 | }
108 | }
109 | ?>
110 |
111 |
112 |
113 | = $errName ?? null; ?>
114 |
115 |
116 | = $errEmail ?? null; ?>
117 |
118 | Gender :
119 |
120 | >Male
121 |
122 |
123 | >Female
124 |
125 |
126 | >Others
127 |
128 | = $errGender ?? null ?>
129 |
130 | Skills :
131 | >HTML
132 | >CSS
133 | >JS
134 | >PHP
135 | >MySQL
136 | = $errSkill ?? null ?>
137 |
138 |
139 | --Select Country--
140 |
141 | >= $country ?>
142 |
143 |
144 | = $errCntr ?? null ?>
145 |
146 |
147 | = $errPassword ?? null ?>
148 |
149 |
150 | = $errConfirmPassword ?? null ?>
151 |
152 |
153 | Show Password
154 |
155 |
156 | Sign up
157 |
158 |
159 |
160 |
175 |
176 | = $successMsg ?? null ?>
--------------------------------------------------------------------------------
/project/admin/all-products.php:
--------------------------------------------------------------------------------
1 | query($selectQuery);
5 |
6 | if(isset($_GET['delete_id'])){
7 | $delete_id = $_GET['delete_id'];
8 | // remove image file
9 | $oldImage = $conn->query("SELECT image FROM products WHERE id=$delete_id")->fetch_object()->image;
10 | if (file_exists('../' . $oldImage)) {
11 | unlink('../' . $oldImage);
12 | }
13 | $deleteQuery = "DELETE FROM products WHERE id=$delete_id";
14 | if ($conn->query($deleteQuery) === TRUE) {
15 | echo "";
20 | } else {
21 | echo "";
24 | }
25 | }
26 |
27 | if(isset($_POST["edit_product"])){
28 | $edit_id = $_POST["edit_id"];
29 | $product_name = validate_data($_POST['product_name']);
30 | $product_price = validate_data($_POST['product_price']);
31 | $product_description = validate_data($_POST['product_description']);
32 |
33 | // if request has no file upload, dont change the image
34 | if(empty($_FILES["product_image"]["name"])) {
35 | $updateQuery = "UPDATE products SET name='$product_name', price='$product_price', description='$product_description' WHERE id=$edit_id";
36 | if ($conn->query($updateQuery) === TRUE) {
37 | echo "";
42 | } else {
43 | echo "";
46 | }
47 | } else {
48 | // Handle file upload
49 | $target_dir = "../uploads/products/";
50 | $target_file = $target_dir . basename($_FILES["product_image"]["name"]);
51 | $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
52 |
53 | // Check if image file is a actual image or fake image
54 | $check = getimagesize($_FILES["product_image"]["tmp_name"]);
55 | if ($check === false) {
56 | echo "";
59 | } else {
60 | // Move uploaded file to target directory
61 | if (move_uploaded_file($_FILES["product_image"]["tmp_name"], $target_file)) {
62 | // remove ../ from the path to store in database
63 | $target_file = str_replace("../", "./", $target_file);
64 | // remove old image file
65 | $oldImage = $conn->query("SELECT image FROM products WHERE id=$edit_id")->fetch_object()->image;
66 | if (file_exists('../' . $oldImage)) {
67 | unlink('../' . $oldImage);
68 | }
69 | $updateQuery = "UPDATE products SET name='$product_name', price='$product_price', image='$target_file', description='$product_description' WHERE id=$edit_id";
70 | if ($conn->query($updateQuery) === TRUE) {
71 | echo "";
76 | } else {
77 | echo "";
80 | }
81 | } else {
82 | echo "";
85 | }
86 | }
87 | }
88 | }
89 | ?>
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
All Products
99 |
100 | num_rows > 0) {
102 | ?>
103 |
104 |
105 |
106 |
107 |
108 | ID
109 | Name
110 | Price
111 | Image
112 | Actions
113 |
114 |
115 |
116 | fetch_object()) { ?>
117 |
118 | id; ?>
119 | name); ?>
120 | price, 2); ?>
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | Edit
130 | Delete
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
No products found.
141 |
142 |
143 |
144 |
145 |
146 |
147 | query($query);
152 | $editRow = $editResult->fetch_object();
153 | ?>
154 |
155 |
156 |
157 |
Edit Product Data
158 |
159 |
160 |
161 |
162 |
163 | Product Name
164 |
166 |
167 |
168 | Product Price
169 |
171 |
172 |
173 |
174 |
175 |
176 | Click to Change Image
177 |
178 |
180 |
181 |
182 | Product Description
183 | = $editRow->description ?>
185 |
186 |
187 |
189 | Update Product
190 |
191 |
192 |
194 | Back
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
220 |
221 |
--------------------------------------------------------------------------------
/project/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
AI Dining
8 |
9 | Experience the future of dining with our AI-powered food ordering platform. Fast, smart, and personalized just for you.
10 |
11 |
25 |
26 |
27 |
28 |
29 |
Quick Links
30 |
38 |
39 |
40 |
41 |
42 |
Customer Service
43 |
51 |
52 |
53 |
54 |
55 |
Contact Us
56 |
57 |
58 |
59 |
60 |
61 |
62 | 123 AI Street, Tech City, TC 12345
63 |
64 |
65 |
66 |
67 |
68 | info@aidining.com
69 |
70 |
71 |
72 |
73 |
74 | +1 (234) 567-890
75 |
76 |
77 |
78 |
79 |
80 | Mon - Sun: 9:00 AM - 11:00 PM
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
We Accept
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | VISA
105 |
106 |
107 |
108 | PayPal
109 |
110 |
111 | Stripe
112 |
113 |
114 |
115 |
116 | AMEX
117 |
118 |
119 |
120 |
121 |
122 |
123 |
Download Our App
124 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 | © = date('Y') ?> AI Dining. All rights reserved. | Powered by Artificial Intelligence
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/project/admin/index.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Welcome back, John
13 |
Streamlined dashboard layout featuring a welcoming header for user
14 | personalization.
15 |
16 |
17 |
18 |
19 |
21 | Export data
22 |
23 |
26 |
27 |
28 |
30 | Create report
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
48 |
51 |
54 |
57 |
60 |
61 |
62 |
63 |
64 |
Heading
65 |
Lorem ipsum dolor sit amet, consectetur.
66 |
67 |
68 |
69 |
70 |
25 GB
71 |
50 GB
72 |
73 |
77 |
78 |
79 |
80 |
81 |
82 |
85 |
88 |
91 |
94 |
97 |
100 |
101 |
102 |
103 |
104 |
Heading
105 |
Lorem ipsum dolor sit amet, consectetur.
106 |
107 |
108 |
109 |
110 |
25 GB
111 |
50 GB
112 |
113 |
117 |
118 |
119 |
120 |
121 |
122 |
125 |
128 |
131 |
134 |
137 |
140 |
141 |
142 |
143 |
144 |
Heading
145 |
Lorem ipsum dolor sit amet, consectetur.
146 |
147 |
148 |
149 |
150 |
25 GB
151 |
50 GB
152 |
153 |
157 |
158 |
159 |
160 |
161 |
162 |
165 |
168 |
171 |
174 |
177 |
180 |
181 |
182 |
183 |
184 |
Heading
185 |
Lorem ipsum dolor sit amet, consectetur.
186 |
187 |
188 |
189 |
190 |
25 GB
191 |
50 GB
192 |
193 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
--------------------------------------------------------------------------------
/project/admin/sidebar.php:
--------------------------------------------------------------------------------
1 |
14 |
15 |
175 |
176 |
--------------------------------------------------------------------------------
/project/components/navbar.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Search
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | Search
32 |
33 |
34 |
35 |
36 |
56 |
64 |
145 |
146 |
147 |
148 |
177 |
178 |
--------------------------------------------------------------------------------
/project/about.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
About AI Dining
7 |
8 | Revolutionizing the way you order food with cutting-edge artificial intelligence technology
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
Our Story
19 |
20 | Founded in 2024, AI Dining emerged from a simple vision: to make food ordering smarter, faster, and more personalized. We recognized that traditional ordering systems were outdated and couldn't keep up with the modern customer's expectations.
21 |
22 |
23 | Our team of food enthusiasts and AI experts came together to create a platform that learns from your preferences, suggests meals tailored to your taste, and delivers an exceptional dining experience every single time.
24 |
25 |
26 | Today, we serve thousands of happy customers daily, powered by advanced machine learning algorithms that make every order feel like it was crafted just for you.
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
50K+
40 |
Happy Customers
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
60 |
Our Mission
61 |
62 | To transform the food ordering experience by leveraging artificial intelligence to deliver personalized, efficient, and delightful dining solutions that exceed customer expectations and support local restaurants.
63 |
64 |
65 |
66 |
67 |
68 |
74 |
Our Vision
75 |
76 | To become the world's leading AI-powered food ordering platform, where every meal is perfectly matched to individual tastes, dietary needs, and lifestyle preferences, creating a seamless bridge between customers and culinary excellence.
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
Our Core Values
88 |
89 | These principles guide everything we do and shape our commitment to excellence
90 |
91 |
92 |
93 |
94 |
95 |
96 |
101 |
Innovation
102 |
103 | Continuously pushing boundaries with AI technology to create better experiences
104 |
105 |
106 |
107 |
108 |
109 |
114 |
Customer First
115 |
116 | Your satisfaction and delight are at the heart of every decision we make
117 |
118 |
119 |
120 |
121 |
122 |
127 |
Quality
128 |
129 | Maintaining the highest standards in food, service, and technology
130 |
131 |
132 |
133 |
134 |
135 |
140 |
Sustainability
141 |
142 | Committed to eco-friendly practices and supporting local communities
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
50K+
155 |
Happy Customers
156 |
157 |
158 |
500+
159 |
Partner Restaurants
160 |
161 |
162 |
1M+
163 |
Orders Delivered
164 |
165 |
166 |
99%
167 |
Satisfaction Rate
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
Meet Our Team
178 |
179 | Passionate experts dedicated to revolutionizing your dining experience
180 |
181 |
182 |
183 |
184 |
185 |
186 |
190 |
Sarah Johnson
191 |
CEO & Founder
192 |
200 |
201 |
202 |
203 |
204 |
208 |
Michael Chen
209 |
CTO
210 |
218 |
219 |
220 |
221 |
222 |
226 |
Emily Davis
227 |
Head of Operations
228 |
236 |
237 |
238 |
239 |
240 |
244 |
David Martinez
245 |
Marketing Director
246 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
Ready to Experience the Future?
263 |
264 | Join thousands of satisfied customers who have already discovered the smarter way to order food
265 |
266 |
274 |
275 |
276 |
277 |
--------------------------------------------------------------------------------