├── hw ├── Assignment 3 │ ├── samim │ │ ├── footer.php │ │ ├── header.php │ │ └── index.php │ ├── shariar.php │ ├── Tiash(L.Y).php │ ├── kabbya.php │ ├── nurul.php │ └── momen.php ├── Assignment 2 │ ├── samim │ │ ├── footer.php │ │ ├── header.php │ │ ├── index.php │ │ └── data.php │ ├── nurul.php │ ├── kabbya.php │ ├── shariar.php │ └── momen.php └── Assignment 1 │ ├── mary.php │ ├── kabbo.php │ ├── shahriar.php │ ├── momen.php │ └── nurul.php ├── l9-connect-db.php ├── authentication ├── db.php ├── footer.php ├── index.php ├── login.php ├── header.php ├── navbar.php ├── l8-form-validation.php └── signup.php ├── l1-variable-echo-comment.php ├── l4-loop.php ├── l10-crud ├── delete.php ├── edit.php └── index.php ├── l2-operaor.php ├── l6-array2.php ├── others └── getUserInfo │ └── index.html ├── l5-array.php ├── l7-date-bf.php ├── l3-condition-function.php └── l8-form-validation.php /hw/Assignment 3/samim/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /hw/Assignment 2/samim/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /l9-connect-db.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /authentication/db.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /authentication/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /hw/Assignment 1/mary.php: -------------------------------------------------------------------------------- 1 | "; 7 | } 8 | $m = $x + $y . "
"; 9 | return "$m"; 10 | } 11 | echo number(16546545, "Dhaka"); 12 | echo number("3", 6); 13 | -------------------------------------------------------------------------------- /hw/Assignment 1/kabbo.php: -------------------------------------------------------------------------------- 1 | "; 8 | } 9 | return $a + $b . "
"; 10 | } 11 | 12 | echo number(2, 2); 13 | echo number(2, "2"); 14 | -------------------------------------------------------------------------------- /l1-variable-echo-comment.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hw/Assignment 1/momen.php: -------------------------------------------------------------------------------- 1 | "; 9 | } else { 10 | 11 | $sum = "Please Enter Number Like (0 - 9)"; 12 | return $sum . "
"; 13 | } 14 | } 15 | 16 | echo sum(1, 9); 17 | echo sum(1, "9"); 18 | -------------------------------------------------------------------------------- /hw/Assignment 3/shariar.php: -------------------------------------------------------------------------------- 1 | "; 17 | echo leap_year(1900); 18 | -------------------------------------------------------------------------------- /authentication/index.php: -------------------------------------------------------------------------------- 1 | 4 |
5 |
6 |
7 |

8 | Please Log-in to see the website! 9 |

10 |
11 |
12 |
13 | 16 | -------------------------------------------------------------------------------- /hw/Assignment 1/nurul.php: -------------------------------------------------------------------------------- 1 | "; 13 | echo Addnumbers ("10days","5days"); 14 | 15 | 16 | ?> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /hw/Assignment 2/samim/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Show all Countries name from array via PHP 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hw/Assignment 3/nurul.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DIPTI - Assignment 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /l4-loop.php: -------------------------------------------------------------------------------- 1 | "; 14 | } 15 | $x++; 16 | } 17 | */ 18 | /** 19 | * limit 1-100 20 | * devided by 7 21 | * remaining 5 22 | */ 23 | 24 | 25 | /* echo 0 . "
"; 26 | echo 1 . "
"; 27 | echo 2 . "
"; 28 | echo 3 . "
"; 29 | echo 4 . "
"; 30 | echo 5 . "
"; 31 | echo 6 . "
"; 32 | echo 7 . "
"; 33 | echo 8 . "
"; 34 | echo 9 . "
"; */ 35 | 36 | $n = 2; 37 | for ($i = 1; $i <= 10; $i++) { 38 | echo $n . " x " . $i . " = " . $n * $i . "
"; 39 | } 40 | -------------------------------------------------------------------------------- /l10-crud/delete.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `students` WHERE `id` = '$id'"); 5 | $isOkay = $check->num_rows == 0 ? header("location: ./"):true; 6 | if($isOkay){ 7 | $delete = $conn->query("DELETE FROM `students` WHERE `id` = '$id'"); 8 | if($delete){ 9 | echo ""; 13 | }else{ 14 | echo ""; 18 | } 19 | } 20 | ?> -------------------------------------------------------------------------------- /l2-operaor.php: -------------------------------------------------------------------------------- 1 | 33 | * <= 34 | * >= 35 | * != 36 | * !== 37 | * <> 38 | */ 39 | 40 | // logical operator 41 | /** 42 | * && 43 | * || 44 | * and 45 | * or 46 | * xor 47 | */ 48 | 49 | $momen = "Web"; 50 | $mostafiz = "Developer"; 51 | // echo $momen." ".$mostafiz; 52 | echo "$momen - $mostafiz"; 53 | ?> -------------------------------------------------------------------------------- /authentication/login.php: -------------------------------------------------------------------------------- 1 | 4 |
5 |
6 |
7 |

