├── README.md ├── config.php ├── delete.php ├── edit.php ├── insert.php ├── list.php ├── login.php └── logout.php /README.md: -------------------------------------------------------------------------------- 1 | # Crud operations with login,logout,session functions simple way using php 2 | -------------------------------------------------------------------------------- /config.php: -------------------------------------------------------------------------------- 1 | connect_error) { 10 | die("Connection failed: " . $conn->connect_error); 11 | } 12 | -------------------------------------------------------------------------------- /delete.php: -------------------------------------------------------------------------------- 1 | query($sql); 11 | if ($result === true) { 12 | echo ""; 13 | // header('Location: list.php'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /edit.php: -------------------------------------------------------------------------------- 1 | query($sql); 10 | while ($row = $result->fetch_assoc()) { 11 | $d_name = $row['name']; 12 | $d_email = $row['email']; 13 | $d_password = $row['password']; 14 | } 15 | ?> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Document 25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 |
45 | 46 | 47 | query($sql); 55 | if ($result == true) { 56 | echo ""; 57 | //header('Location: list.php'); 58 | } 59 | } 60 | ?> 61 |
62 | 63 | 64 | -------------------------------------------------------------------------------- /insert.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Document 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 |
37 | 38 | 39 | query($sql); 47 | 48 | if ($result->num_rows > 0) { 49 | echo ""; 50 | }else { 51 | $hashed_password = password_hash($password, PASSWORD_DEFAULT); 52 | $sql = "INSERT INTO `user`(`name`,`email`,`password`) VALUE('$name','$email','$hashed_password')"; 53 | $Result = $conn->query($sql); 54 | if ($Result == TRUE) { 55 | echo ""; 56 | }} 57 | } 58 | ?> 59 |
60 | 61 | 62 | -------------------------------------------------------------------------------- /list.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Document 19 | 20 | 21 | 22 |
23 |
24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | query($sql); 40 | $i = 0; 41 | if ($result->num_rows > 0) { 42 | while ($row = $result->fetch_assoc()) { 43 | $i++; 44 | ?> 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 |
SlnameemailEditDelete
56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Document 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 |
34 | 35 | 36 | query($sql); 44 | 45 | if ($result->num_rows > 0) { 46 | while ($row = $result->fetch_assoc()) { 47 | $d_name = $row['name']; 48 | $d_email = $row['email']; 49 | $d_password = $row['password']; 50 | }; 51 | if (password_verify($password, $d_password)) { 52 | echo ""; 53 | $_SESSION['login_user'] = $d_name; 54 | } else { 55 | echo ""; 56 | } 57 | } else { 58 | echo ""; 59 | } 60 | } 61 | ?> 62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 | alert('Good Bye!!',window.location.href='login.php')"; 5 | --------------------------------------------------------------------------------