├── LICENSE.md ├── README.md ├── assets ├── css │ └── style.css └── js │ └── script.js ├── change_password.php ├── config.php ├── demo.sql ├── edit_profile.php ├── forget_password.php ├── functions.php ├── includes ├── footer.php ├── header.php └── navbar.php ├── index.php ├── libraries └── PHPMailer-master │ └── readme.md ├── login.php ├── logout.php ├── process ├── account_verify.php ├── change_password.php ├── deactivate_account.php ├── edit_profile.php ├── forget_password.php ├── login.php ├── register.php ├── request_activate_account.php ├── reset_code_verify.php └── reset_password.php ├── profile.php ├── register.php ├── request-account-activate.php └── reset_password.php /LICENSE.md: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2019 ZykeNetwork 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project-Burger 2 | Easy to Start, Easy to work, easy to understand. 3 | -------------------------------------------------------------------------------- /assets/css/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | font-family: 'Raleway', sans-serif; 3 | } 4 | .navbar-custom{ 5 | background-color:#86be3f !important; 6 | font-weight: bold; 7 | } 8 | 9 | .navbar-custom a{ 10 | color:#fff !important; 11 | } 12 | 13 | .navbar-custom a:hover{ 14 | color:#fff; 15 | } 16 | 17 | 18 | 19 | 20 | .card-custom{ 21 | border-color: #86be3f; 22 | } 23 | 24 | .card-header-custom{ 25 | background-color: #86be3f; 26 | } 27 | 28 | .card-header-custom a{ 29 | color: #fff; 30 | } 31 | 32 | .color-set{ 33 | background-color:#86be3f; 34 | color:white; 35 | } 36 | 37 | .color-set-default{ 38 | background-color: #343a40; 39 | color:white; 40 | } 41 | 42 | 43 | #imageUpload{ 44 | display: none; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /assets/js/script.js: -------------------------------------------------------------------------------- 1 | $( "#uploadNewImage" ).click(function() { 2 | $("#imageBox").hide(); 3 | $("#imageUpload").show(); 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /change_password.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 |
11 | 12 |
13 |
14 |

Change your Password

15 |

Please fill in credentials to Change Password.

16 | 17 | 29 | 30 | 31 |
32 | 33 |
34 | 35 | 36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 |
44 | 45 | 46 |
47 | 48 | 49 | 50 |
51 | 52 | 53 | 54 |
55 | 56 |
57 | 58 | 59 | 60 |
61 | 62 | 63 | 64 |
65 | 66 | 67 | 68 |
69 | 70 |
71 |
72 | 73 |
74 | 75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /config.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 |
14 | 15 |

Update Your account Details

16 |

17 | 30 | 31 |

32 |
33 |
34 | 35 | 36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 |
44 | 45 | 46 |
47 | 48 | 49 | 50 |
51 | 52 |
53 | 54 | 55 | 56 |
57 | 58 |
59 | 60 | Click here to upload 61 |
62 | 63 |
64 | 65 | 66 | 67 |
68 | 69 | 70 | 71 | 72 |
73 | 74 |
75 | 76 | 77 | 78 |
79 | 80 | 81 |
82 | 83 | Wanna Change Password? 84 | 85 |
86 | 87 |
88 | 89 |
90 | 91 |
92 |
93 | 94 |
95 | 96 | 97 |
98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /forget_password.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 |
15 |

Reset Password

16 |

Please fill in credentials to get reset link.

17 | 18 | 29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | 37 |
38 | 39 | 40 | 41 |
42 | 43 |
44 | 45 | 46 | 47 |
48 | 49 | 50 | 51 |
52 |
53 |
54 | 55 | Go Back to Login 56 | 57 |
58 | 59 |
60 | 61 | 62 |
63 | 64 |
65 |
66 | 67 |
68 | 69 | 70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | connect_error){ 8 | die("Connection not established"); 9 | } 10 | 11 | return $objDB; 12 | } 13 | 14 | 15 | 16 | function upload_image($image){ 17 | 18 | if(!is_dir(APPROOT.'/images')){ 19 | mkdir(APPROOT.'/images'); 20 | } 21 | 22 | if($image['error']==4){ 23 | die('image file not uploaded'); 24 | } 25 | 26 | if($image['type']!='image/png'){ 27 | die('Only, png image files are allowed'); 28 | } 29 | 30 | $image_info = pathinfo($image['name']); 31 | extract($image_info); 32 | $image_convention = $filename . time() . ".$extension"; 33 | 34 | if(move_uploaded_file($image['tmp_name'], APPROOT . "/images/" . $imageConvention)){ 35 | return $image_convention; 36 | }else{ 37 | return false; 38 | } 39 | 40 | } 41 | 42 | 43 | function cTime($timestamp){ 44 | return date('j F, Y', $timestamp); 45 | } 46 | 47 | 48 | 49 | function checkUserByEmail($email){ 50 | 51 | $objDB = objDB(); 52 | 53 | $stmt = $objDB->prepare( 54 | 'SELECT * FROM users WHERE email=?' 55 | ); 56 | 57 | 58 | $stmt->bind_param('s', $email); 59 | 60 | 61 | $stmt->execute(); 62 | 63 | 64 | 65 | $stmt->store_result(); 66 | 67 | 68 | return $stmt->num_rows; 69 | } 70 | 71 | 72 | 73 | function checkUserByUsername($username){ 74 | 75 | $objDB = objDB(); 76 | 77 | 78 | $stmt = $objDB->prepare( 79 | 'SELECT * FROM users WHERE username=?' 80 | ); 81 | 82 | $stmt->bind_param('s', $username); 83 | 84 | $stmt->execute(); 85 | 86 | $stmt->store_result(); 87 | 88 | return $stmt->num_rows; 89 | } 90 | 91 | 92 | 93 | 94 | function checkUserActivation($username){ 95 | 96 | $objDB = objDB(); 97 | 98 | 99 | $stmt = $objDB->prepare( 100 | 'SELECT * FROM users WHERE username=? AND is_active=1' 101 | ); 102 | 103 | $stmt->bind_param('s', $username); 104 | 105 | $stmt->execute(); 106 | 107 | $stmt->store_result(); 108 | 109 | return $stmt->num_rows; 110 | } 111 | 112 | 113 | function redirect($file){ 114 | header("Location:".URLROOT.'/'.$file); 115 | } 116 | 117 | 118 | 119 | function setMsg($name, $value, $class = 'success'){ 120 | if(is_array($value)){ 121 | $_SESSION[$name] = $value; 122 | }else{ 123 | $_SESSION[$name] = "
$value
"; 124 | } 125 | 126 | } 127 | 128 | 129 | function getMsg($name){ 130 | if(isset($_SESSION[$name])){ 131 | $session=$_SESSION[$name]; 132 | unset($_SESSION[$name]); 133 | return $session; 134 | } 135 | } 136 | 137 | 138 | function getUserById($user_id){ 139 | 140 | $objDB = objDB(); 141 | 142 | 143 | $stmt = $objDB->prepare( 144 | 'SELECT * FROM users WHERE id=?' 145 | ); 146 | 147 | $stmt->bind_param('i', $user_id); 148 | 149 | $stmt->execute(); 150 | 151 | 152 | $result = $stmt->get_result(); 153 | 154 | return $result->fetch_object(); 155 | } 156 | 157 | 158 | 159 | function verifyUserAccount($code){ 160 | 161 | $objDB = objDB(); 162 | 163 | 164 | $stmt = $objDB->prepare( 165 | "UPDATE users SET is_active = 1 , reset_code = '' WHERE reset_code = ?" 166 | ); 167 | 168 | $stmt->bind_param('s', $code); 169 | 170 | $stmt->execute(); 171 | 172 | $stmt->store_result(); 173 | 174 | return $stmt->affected_rows; 175 | } 176 | 177 | 178 | 179 | function checkUserByCode($code){ 180 | 181 | $objDB = objDB(); 182 | 183 | 184 | $stmt = $objDB->prepare( 185 | 'SELECT * FROM users WHERE reset_code = ?' 186 | ); 187 | 188 | $stmt->bind_param('s', $code); 189 | 190 | $stmt->execute(); 191 | 192 | $stmt->store_result(); 193 | 194 | return $stmt->num_rows; 195 | } 196 | 197 | 198 | function isUserLoggedIn(){ 199 | if(isset($_SESSION['user']) || isset($_COOKIE['user'])){ 200 | return true; 201 | }else{ 202 | return false; 203 | } 204 | } 205 | 206 | 207 | 208 | 209 | 210 | 211 | function send_mail($detail=array()){ 212 | 213 | 214 | if(!empty($detail['to']) && !empty($detail['message']) && !empty($detail['subject']) && !empty($detail['from'])){ 215 | $mail = new PHPMailer(true); 216 | //$mail->SMTPDebug = 2; // Enable verbose debug output 217 | $mail->isSMTP(); // Set mailer to use SMTP 218 | $mail->Host = 'your-smtp-host'; // Specify main and backup SMTP servers 219 | $mail->SMTPAuth = true; // Enable SMTP authentication 220 | $mail->Username = 'username-smtp'; // SMTP username 221 | $mail->Password = 'password-smtp'; // SMTP password 222 | $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted 223 | $mail->Port = 587; // TCP port to connect to 224 | 225 | //Recipients 226 | $mail->setFrom('no-reply@proteinwriter.com', $detail['from']); 227 | $mail->addAddress($detail['to'], ''); // Add a recipient 228 | 229 | //Content 230 | $mail->isHTML(true); // Set email format to HTML 231 | $mail->Subject = $detail['subject']; 232 | $mail->Body = $detail['message']; 233 | //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 234 | 235 | if(!$mail->send()) { 236 | return false; 237 | } else { 238 | return true; 239 | } 240 | 241 | }else{ 242 | 243 | die('Your Mail Handler requires four main paramters'); 244 | 245 | } 246 | 247 | 248 | 249 | } 250 | -------------------------------------------------------------------------------- /includes/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /includes/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Project Burger 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /includes/navbar.php: -------------------------------------------------------------------------------- 1 | 42 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 |
11 |
12 |

Project Burger Features

13 |

Create the complete login and register form

14 |
15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 | 23 |
24 | a 25 | Features [Part - 1] 26 |
27 |
28 | 29 |
30 |
31 | 32 | 33 |
    34 |
  • Login / Register
  • 35 |
  • Profile mangement System
  • 36 |
  • Forget/Reset Password
  • 37 |
  • Remember me Option
  • 38 | 39 |
40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 |
52 | 53 |
54 | 55 |
56 | 57 | 58 |
59 | 60 | Features [Part - 2] 61 |
62 |
63 | 64 |
65 |
66 | 67 | 68 |
    69 | 70 |
  • Deactivate Account
  • 71 |
  • Email Verification
  • 72 |
  • Account Verification
  • 73 |
  • Unhackable from 12 Year Old Hacker
  • 74 |
75 | 76 | 77 |
78 |
79 | 80 | 81 | 82 |
83 | 84 | 85 |
86 |
87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /libraries/PHPMailer-master/readme.md: -------------------------------------------------------------------------------- 1 | You can download from Here 2 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | 14 |
15 |
16 |

Login

17 |

Please fill in credentials to log in.

18 | 32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 | 45 | 46 |
47 | 48 | 49 |
50 | 51 | 52 |
53 | 54 | 55 |
56 | 57 |
58 | 59 | 60 | 61 |
62 | 63 | 64 | 65 |
66 |
67 |
68 | 69 | Forget Passsword? 70 | 71 |
72 | 73 | 74 |
75 | 76 | No account? Register 77 | 78 |
79 |
80 | 81 | 82 |
83 | 84 |
85 |
86 | 87 |
88 | 89 | 90 |
91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 | 20 || strlen($old_password)<5){ 18 | $errors['old_password_err'] = 'Old Password min limit is 5 & max is 20 characters'; 19 | }elseif(!password_verify($old_password, $user->password)){ 20 | $errors['old_password_err'] = 'Old password incorrect please enter valid password'; 21 | } 22 | 23 | 24 | 25 | if(strlen($password)>20 || strlen($password)<5){ 26 | $errors['password_err'] = 'Password min limit is 5 & max is 20 characters'; 27 | } 28 | 29 | 30 | if($password!=$confirm_password || empty($confirm_password)){ 31 | $errors['confirm_password_err'] = 'Password does not match or empty'; 32 | } 33 | 34 | 35 | if(!count($errors)){ 36 | 37 | 38 | 39 | $stmt = $objDB->prepare( 40 | 'UPDATE users SET password = ? WHERE id = ?' 41 | 42 | ); 43 | 44 | $stmt->bind_param('si', password_hash($password, PASSWORD_DEFAULT), $user->id); 45 | 46 | 47 | if($stmt->execute()){ 48 | setMsg('msg_notify', 'Your account password has been updated successfully.'); 49 | unset($_SESSION['user']); 50 | redirect('login.php'); 51 | exit(); 52 | } 53 | 54 | 55 | 56 | } else{ 57 | 58 | $data = [ 59 | 'old_password' => $old_password, 60 | 'password' => $password, 61 | 'confirm_password' => $confirm_password, 62 | ]; 63 | 64 | setMsg('form_data', $data); 65 | 66 | setMsg('errors', $errors); 67 | 68 | } 69 | 70 | redirect('change_password.php'); 71 | } 72 | -------------------------------------------------------------------------------- /process/deactivate_account.php: -------------------------------------------------------------------------------- 1 | prepare( 15 | 'UPDATE users SET is_active = 0 WHERE id = ?' 16 | 17 | ); 18 | 19 | $stmt->bind_param('i', $user->id); 20 | 21 | 22 | if($stmt->execute()){ 23 | setMsg('msg_notify', 'Your account has been deactivated successfully. Request support to activate your account.'); 24 | unset($_SESSION['user']); 25 | redirect('login.php'); 26 | exit(); 27 | } 28 | 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /process/edit_profile.php: -------------------------------------------------------------------------------- 1 | 50 || strlen($name)<6){ 17 | $errors['name_err'] = 'Name min limit is 6 & max is 50 characters'; 18 | } 19 | 20 | if(strlen($username)>15 || strlen($username)<5){ 21 | $errors['username_err'] = 'Username min limit is 5 & max is 15 characters'; 22 | } 23 | 24 | $reg_email = '/^[a-z0-9]+(\.|_)?[a-z0-9]+@[a-z0-9]+(.com|.net|.org|.me)$/i'; 25 | if(!preg_match($reg_email, $email)){ 26 | $errors['email_err'] = 'Enetered email is invalid'; 27 | } 28 | 29 | 30 | 31 | if(empty($website)){ 32 | $errors['website_err'] = 'Invalid entry'; 33 | } 34 | 35 | 36 | if($image['error']!=4){ 37 | 38 | 39 | if(!is_dir(APPROOT.'/images')){ 40 | mkdir(APPROOT.'/images'); 41 | } 42 | 43 | if($image['error']==4){ 44 | $errors['image_err']='Please, upload file'; 45 | }elseif($image['type']!='image/png' && $image['type']!='image/jpeg'){ 46 | $errors['image_err']='Only, png/jpeg image is allowed'; 47 | } 48 | 49 | $image_info = pathinfo($image['name']); 50 | extract($image_info); 51 | $image_convention = $filename . time() . ".$extension"; 52 | 53 | move_uploaded_file($image['tmp_name'], APPROOT . "/images/" . $image_convention); 54 | 55 | }else{ 56 | $image_convention = $user->image; 57 | } 58 | 59 | 60 | if(!count($errors)){ 61 | 62 | 63 | 64 | $stmt = $objDB->prepare( 65 | 'UPDATE users SET name = ?, email = ?, username=?, website=?, image=? WHERE id=?' 66 | 67 | ); 68 | 69 | $stmt->bind_param('sssssi', $name, $email, $username, $website, $image_convention, $user->id); 70 | 71 | 72 | if($stmt->execute()){ 73 | setMsg('msg_notify', 'Your account has been updated successfully.'); 74 | } 75 | 76 | $_SESSION['user'] = getUserById($user->id); 77 | redirect('profile.php'); 78 | 79 | } else{ 80 | 81 | 82 | setMsg('errors', $errors); 83 | redirect('edit_profile.php'); 84 | 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /process/forget_password.php: -------------------------------------------------------------------------------- 1 | prepare( 24 | 'UPDATE users SET is_active = 0, reset_code=? WHERE email=?' 25 | ); 26 | 27 | $stmt->bind_param('ss', $code, $email); 28 | 29 | if($stmt->execute()){ 30 | setMsg('msg', 'You made a password request, please check email to reset your password.', 'warning'); 31 | 32 | 33 | 34 | $message = "Hi! You requested password reset, . You need to click here to Reset your password."; 35 | 36 | send_mail([ 37 | 38 | 'to' => $email, 39 | 'message' => $message, 40 | 'subject' => 'Reset Password Requested', 41 | 'from' => 'eProfile System', 42 | 43 | ]); 44 | } 45 | 46 | 47 | }else{ 48 | 49 | $data = [ 50 | 51 | 'email' => $email, 52 | 53 | ]; 54 | 55 | setMsg('form_data', $data); 56 | setMsg('errors', $errors); 57 | 58 | } 59 | redirect('forget_password.php'); 60 | } 61 | -------------------------------------------------------------------------------- /process/login.php: -------------------------------------------------------------------------------- 1 | 15 || strlen($username) < 5) { 16 | $errors['username_err'] = 'Username min limit is 5 & max is 15 characters'; 17 | }elseif(!checkUserByUsername($username)){ 18 | $errors['username_err'] = "Username not exists"; 19 | } elseif (!checkUserActivation($username)) { 20 | $errors['username_err'] = "Your account is not verified, click here to verify."; 21 | } 22 | 23 | if (strlen($password) > 20 || strlen($password) < 5) { 24 | $errors['password_err'] = 'Password min limit is 5 & max is 20 characters'; 25 | } 26 | 27 | 28 | 29 | if (!count($errors)) { 30 | 31 | 32 | 33 | 34 | $stmt = $objDB->prepare( 35 | 'SELECT * FROM users WHERE username=?' 36 | ); 37 | 38 | $stmt->bind_param('s', $username); 39 | $stmt->execute(); 40 | 41 | $result = $stmt->get_result(); 42 | $user = $result->fetch_object(); 43 | 44 | if ($result->num_rows == 1) { 45 | 46 | 47 | if (password_verify($password, $user->password)) { 48 | 49 | if($remember=='Yes'){ 50 | setcookie('user', serialize($user), time() + (86400 * 30), '/'); 51 | 52 | }else{ 53 | $_SESSION['user'] = $user; 54 | } 55 | 56 | redirect('profile.php'); 57 | exit(); 58 | } else { 59 | setMsg('msg_notify', 'Account not found, please enter correct credentials', 'warning'); 60 | } 61 | } 62 | } else { 63 | 64 | $data = [ 65 | 'username' => $username, 66 | 'password' => $password, 67 | ]; 68 | 69 | setMsg('form_data', $data); 70 | setMsg('errors', $errors); 71 | } 72 | redirect('login.php'); 73 | } 74 | -------------------------------------------------------------------------------- /process/register.php: -------------------------------------------------------------------------------- 1 | 50 || strlen($name)<6){ 18 | $errors['name_err'] = 'Name min limit is 6 & max is 50 characters'; 19 | } 20 | 21 | if(strlen($username)>15 || strlen($username)<5){ 22 | $errors['username_err'] = 'Username min limit is 5 & max is 15 characters'; 23 | }elseif(checkUserByUsername($username)){ 24 | $errors['username_err'] = 'Username already exists'; 25 | } 26 | 27 | $reg_email = '/^[a-z0-9]+(\.|_)?[a-z0-9]+@[a-z0-9]+(.com|.net|.org|.me)$/i'; 28 | if(!preg_match($reg_email, $email)){ 29 | $errors['email_err'] = 'Enetered email is invalid'; 30 | }elseif(checkUserByEmail($email)){ 31 | $errors['email_err'] = 'Email already exists'; 32 | } 33 | 34 | 35 | 36 | if(empty($website)){ 37 | $errors['website_err'] = 'Invalid entry'; 38 | } 39 | 40 | 41 | if(strlen($password)>20 || strlen($password)<5){ 42 | $errors['password_err'] = 'Password min limit is 5 & max is 20 characters'; 43 | } 44 | 45 | 46 | if($password!=$confirm_password || empty($confirm_password)){ 47 | $errors['confirm_password_err'] = 'Password does not match or empty'; 48 | } 49 | 50 | 51 | 52 | 53 | if(!count($errors)){ 54 | 55 | $password = password_hash($password, PASSWORD_DEFAULT); 56 | $code = md5(crypt(rand(), 'aa')); 57 | 58 | 59 | $stmt = $objDB->prepare( 60 | 'INSERT INTO users(name, email, username, password, website, created_at, reset_code) 61 | VALUES(?, ?, ?, ?, ?, ?, ?)' 62 | ); 63 | 64 | $stmt->bind_param('sssssis', $name, $email, $username, $password, $website, time(), $code); 65 | 66 | 67 | if($stmt->execute()){ 68 | setMsg('msg', 'Your account has been created successfully.Please, check your email to verify.', 'warning'); 69 | 70 | 71 | 72 | $message = "Hi! You requested an account on our website, in order to use this account. You need to click here to Verify it."; 73 | send_mail([ 74 | 75 | 'to' => $email, 76 | 'message' => $message, 77 | 'subject' => 'Account Verficiation', 78 | 'from' => 'eProfile System', 79 | 80 | ]); 81 | } 82 | 83 | } else{ 84 | 85 | $data = [ 86 | 'name' => $name, 87 | 'username' => $username, 88 | 'email' => $email, 89 | 'website' => $website, 90 | 'password' => $password, 91 | 'confirm_password' => $confirm_password, 92 | ]; 93 | 94 | setMsg('form_data', $data); 95 | setMsg('errors', $errors); 96 | } 97 | 98 | redirect('register.php'); 99 | } 100 | -------------------------------------------------------------------------------- /process/request_activate_account.php: -------------------------------------------------------------------------------- 1 | prepare( 24 | 'UPDATE users SET reset_code=? WHERE email=?' 25 | ); 26 | 27 | $stmt->bind_param('ss', $code, $email); 28 | 29 | if($stmt->execute()){ 30 | setMsg('msg', 'Please, check your email to verify your account', 'warning'); 31 | 32 | 33 | 34 | $message = "Hi! You requested account verification. You need to click here to activate your account."; 35 | 36 | send_mail([ 37 | 38 | 'to' => $email, 39 | 'message' => $message, 40 | 'subject' => 'Account Verification Request', 41 | 'from' => 'eProfile System', 42 | 43 | ]); 44 | } 45 | 46 | 47 | }else{ 48 | 49 | $data = [ 50 | 51 | 'email' => $email, 52 | 53 | ]; 54 | 55 | setMsg('form_data', $data); 56 | setMsg('errors', $errors); 57 | 58 | } 59 | redirect('request-account-activate.php'); 60 | } 61 | -------------------------------------------------------------------------------- /process/reset_code_verify.php: -------------------------------------------------------------------------------- 1 | 20 || strlen($password)<5){ 19 | $errors['password_err'] = 'Password min limit is 5 & max is 20 characters'; 20 | } 21 | 22 | 23 | if($password!=$confirm_password || empty($confirm_password)){ 24 | $errors['confirm_password_err'] = 'Password does not match or empty'; 25 | } 26 | 27 | 28 | 29 | if(!count($errors)){ 30 | 31 | $password = password_hash($password, PASSWORD_DEFAULT); 32 | $code = $_SESSION['reset_code']; 33 | 34 | 35 | 36 | $stmt = $objDB->prepare( 37 | "UPDATE users SET reset_code= '', is_active=1, password=? WHERE reset_code=?" 38 | ); 39 | 40 | $stmt->bind_param('ss', $password, $code); 41 | 42 | 43 | if($stmt->execute()){ 44 | setMsg('msg_notify', 'Your account password has been reset, you can login now.'); 45 | redirect('login.php'); 46 | } 47 | 48 | } else{ 49 | 50 | $data = [ 51 | 'password' => $password, 52 | 'confirm_password' => $confirm_password, 53 | ]; 54 | 55 | setMsg('form_data', $data); 56 | setMsg('errors', $errors); 57 | redirect('reset_password.php'); 58 | } 59 | 60 | 61 | 62 | } 63 | 64 | -------------------------------------------------------------------------------- /profile.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 |
10 |
11 |