Login In

8 |
9 |
10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 |
18 |
19 |
20 | 23 | -------------------------------------------------------------------------------- /l6-array2.php: -------------------------------------------------------------------------------- 1 | "boro station", "cs" => "choto station", "nb" => "nou bondor"]; 4 | echo "

".$chandpur["nb"]."

"; 5 | 6 | foreach($chandpur as $mirpur){ 7 | echo "$mirpur
"; 8 | } 9 | 10 | //multi daimontional array 11 | 12 | $students = [ 13 | ["Momen", "Keranigank", 22], 14 | ["Nurul", "Munshiganj", 21], 15 | ["Shuvo", "Noyakhali", 23] 16 | ]; 17 | 18 | echo "
";
19 |     print_r($students);
20 |     echo "
"; 21 | 22 | echo "
";
23 |     print_r($students[1]);
24 |     echo "
"; 25 | 26 | echo $students[2][1]."
"; 27 | 28 | 29 | for ($i=0; $i < count($students); $i++) { 30 | for ($j=0; $j < count($students[$i]); $j++) { 31 | echo $students[$i][$j]." "; 32 | } 33 | echo "
"; 34 | } 35 | 36 | foreach ($students as $value) { 37 | foreach ($value as $alue) { 38 | echo $alue. " "; 39 | } 40 | echo "
"; 41 | } 42 | ?> 43 | 44 | -------------------------------------------------------------------------------- /others/getUserInfo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /l5-array.php: -------------------------------------------------------------------------------- 1 | "; 18 | var_dump($cities); 19 | echo ""; 20 | 21 | echo "
";
22 |     print_r($cities);
23 |     echo "
"; 24 | 25 | echo "
";
26 |     print_r($alada_array);
27 |     echo "
"; 28 | 29 | echo "
";
30 |     print_r($rkk);
31 |     echo "
"; 32 | 33 | $x = ["Momen", "Mustafiz", "Shariar", "Nurul", "Mery"]; 34 | 35 | for ($i=0; $i < count($x); $i++) { 36 | echo "$x[$i]
"; 37 | } 38 | 39 | foreach ($x as $key => $val) { 40 | echo ($key+1).": ".$val."
"; 41 | } 42 | 43 | 44 | //associative array 45 | $elaka = ["prothom" => "Kalabagan", "ditiyo" => "Kathal Bagan"]; 46 | echo "
";
47 |     print_r($elaka);
48 |     echo "
"; 49 | 50 | echo $elaka["ditiyo"] 51 | //multidimontional array 52 | 53 | ?> -------------------------------------------------------------------------------- /l10-crud/edit.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `students` WHERE `id` = '$id'"); 5 | $check->num_rows == 0 ? header("location: ./"):true; 6 | $row = $check->fetch_assoc(); 7 | if (isset($_POST["upStu"])) { 8 | $name = $_POST["name"]; 9 | $city = $_POST["city"]; 10 | $gender = $_POST["gender"]; 11 | $update = $conn->query("UPDATE `students` SET `name`='$name',`city`='$city',`gender`='$gender' WHERE `id` = '$id'"); 12 | if($update){ 13 | echo ""; 14 | }else{ 15 | echo ""; 16 | } 17 | } 18 | ?> 19 | 20 |

