├── l13-form-validation-2.php ├── l1-echo.php ├── l3-variable.php ├── crud ├── logout.php ├── index.php ├── footer.php ├── .htaccess ├── nav.php ├── header.php ├── signin.php ├── updateProfile.php ├── changePass.php └── signup.php ├── namespace ├── person2.php ├── person1.php └── personDetails.php ├── l6-condition.php ├── l2-comments.php ├── crud2 ├── delete.php ├── index.php ├── allStudent.php └── updatestudent.php ├── l4-dataType.php ├── l7-loop.php ├── l11-date.php ├── l15-oop2.php ├── l14-oop.php ├── l16-oop3.php ├── l5-operators.php ├── l10-pre-define-functions.php ├── l9-array.php ├── hw └── form validation.php ├── quries.txt ├── l8-function.php └── l12-form-validation.php /l13-form-validation-2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /l1-echo.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /namespace/person2.php: -------------------------------------------------------------------------------- 1 | 20) { 5 | echo "Amar Bangladesh"; 6 | } else { 7 | echo "Joy Bangla"; 8 | } 9 | -------------------------------------------------------------------------------- /namespace/person1.php: -------------------------------------------------------------------------------- 1 | name; 7 | $obj2 = new Shefa\personDetails; 8 | echo $obj2->name; 9 | -------------------------------------------------------------------------------- /l2-comments.php: -------------------------------------------------------------------------------- 1 | query("DELETE FROM users WHERE id = $id"); 5 | if ($delete) { 6 | echo "Data deleted successfulli"; 7 | } 8 | ?> 9 | -------------------------------------------------------------------------------- /crud/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /crud/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteBase / 3 | 4 | # To externally redirect /dir/foo.php to /dir/foo 5 | RewriteCond %{REQUEST_METHOD} !POST 6 | RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] 7 | RewriteRule ^ %1 [R=302,L,NE] 8 | 9 | ## To internally redirect /dir/foo to /dir/foo.php 10 | RewriteCond %{REQUEST_FILENAME}.php -f [NC] 11 | RewriteRule ^ %{REQUEST_URI}.php [L] 12 | -------------------------------------------------------------------------------- /l4-dataType.php: -------------------------------------------------------------------------------- 1 | "; 16 | var_dump(123); 17 | echo "
"; 18 | var_dump(123.45); 19 | echo "
"; 20 | var_dump(null); 21 | echo "
"; 22 | var_dump(true); 23 | echo "
"; 24 | var_dump(["Dhaka", "Rajshahi", "Khulna"]); 25 | echo "
"; 26 | 27 | class nadim 28 | { 29 | public $city = "Narshindi"; 30 | } 31 | 32 | $obj = new nadim; 33 | var_dump($obj); 34 | -------------------------------------------------------------------------------- /l7-loop.php: -------------------------------------------------------------------------------- 1 | "; 23 | 24 | /** 25 | * for loop 26 | * starting point, ending point, gap 27 | */ 28 | 29 | for ($i = 0; $i < 10; $i++) { 30 | echo $i; 31 | } 32 | echo "
"; 33 | /** 34 | * do while 35 | */ 36 | 37 | $x = 20; 38 | do { 39 | echo $x++; 40 | } while ($x < 10); 41 | 42 | /** 43 | * task 44 | * print all the even number from 1 to 20 by using for loop and if condition 45 | */ 46 | -------------------------------------------------------------------------------- /l11-date.php: -------------------------------------------------------------------------------- 1 | "; 4 | echo date("M-d-Y D H:i:s A") . "
"; 5 | echo date("F/d/Y l") . "
"; 6 | 7 | // mktime h m s m d y 8 | $myTime = mktime(0, 0, 0, 4, 2, 2004); 9 | echo date("F/d/Y l", $myTime) . "
"; 10 | 11 | //strtotime 12 | $s2t1 = strtotime("next friday"); 13 | echo date("F/d/Y l", $s2t1) . "
"; 14 | 15 | $s2t2 = strtotime("+3 years +2 month + 17 days"); 16 | echo date("F/d/Y l", $s2t2) . "
"; 17 | 18 | $startDate = strtotime("next friday"); 19 | $endDate = strtotime("+6 weeks", $startDate); 20 | while ($startDate <= $endDate) { 21 | echo date("F/d/Y l", $startDate) . "
"; 22 | $startDate = strtotime("+1 week", $startDate); 23 | } 24 | -------------------------------------------------------------------------------- /l15-oop2.php: -------------------------------------------------------------------------------- 1 | aws(); */ 27 | echo dipti::$uName . "
" . dipti::aws(); 28 | -------------------------------------------------------------------------------- /crud2/index.php: -------------------------------------------------------------------------------- 1 | query("INSERT INTO `users` (`name`) VALUES ('$sname')"); 7 | if (!$insert) { 8 | echo "Something went wrong"; 9 | } else { 10 | echo "Student added successfully"; 11 | } 12 | } 13 | } 14 | ?> 15 | 16 | 17 | 18 | 19 | 20 | 21 | Document 22 | 23 | 24 | 25 |
26 | 27 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /l14-oop.php: -------------------------------------------------------------------------------- 1 | myName . " is " . $this->myWives; 17 | } 18 | } 19 | 20 | $myObj = new myClass; 21 | echo $myObj->myName . "
"; 22 | echo $myObj->mainSkill() . "
"; 23 | // echo $myObj->myWives . "
"; 24 | echo $myObj->totalWife() . "
"; 25 | 26 | class myChield extends myClass 27 | { 28 | public function myChieldFunc() 29 | { 30 | return "My father name is " . $this->myName; 31 | } 32 | } 33 | 34 | $myChieldObj = new myChield; 35 | echo $myChieldObj->myChieldFunc(); 36 | 37 | // make a private propertin on the main class 38 | // call it through the object 39 | // use it on any internal function 40 | // use it on a chiled class 41 | -------------------------------------------------------------------------------- /crud2/allStudent.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM users"); 4 | ?> 5 | 6 | 7 | 8 | 9 | 10 | 11 | Document 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | fetch_object()) { ?> 22 | 23 | 24 | 25 | 29 | 30 | 31 |
IDNameAction
id ?>name ?> 26 | Update 27 | Delete 28 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /l16-oop3.php: -------------------------------------------------------------------------------- 1 | revMsg() . "
"; 29 | } 30 | } 31 | 32 | class samsungMobile extends mobile 33 | { 34 | use breakTrait; 35 | } 36 | 37 | $samObj = new samsungMobile("Samsung", "is a best android mobile"); 38 | echo $samObj->mobileRev(); 39 | 40 | class iPhone extends mobile 41 | { 42 | use breakTrait; 43 | } 44 | 45 | $objIphone = new iPhone("iPhone", "is the best mobile"); 46 | echo $objIphone->mobileRev(); 47 | -------------------------------------------------------------------------------- /l5-operators.php: -------------------------------------------------------------------------------- 1 | 31 | * <= 32 | * >= 33 | * <> 34 | * <=> 35 | */ 36 | 37 | /** 38 | * Increment/Decrement operators 39 | * ++ 40 | * -- 41 | */ 42 | 43 | /** 44 | * Logical operators 45 | * && 46 | * || 47 | * and 48 | * or 49 | * xor 50 | * ! 51 | */ 52 | 53 | /** 54 | * String Operators 55 | * . 56 | * .= 57 | */ 58 | 59 | /** 60 | * Array Operators 61 | * + 62 | * == 63 | * === 64 | * != 65 | * <> 66 | * !== 67 | */ 68 | 69 | /** 70 | * Conditional Assignment Operators 71 | * ?: 72 | * ?? 73 | */ 74 | 75 | 76 | $x = 15; 77 | /* if ($x < 20) { 78 | echo "Halum"; 79 | } else { 80 | echo "Hulum"; 81 | } */ 82 | 83 | echo ($x < 20) ? "Halum" : "Hulum"; 84 | // $y = 123; 85 | echo $y ?? "
Joy Bangla"; 86 | -------------------------------------------------------------------------------- /l10-pre-define-functions.php: -------------------------------------------------------------------------------- 1 | "; 5 | echo strrev($str) . "
"; 6 | echo strpos($str, "demo") . "
"; 7 | echo str_word_count($str) . "
"; 8 | echo substr($str, 0, 4) . "
"; 9 | echo substr($str, -9, 4) . "
"; 10 | echo str_replace("demo", "dangerous", $str) . "
"; 11 | 12 | $pName = "abdulla nadim"; 13 | echo ucfirst($pName) . "
"; 14 | echo strtoupper($pName) . "
"; 15 | echo ucwords($pName) . "
"; 16 | 17 | echo "
";
18 | print_r(explode(" ", $pName));
19 | echo "
"; 20 | 21 | $arr = ["Nadim", "is", "not", "a", "bad", "boy."]; 22 | echo implode(" ", $arr) . "
"; 23 | 24 | if (is_string("Dhaka")) { 25 | echo "Joy Bangla
"; 26 | } else { 27 | echo "Amar Bangladesh
"; 28 | } 29 | 30 | echo is_int(123) . "
"; 31 | 32 | /** 33 | * $sentence = "We live in Bangladesh"; 34 | * show it on php like this 35 | * We 36 | * Live 37 | * In 38 | * Bangladesh 39 | * explode -> loop -> ucfirst -> "
" 40 | */ 41 | 42 | $sentence = "We live in Bangladesh"; 43 | $sArr = explode(" ", $sentence); 44 | for ($i = 0; $i < count($sArr); $i++) { 45 | echo ucfirst($sArr[$i]) . "
"; 46 | } 47 | -------------------------------------------------------------------------------- /crud2/updatestudent.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM users WHERE id = $id"); 5 | $preData->num_rows != 1 && header("location: ./index.php"); 6 | $pd = $preData->fetch_object(); 7 | if (isset($_POST['upStudent'])) { 8 | $sname = $_POST['sname']; 9 | if (!empty($sname)) { 10 | $update = $conn->query("UPDATE users SET name = '$sname' WHERE id = $id"); 11 | if (!$update) { 12 | echo "Something went wrong"; 13 | } else { 14 | echo "Student updated successfully"; 15 | } 16 | } 17 | } 18 | ?> 19 | 20 | 21 | 22 | 23 | 24 | 25 | Document 26 | 27 | 28 | 29 |
30 | 31 | 32 |
33 |