12 | Profile Managment 13 |

14 |

15 | Here you will be able to upload image and edit information 16 |

17 | 18 |
19 |
20 | 27 | 28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | Your Profile Data 36 |
37 |
38 | 39 | 40 |
41 | 42 |
43 |
44 | 45 | name); ?> 46 |
47 | 48 |
49 | 50 | email); ?> 51 |
52 | 53 |
54 | 55 | username); ?> 56 |
57 |
58 | 59 | website); ?> 60 |
61 | 62 | 63 | 64 |
65 |
66 | 67 | created_at)); ?> 68 |
69 | 70 |
71 |
72 | image)): ?> 73 | 74 | 75 | 76 | 77 |
78 |
79 | 80 |
81 | 85 | 86 |
87 |
88 | 89 | 110 | 111 | 112 | 113 |
114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /register.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 |
11 | 12 |
13 | 14 |
15 |

Register

16 |

Please fill in credentials to Sign Up.

17 | 27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 | 43 |
44 | 45 | 46 | 47 |
48 | 49 |
50 | 51 | 52 | 53 |
54 | 55 |
56 | 57 | 58 | 59 |
60 | 61 | 62 |
63 | 64 | 65 | 66 |
67 | 68 | 69 |
70 | 71 |
72 | 73 | 74 | 75 |
76 | 77 |
78 | 79 |
80 |
81 | 82 | Have account? Login 83 | 84 |
85 |
86 | 87 | 88 |
89 | 90 |
91 |
92 | 93 |
94 | 95 | 96 |
97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /request-account-activate.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 |
15 |

Activate Account Request

16 | 17 | 18 | 28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 | 45 | 46 |
47 | 48 | 49 | 50 |
51 |
52 |
53 | 54 | Go Back to Login 55 | 56 |
57 | 58 |
59 | 60 | 61 |
62 | 63 |
64 |
65 | 66 |
67 | 68 | 69 |
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /reset_password.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 |
15 |

Reset your Password

16 |

Please fill in credentials to Reset Password.

17 | 18 | 35 | 36 |
37 | 38 |
39 | 40 | 41 | 42 |
43 | 44 | 45 |
46 | 47 | 48 | 49 |
50 | 51 |
52 | 53 |
54 | 55 | 56 | 57 |
58 | 59 | 60 | 61 |
62 | 63 | 64 | 65 |
66 | 67 |
68 |
69 | 70 |
71 | 72 | 73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | --------------------------------------------------------------------------------