Update Student

21 |
22 | 23 |

24 | 25 |

26 | >Male 27 | >Female 28 |

29 | 30 |
31 | Back -------------------------------------------------------------------------------- /hw/Assignment 3/samim/index.php: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 |
9 |

Enter a year for leap year checking...

10 |
11 |
12 | 13 |
14 | 15 |
16 | 17 | 24 | Swal.fire({ 25 | icon: "'.$type.'", 26 | title: "'.$title.'", 27 | text: "'.$text.'", 28 | position: "center", 29 | showConfirmButton: false, 30 | timer: 3000 31 | }); 32 | '; 33 | } 34 | if(!empty($year)) { 35 | if(($year % 4 == 0 && $year % 100 != 0) || ($year % 400 == 0)) { 36 | showAlert("success","Yesssss!","This is a leap year."); 37 | }else { 38 | showAlert("info","Opppsss!","This is not a leap year."); 39 | } 40 | }else { 41 | showAlert("error","Error!","You must enter a valid year."); 42 | } 43 | } 44 | 45 | ?> 46 | 47 |
48 |
49 | 50 | -------------------------------------------------------------------------------- /hw/Assignment 2/samim/index.php: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 |
9 | 10 |

Pick your favourite country from down below...

11 |
12 | 33 |
34 | 35 |

36 | 37 | 38 |
39 |
40 | 41 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /l10-crud/index.php: -------------------------------------------------------------------------------- 1 | query("INSERT INTO `students`(`name`, `city`, `gender`) VALUES ('$name', '$city', '$gender')"); 9 | if($insert){ 10 | echo ""; 11 | }else{ 12 | echo ""; 13 | } 14 | } 15 | 16 | $select = $conn->query("SELECT * FROM `students`"); 17 | ?> 18 | 19 |

Add Student

20 |
21 | 22 |

23 | 24 |

25 | Male 26 | Female 27 |

28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | fetch_assoc()){ ?> 40 | 41 | 42 | 43 | 44 | 45 | 50 | 51 | 52 |
IDNameGenderCityAction
46 | ">Edit 47 | " onclick="return confirm('Are you sure?')">Delete 48 | 49 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /l7-date-bf.php: -------------------------------------------------------------------------------- 1 | "; 4 | echo date("d/M/Y H:i:s A l") . "
"; 5 | echo date("d/F/Y H:i:s A l") . "
"; 6 | 7 | //mktime(hour, minute, second, month, day, year) 8 | 9 | $bday = mktime(0, 0, 0, 3, 26, 2024); 10 | echo date("d/M/Y l", $bday) . "
"; 11 | 12 | //strtotime 13 | $today = strtotime("+10 years +5 months +10 days"); 14 | echo date("d/M/Y l", $today) . "
"; 15 | 16 | $nextFriday = strtotime("next friday"); 17 | $endDate = strtotime("+6 weeks", $nextFriday); 18 | while ($nextFriday <= $endDate) { 19 | echo date("d/M/Y l", $nextFriday) . "
"; 20 | $nextFriday = strtotime("+1 week", $nextFriday); 21 | } 22 | 23 | $str = "The quick brown fox jumps over the lazy dog"; 24 | echo strlen($str) . "
"; 25 | echo str_word_count($str) . "
"; 26 | echo strrev($str) . "
"; 27 | echo strpos($str, "fox") . "
"; 28 | echo str_replace("fox", "cat", $str) . "
"; 29 | echo str_repeat($str, 5) . "
"; 30 | echo strtoupper($str) . "
"; 31 | echo strtolower($str) . "
"; 32 | echo ucfirst($str) . "
"; 33 | echo ucwords($str) . "
"; 34 | 35 | //explode 36 | $fruits = "mango banana apple orange pineapple"; 37 | $fruitList = explode(" ", $fruits); 38 | echo "
";
39 | print_r($fruitList);
40 | echo "
"; 41 | 42 | //implode 43 | $fruitList = ["mango", "banana", "apple", "orange", "pineapple"]; 44 | $fruits = implode(" ", $fruitList); 45 | echo $fruits . "
"; 46 | 47 | // $_GET[] 48 | /* echo $_GET["city"] . "
"; 49 | echo $_GET["gender"] . "
"; */ 50 | 51 | // $_SERVER 52 | echo $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"] . "
"; 53 | 54 | ?> 55 | 56 | "> 57 | 58 | 59 | "> 60 | 61 | 62 |