34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /l9-array.php: -------------------------------------------------------------------------------- 1 | "; 11 | print_r($persons); 12 | echo ""; 13 | 14 | echo $persons[0].", ".$persons[1].", ".$persons[2]; 15 | 16 | echo "
"; 17 | 18 | for ($i=0; $i < count($persons); $i++) { 19 | if($i < (count($persons) - 1)){ 20 | $coma = ", "; 21 | }else{ 22 | $coma = "."; 23 | } 24 | echo $persons[$i].$coma; 25 | } 26 | echo "
"; 27 | //associative array 28 | $abdullah = ["name" => "Abdulla Al Nadim", "age" => 20, "city" => "Narshindi"]; 29 | print_r($abdullah); 30 | echo "
";
31 |     print_r($abdullah);
32 |     echo "
"; 33 | echo $abdullah["name"]; 34 | echo "
"; 35 | 36 | foreach($abdullah as $key => $val){ 37 | echo ucfirst($key).": ".$val."
"; 38 | } 39 | 40 | 41 | // multidimontionl array 42 | 43 | $myStudents = [ 44 | ["Kamla", "Dhaka", 20], 45 | ["Jamal", "Khulna", 30], 46 | ["Tomal", "Bogura", 40] 47 | ]; 48 | echo "
";
49 |     print_r($myStudents);
50 |     echo "
"; 51 | 52 | echo $myStudents[2][1]; 53 | ?> -------------------------------------------------------------------------------- /hw/form validation.php: -------------------------------------------------------------------------------- 1 | Please Write Your Name "; 11 | } elseif (!preg_match("/^[A-Za-z. ]*$/", $yname)) { 12 | $errname = "Invalid name format"; 13 | } else { 14 | $crrname = $yname; 15 | } 16 | if (empty($ymail)) { 17 | $erremail = "Please Write Your Email "; 18 | } elseif (!filter_var($ymail, FILTER_VALIDATE_EMAIL)) { 19 | $erremail = "Invalid Email Adress"; 20 | } else { 21 | $crremail = $ymail; 22 | } 23 | if (empty($ygndr)) { 24 | $errgndr = "Please Select Your Gender "; 25 | } else { 26 | $crrgndr = $ygndr; 27 | } 28 | } 29 | 30 | ?> 31 | 32 |
33 | 34 |