63 | -------------------------------------------------------------------------------- /authentication/header.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Bootstrap demo 11 | 12 | 13 | 14 | 15 | 16 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /hw/Assignment 2/samim/data.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /l3-condition-function.php: -------------------------------------------------------------------------------- 1 | 30) { 4 | echo "Joy Bangla"; 5 | } elseif ($age > 10) { 6 | echo "Amar Bangladesh"; 7 | } elseif ($age != 5) { 8 | echo "Amader Bangladesh"; 9 | } else { 10 | echo "Dhaka"; 11 | } 12 | 13 | /** 14 | * age <= 12 you are a baby 15 | * age <= 19 you are a teenager 16 | * age <= 29 you are a young person 17 | * age <= 49 you are a middle aged person 18 | * age > 50 && age < 150 you are an old person 19 | * else you are not on this world 20 | */ 21 | echo "
"; 22 | $city = "Noyakhali"; 23 | 24 | switch ($city) { 25 | case 'Noyakhali': 26 | echo "Noakhali bivag chai"; 27 | break; 28 | 29 | case 'Barishal': 30 | echo "Barishale one nodi ase"; 31 | break; 32 | 33 | case 'Dhaka': 34 | echo "Dhaka is the cpital of Bangladesh"; 35 | break; 36 | 37 | default: 38 | echo "Please input valid city"; 39 | break; 40 | } 41 | 42 | echo "
"; 43 | 44 | $sub = "Java"; 45 | /* if($sub === "PHP"){ 46 | echo "We are php developer"; 47 | }else{ 48 | echo "We are not a php developer"; 49 | } */ 50 | echo $sub === "PHP" ? "We are php developer" : ($sub === "JavaScript" ? "We are JS developer" : "We are not a developer"); 51 | 52 | /* 53 | 54 | condition ? true:false 55 | 56 | */ 57 | 58 | /** 59 | * $name = ""; 60 | * $name == "Asif" 61 | */ 62 | echo "
"; 63 | 64 | function person($fname = "Sakib", $lname = "Khan") 65 | { 66 | return "$fname $lname"; 67 | } 68 | 69 | echo person("Momen", "Uddin") . "
"; 70 | echo person("Mostafizur", "Rahman") . "
"; 71 | echo person() . "
"; 72 | echo person("Bubly") . "
"; 73 | echo person(lname: "All Hasan") . "
"; 74 | 75 | /** 76 | * make a function 77 | * function takes two perameter 78 | * function will validate that the values of all perameters are integer 79 | * function will return a error message if the values are not number 80 | * if all the values are number, function will return the sum of those number 81 | */ 82 | 83 | function number($x, $y) 84 | { 85 | if (!is_int($x) || !is_int($y)) { 86 | return "Invalid number probvided
"; 87 | } 88 | $m = $x + $y . "
"; 89 | return "$m"; 90 | } 91 | 92 | 93 | // recursive function 94 | function factorial($n) 95 | { 96 | if ($n <= 1) { 97 | return 1; 98 | } 99 | return $n * factorial($n - 1); 100 | } 101 | echo factorial(5); 102 | -------------------------------------------------------------------------------- /authentication/navbar.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /hw/Assignment 2/nurul.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |

This is Country List