35 | 36 |

37 | Gender : 38 | Male 39 | Female 40 | Other 41 | 42 |

43 | 44 |
-------------------------------------------------------------------------------- /quries.txt: -------------------------------------------------------------------------------- 1 | database 2 | create 3 | read 4 | update 5 | Delete 6 | 7 | table 8 | create 9 | read 10 | update 11 | Delete 12 | 13 | column 14 | create 15 | read 16 | update 17 | Delete 18 | 19 | SELECT * FROM `users` 20 | SELECT `user name` FROM `users`; 21 | SELECT `user name`, `gender` FROM `users`; 22 | SELECT `users`.`user name`, `users`.`gender` FROM `users`; 23 | SELECT `users`.`user name` AS `Person Name`, `users`.`gender` AS `Person Gender` FROM `users`; 24 | SELECT `users`.`user name` AS `Person Name`, `users`.`gender` AS `Person Gender` FROM `users` WHERE `users`.`id` = 1; 25 | INSERT INTO `users`(`user name`, `address`, `gender`) VALUES ('Asif Abir', 'Dhaka', 'Male') 26 | UPDATE `users` SET `role`='admin' WHERE `id` = 3 27 | DELETE FROM `users` WHERE `id` = 3 28 | 29 | CREATE TABLE `access` ( 30 | `id` int(11) PRIMARY KEY AUTO_INCREMENT, 31 | `name` char(100), 32 | `user_id` int(11), 33 | `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 34 | FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) 35 | ) 36 | 37 | INSERT INTO `access`(`access_name`, `user_id`) VALUES 38 | ('User List', 1), 39 | ('User List', 2), 40 | ('Change Password', 1), 41 | ('Change Password', 2), 42 | ('Change Password', 4) 43 | 44 | ALTER TABLE `access` CHANGE `name` `access_name` CHAR(100) 45 | ALTER TABLE `access` ADD `testings` VARCHAR(100) AFTER `user_id` 46 | ALTER TABLE `access` DROP COLUMN `testings` 47 | 48 | SELECT `users`.`user name` AS `Name`, `users`.`address` AS `Area`, 49 | `users`.`gender` AS `Gender`, `users`.`role` AS `Power`, 50 | `access`.`access_name` AS `Access Area` FROM `users` 51 | INNER JOIN `access` 52 | ON `access`.`user_id` = `users`.`id` 53 | WHERE `users`.`user name` = 'Nadim' 54 | ORDER BY `users`.`id` DESC; 55 | -------------------------------------------------------------------------------- /l8-function.php: -------------------------------------------------------------------------------- 1 | "; 7 | } elseif ($m == "Miss") { 8 | echo "$g $p (Gender: Female)"; 9 | echo "
"; 10 | } elseif ($m == "Mrs.") { 11 | echo "$g $p (Gender: Female)"; 12 | echo "
"; 13 | } else { 14 | echo "$g $p (Gender: Tiktoker)"; 15 | echo "
"; 16 | } 17 | } 18 | 19 | greetings("Hi", "Brother", "Mr."); 20 | greetings("Hello", "Sister", "Miss"); 21 | greetings(); 22 | greetings("Oyastagfilrullah"); 23 | greetings(p: "bon", m: "Mrs."); 24 | greetings(p: "beyain", g: "Hi", m: "ha ha"); 25 | 26 | function namta($n, $l) 27 | { 28 | for ($i = 1; $i <= $l; $i++) { 29 | echo "$n x $i = " . ($n * $i) . "
"; 30 | } 31 | } 32 | 33 | namta(369, 10); 34 | 35 | //return 36 | function course($age = 18) 37 | { 38 | if ($age >= 18) { 39 | return "Welcome to our course.
"; 40 | } 41 | return "Sorry you are not allowed to our course.
"; 42 | } 43 | 44 | echo course(13); 45 | 46 | echo gettype([1, 2]) . "
"; 47 | 48 | function f2c($d) 49 | { 50 | if (gettype($d) !== "integer") { 51 | return "Please provide a number
"; 52 | } 53 | return (($d - 32) * 5 / 9) . "
"; 54 | } 55 | 56 | echo f2c("ha ha ha"); 57 | echo f2c(104); 58 | 59 | // function will take 3 peram 60 | // day / hour / min 61 | // function wil find the second 62 | 63 | function t2s($d = null, $h = null, $m = null) 64 | { 65 | if (empty($d) || empty($h) || empty($m)) { 66 | return "Please provide all the information"; 67 | } else { 68 | if (gettype($d) !== "integer" || gettype($h) !== "integer" || gettype($m) !== "integer") { 69 | return "Please dont provide invalid data"; 70 | } 71 | } 72 | 73 | $d2s = $d * 86400; 74 | $h2s = $h * 3600; 75 | $m2s = $m * 60; 76 | return $tSec = $d2s + $h2s + $m2s; 77 | } 78 | 79 | echo t2s(2, 5, 7); 80 | -------------------------------------------------------------------------------- /crud/nav.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crud/header.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Document 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 38 | 39 | 40 | 41 |
42 |
43 | 44 |
-------------------------------------------------------------------------------- /crud/signin.php: -------------------------------------------------------------------------------- 1 | real_escape_string($password); 22 | } 23 | 24 | 25 | if (isset($crrEmail) && isset($crrPass)) { 26 | // $encPass = password_hash($crrCpass, PASSWORD_BCRYPT); 27 | $checkemail = $conn->query("SELECT * FROM `users` WHERE `email` = '$crrEmail'"); 28 | if ($checkemail->num_rows !== 1) { 29 | echo ""; 30 | } else { 31 | $uEmail = $checkemail->fetch_object(); 32 | if (!password_verify($crrPass, $uEmail->pass)) { 33 | echo ""; 34 | } else { 35 | $_SESSION['user'] = ["name" => $uEmail->name, "email" => $crrEmail]; 36 | echo ""; 37 | } 38 | } 39 | } 40 | } 41 | ?> 42 |
43 |
44 |

Sign-in Form

45 |
46 |
47 | " name="email" placeholder="Enter your email" value=""> 48 | 49 |
50 | 51 |
52 |
53 |
54 | " name="password" placeholder="Enter your password" value=""> 55 | 56 |
57 | 58 |
59 |
60 | 61 |
62 |
63 |
64 | -------------------------------------------------------------------------------- /crud/updateProfile.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `users` WHERE `email` = '$email'"); 25 | if ($checkEmail->num_rows > 0 && $email !== $crrEmail) { 26 | $errEmail = "Email address is already in use"; 27 | } 28 | } 29 | 30 | if (isset($errName) || isset($errEmail)) { 31 | echo ""; 32 | } else { 33 | // Perform the database update query here 34 | $updateQuery = $conn->query("UPDATE `users` SET `name` = '$name', `email` = '$email' WHERE `email` = '$crrEmail'"); 35 | 36 | if (!$updateQuery) { 37 | echo ""; 38 | } else { 39 | // Update the session variables with the new values 40 | $_SESSION['user']['name'] = $name; 41 | $_SESSION['user']['email'] = $email; 42 | echo ""; 43 | } 44 | } 45 | } 46 | 47 | ?> 48 |
49 |
50 |

Update Form

51 |
52 |
53 | " name="name" placeholder="Enter your name" value=""> 54 | 55 |
56 | 57 |
58 |
59 |
60 | " name="email" placeholder="Enter your email" value=""> 61 | 62 |
63 | 64 |
65 |
66 | 67 | 68 | 69 |
70 |
71 |
72 | -------------------------------------------------------------------------------- /crud/changePass.php: -------------------------------------------------------------------------------- 1 | query("SELECT * FROM `users` WHERE `email` = '$crrEmail'"); 11 | if ($checkOldPass->num_rows !== 1 || !password_verify($old_password, $checkOldPass->fetch_object()->pass)) { 12 | $errOldPass = "Incorrect old password"; 13 | } 14 | 15 | if (empty($new_password)) { 16 | $errNewPass = "Please enter your new password"; 17 | } elseif (!preg_match('/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\w\s]).{8,}$/', $new_password)) { 18 | $errNewPass = "Please provide a strong password"; 19 | } 20 | 21 | if (empty($confirm_password)) { 22 | $errConfirmPass = "Please confirm your new password"; 23 | } elseif ($new_password !== $confirm_password) { 24 | $errConfirmPass = "Passwords do not match"; 25 | } 26 | 27 | if (isset($errOldPass) || isset($errNewPass) || isset($errConfirmPass)) { 28 | echo ""; 29 | } else { 30 | $hashed_password = password_hash($new_password, PASSWORD_BCRYPT); 31 | $updateQuery = $conn->query("UPDATE `users` SET `pass` = '$hashed_password' WHERE `email` = '$crrEmail'"); 32 | 33 | if (!$updateQuery) { 34 | echo ""; 35 | } else { 36 | echo ""; 37 | } 38 | } 39 | } 40 | 41 | 42 | ?> 43 |
44 |
45 |

Sign-in Form

46 |
47 |
48 | " name="old_password" placeholder="Enter your old password" value=""> 49 | 50 |
51 | 52 |
53 |
54 |
55 | " name="new_password" placeholder="Enter your new password" value=""> 56 | 57 |
58 | 59 |
60 |
61 |
62 | " name="confirm_password" placeholder="Confirm your new password" value=""> 63 | 64 |
65 | 66 |
67 |
68 | 69 | 70 |
71 |
72 |
73 | -------------------------------------------------------------------------------- /l12-form-validation.php: -------------------------------------------------------------------------------- 1 | please write your name"; 14 | } elseif (!preg_match("/^[A-Za-z. ]*$/", $yname)) { 15 | $errName = "Invalid name format"; 16 | } else { 17 | $crrYname = $yname; 18 | } 19 | 20 | if (empty($yemail)) { 21 | $errEmail = "please write your email"; 22 | } elseif (!filter_var($yemail, FILTER_VALIDATE_EMAIL)) { 23 | $errEmail = "Invalid email address"; 24 | } else { 25 | $crrYemail = $yemail; 26 | } 27 | 28 | if (empty($gndr)) { 29 | $errGndr = "please select your gender"; 30 | } else { 31 | $crrGndr = $gndr; 32 | } 33 | 34 | if (empty($skill)) { 35 | $errSkill = "please select your skills"; 36 | } else { 37 | $crrSkill = $skill; 38 | } 39 | 40 | if (empty($ycountry)) { 41 | $errYcountry = "please select your ocuntry"; 42 | } else { 43 | $crrYcountry = $ycountry; 44 | } 45 | 46 | if (isset($crrYname) && isset($crrYemail) && isset($crrGndr) && isset($crrSkill) && isset($crrYcountry)) { 47 | $skills = implode(", ", $crrSkill); 48 | $msg = " 49 |
You Name: $crrYname
50 |
You Email: $crrYemail
51 |
You Gender: $crrGndr
52 |
You Skills: $skills
53 |
You Country: $crrYcountry
54 | "; 55 | $yname = $yemail = $gndr = $skill = $ycountry = null; 56 | } 57 | } 58 | ?> 59 | 60 |
61 | 62 | 63 |

64 | 65 | 66 |

67 | Gender : 68 | >Male 69 | >Female 70 | 71 |

72 | Skills: 73 | >HTML 74 | >CSS 75 | >Bootstrap 76 | >JS 77 | >jQuery 78 | >React 79 | 80 |

81 | 86 | 87 |

88 | 89 |
90 | 91 | -------------------------------------------------------------------------------- /crud/signup.php: -------------------------------------------------------------------------------- 1 | real_escape_string($name); 16 | } 17 | 18 | if (empty($email)) { 19 | $errEmail = "Please provide your name"; 20 | } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 21 | $errEmail = "Invalid email Address"; 22 | } else { 23 | $email = $conn->real_escape_string($email); 24 | $checkEmail = $conn->query("SELECT * FROM `users` WHERE `email` = '$email'"); 25 | if ($checkEmail->num_rows > 0) { 26 | $errEmail = "Email already exicts"; 27 | } else { 28 | $crrEmail = $email; 29 | } 30 | } 31 | 32 | if (empty($password)) { 33 | $errPass = "Please provide your name"; 34 | } elseif (!preg_match('/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\w\s]).{8,}$/', $password)) { 35 | $errPass = "Please provide an strong password"; 36 | } else { 37 | $crrPass = $conn->real_escape_string($password); 38 | } 39 | 40 | if (empty($cpassword)) { 41 | $errCpass = "Please confirm your name"; 42 | } elseif (!preg_match('/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\w\s]).{8,}$/', $cpassword)) { 43 | $errCpass = "Please provide an strong password"; 44 | } elseif ($password !== $cpassword) { 45 | $errCpass = "Password didnot matched"; 46 | } else { 47 | $crrCpass = $conn->real_escape_string($cpassword); 48 | } 49 | 50 | if (isset($crrName) && isset($crrEmail) && isset($crrPass) && isset($crrCpass)) { 51 | $encPass = password_hash($crrCpass, PASSWORD_BCRYPT); 52 | $insert = $conn->query("INSERT INTO `users` (`name`, `email`, `pass`) VALUES ('$crrName', '$crrEmail', '$encPass')"); 53 | if (!$insert) { 54 | echo ""; 55 | } else { 56 | $_SESSION['user'] = ["name" => $crrName, "email" => $crrEmail]; 57 | echo ""; 58 | } 59 | } 60 | } 61 | ?> 62 |
63 |
64 |

Sign-up Form

65 |
66 |
67 | " name="name" placeholder="Enter your name" value=""> 68 | 69 |
70 | 71 |
72 |
73 |
74 | " name="email" placeholder="Enter your email" value=""> 75 | 76 |
77 | 78 |
79 |
80 |
81 | " name="password" placeholder="Enter your password" value=""> 82 | 83 |
84 | 85 |
86 |
87 |
88 | " name="confirm_password" placeholder="Confirm your password" value=""> 89 | 90 |
91 | 92 |
93 |
94 | 95 |
96 |
97 |
98 | --------------------------------------------------------------------------------