7 | 17 |
-------------------------------------------------------------------------------- /hw/Assignment 3/momen.php: -------------------------------------------------------------------------------- 1 | 0) { 15 | 16 | $year = (int) $_POST['number']; 17 | 18 | $leapYear = (isLeapYear($year)) ? "$year is a leap year." : "$year is not a leap year."; 19 | 20 | } else { 21 | $leapYear = ""; 22 | } 23 | 24 | 25 | 26 | 27 | ?> 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | Leap Year Calculation 38 | 39 | 67 | 68 | 69 | 70 | 71 | 72 |
73 | 74 |
75 | 76 |
77 |

Leap Year Calculation

78 |
79 |
80 |
81 | 82 |
83 | 84 |
85 |

86 |
87 | 88 |
89 | 90 |
91 |
92 | 93 | 94 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /hw/Assignment 2/kabbya.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Kabbya-HW-2 11 | 12 | 13 |
14 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /hw/Assignment 2/shariar.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Country 12 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

All Country List

21 | 29 |
30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /hw/Assignment 2/momen.php: -------------------------------------------------------------------------------- 1 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 212 | 213 | HTML Form 214 | 215 | 228 | 229 | 230 | 231 | 232 | 233 |
234 | 235 |
236 | 237 |
238 | 239 |
240 | 241 | 252 | 253 |
254 | 255 |
256 |
257 |
258 | 259 | 260 | 263 | 264 | 265 | 266 | -------------------------------------------------------------------------------- /l8-form-validation.php: -------------------------------------------------------------------------------- 1 | null, "CSS" => null, "JS" => null, "PHP" => null, "MySQL" => null]; 8 | function safuda($data) 9 | { 10 | $data = htmlspecialchars($data); 11 | $data = trim($data); 12 | $data = stripslashes($data); 13 | return $data; 14 | } 15 | 16 | if (isset($_POST["sub123"])) { 17 | $name = safuda($_POST["name"]); 18 | $email = safuda($_POST["email"]); 19 | $gender = safuda($_POST["gender"] ?? null); 20 | $skills = $_POST["skills"] ?? null; 21 | $city = safuda($_POST["city"]) ?? null; 22 | 23 | if (empty($name)) { 24 | $errName = "Name is required"; 25 | } elseif (!preg_match("/^[A-Za-z. ]*$/", $name)) { 26 | $errName = "Invalid name format"; 27 | } else { 28 | $crrName = $name; 29 | } 30 | 31 | if (empty($email)) { 32 | $errEmail = "Email is required"; 33 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 34 | $errEmail = "Invalid email format"; 35 | } else { 36 | $crrEmail = $email; 37 | } 38 | 39 | if (empty($gender)) { 40 | $errGender = "Please select your gender"; 41 | } elseif (!in_array($gender, $genders)) { 42 | $errGender = "Paknami bondho korun!"; 43 | } else { 44 | $crrGender = $gender; 45 | } 46 | 47 | if (empty($skills)) { 48 | $errSkills = "Please select your skills"; 49 | } else { 50 | $crrSkills = $skills; 51 | foreach ($skills as $skill) { 52 | $allSkills[$skill] = "checked"; 53 | } 54 | } 55 | 56 | if (empty($city)) { 57 | $errCity = "Please select your city"; 58 | } elseif (!in_array($city, $cities)) { 59 | $errCity = "Paknami bondho korun!"; 60 | } else { 61 | $crrCity = $city; 62 | } 63 | } 64 | 65 | 66 | 67 | ?> 68 | 69 | 70 | 71 | 72 | 73 | 74 | Document 75 | 76 | 77 | 78 | 79 | 80 |
81 |
82 |
83 |
84 |

Registration Form

85 |
86 | 87 | 88 |
89 | 90 |
91 |
92 | 93 |
94 |
95 |
96 | 97 | 98 |
99 | 100 |
101 |
102 | 103 |
104 |
105 |
106 |
107 | 110 |
111 |
112 |
113 | 116 |
117 |
118 | 121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 | 132 |
133 |
134 |
135 | 138 |
139 |
140 | 143 |
144 |
145 | 148 |
149 |
150 | 153 |
154 |
155 | 158 |
159 |
160 |
161 | 162 |
163 |
164 |
165 | 171 |
172 | 173 |
174 |
175 |
176 | 177 | 178 |
179 |
180 | 181 | 182 |
183 |
184 | 185 |
186 |
187 |
188 |
189 |
190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /authentication/l8-form-validation.php: -------------------------------------------------------------------------------- 1 | null, "CSS" => null, "JS" => null, "PHP" => null, "MySQL" => null]; 8 | function safuda($data) 9 | { 10 | $data = htmlspecialchars($data); 11 | $data = trim($data); 12 | $data = stripslashes($data); 13 | return $data; 14 | } 15 | 16 | if (isset($_POST["sub123"])) { 17 | $name = safuda($_POST["name"]); 18 | $email = safuda($_POST["email"]); 19 | $gender = safuda($_POST["gender"] ?? null); 20 | $skills = $_POST["skills"] ?? null; 21 | $city = safuda($_POST["city"]) ?? null; 22 | 23 | if (empty($name)) { 24 | $errName = "Name is required"; 25 | } elseif (!preg_match("/^[A-Za-z. ]*$/", $name)) { 26 | $errName = "Invalid name format"; 27 | } else { 28 | $crrName = $name; 29 | } 30 | 31 | if (empty($email)) { 32 | $errEmail = "Email is required"; 33 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 34 | $errEmail = "Invalid email format"; 35 | } else { 36 | $crrEmail = $email; 37 | } 38 | 39 | if (empty($gender)) { 40 | $errGender = "Please select your gender"; 41 | } elseif (!in_array($gender, $genders)) { 42 | $errGender = "Paknami bondho korun!"; 43 | } else { 44 | $crrGender = $gender; 45 | } 46 | 47 | if (empty($skills)) { 48 | $errSkills = "Please select your skills"; 49 | } else { 50 | $crrSkills = $skills; 51 | foreach ($skills as $skill) { 52 | $allSkills[$skill] = "checked"; 53 | } 54 | } 55 | 56 | if (empty($city)) { 57 | $errCity = "Please select your city"; 58 | } elseif (!in_array($city, $cities)) { 59 | $errCity = "Paknami bondho korun!"; 60 | } else { 61 | $crrCity = $city; 62 | } 63 | } 64 | 65 | 66 | 67 | ?> 68 | 69 | 70 | 71 | 72 | 73 | 74 | Document 75 | 76 | 77 | 78 | 79 | 80 |
81 |
82 |
83 |
84 |

Registration Form

85 |
86 | 87 | 88 |
89 | 90 |
91 |
92 | 93 |
94 |
95 |
96 | 97 | 98 |
99 | 100 |
101 |
102 | 103 |
104 |
105 |
106 |
107 | 110 |
111 |
112 |
113 | 116 |
117 |
118 | 121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 | 132 |
133 |
134 |
135 | 138 |
139 |
140 | 143 |
144 |
145 | 148 |
149 |
150 | 153 |
154 |
155 | 158 |
159 |
160 |
161 | 162 |
163 |
164 |
165 | 171 |
172 | 173 |
174 |
175 |
176 | 177 | 178 |
179 |
180 | 181 | 182 |
183 |
184 | 185 |
186 |
187 |
188 |
189 |
190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /authentication/signup.php: -------------------------------------------------------------------------------- 1 | null, "CSS" => null, "JS" => null, "PHP" => null, "MySQL" => null]; 9 | function safuda($data) 10 | { 11 | $data = htmlspecialchars($data); 12 | $data = trim($data); 13 | $data = stripslashes($data); 14 | return $data; 15 | } 16 | 17 | if (isset($_POST["sub123"])) { 18 | $name = safuda($_POST["name"]); 19 | $email = safuda($_POST["email"]); 20 | $gender = safuda($_POST["gender"] ?? null); 21 | $skills = $_POST["skills"] ?? null; 22 | $city = safuda($_POST["city"]) ?? null; 23 | $password = safuda($_POST["pass"]); 24 | $confirmPassword = safuda($_POST["cpass"]); 25 | 26 | if (empty($name)) { 27 | $errName = "Name is required"; 28 | } elseif (!preg_match("/^[A-Za-z. ]*$/", $name)) { 29 | $errName = "Invalid name format"; 30 | } else { 31 | $crrName = $conn->real_escape_string($name); 32 | } 33 | 34 | if (empty($email)) { 35 | $errEmail = "Email is required"; 36 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 37 | $errEmail = "Invalid email format"; 38 | } else { 39 | $checkEmail = "SELECT * FROM `users` WHERE `email` = '$email'"; 40 | $check = $conn->query($checkEmail); 41 | if ($check->num_rows > 0) { 42 | $errEmail = "Email already exists"; 43 | }else{ 44 | $crrEmail = $conn->real_escape_string($email); 45 | } 46 | } 47 | 48 | if (empty($gender)) { 49 | $errGender = "Please select your gender"; 50 | } elseif (!in_array($gender, $genders)) { 51 | $errGender = "Paknami bondho korun!"; 52 | } else { 53 | $crrGender = $conn->real_escape_string($gender); 54 | } 55 | 56 | if (empty($skills)) { 57 | $errSkills = "Please select your skills"; 58 | } else { 59 | $crrSkills = $skills; 60 | foreach ($skills as $skill) { 61 | $allSkills[$skill] = "checked"; 62 | } 63 | $crrSkills = implode(", ", $crrSkills); 64 | $crrSkills = $conn->real_escape_string($crrSkills); 65 | } 66 | 67 | if (empty($city)) { 68 | $errCity = "Please select your city"; 69 | } elseif (!in_array($city, $cities)) { 70 | $errCity = "Paknami bondho korun!"; 71 | } else { 72 | $crrCity = $conn->real_escape_string($city); 73 | } 74 | 75 | if (empty($password)) { 76 | $errPassword = "Password is required"; 77 | } elseif (strlen($password) < 8) { 78 | $errPassword = "Password must be at least 8 characters long"; 79 | } elseif ($password !== $confirmPassword) { 80 | $errPassword = "Passwords do not match"; 81 | } else { 82 | $hashedPassword = password_hash($password, PASSWORD_DEFAULT); 83 | $crrPassword = $conn->real_escape_string($hashedPassword); 84 | } 85 | 86 | if (isset($crrName) && isset($crrEmail) && isset($crrGender) && isset($crrSkills) && isset($crrCity) && isset($crrPassword)) { 87 | $insert_query = "INSERT INTO `users`( `name`, `email`, `gender`, `skills`, `pass`) VALUES ('$crrName','$crrEmail','$crrGender','$crrSkills','$crrPassword')"; 88 | $insert = $conn->query($insert_query); 89 | if ($insert) { 90 | // toastr succes alert 91 | echo ""; 92 | } else { 93 | echo ""; 94 | } 95 | } 96 | 97 | } 98 | ?> 99 |
100 |
101 |
102 |
103 |

Registration Form

104 |
105 | 106 | 107 |
108 | 109 |
110 |
111 | 112 |
113 |
114 |
115 | 116 | 117 |
118 | 119 |
120 |
121 | 122 |
123 |
124 |
125 |
126 | 129 |
130 |
131 |
132 | 135 |
136 |
137 | 140 |
141 |
142 |
143 | 144 |
145 |
146 |
147 |
148 | 151 |
152 |
153 |
154 | 157 |
158 |
159 | 162 |
163 |
164 | 167 |
168 |
169 | 172 |
173 |
174 | 177 |
178 |
179 |
180 | 181 |
182 |
183 |
184 | 190 |
191 | 192 |
193 |
194 |
195 | 196 | 197 |
198 | 199 |
200 |
201 | 202 |
203 | 204 | 205 |
206 |
207 | 208 |
209 |
210 |
211 |
212 |
213 | --------------------------------------------------------------------------------