├── LICENSE ├── README.md ├── assets ├── scripts.js └── styles.css ├── banking.sql ├── bootstrap ├── css │ ├── bootstrap-responsive.css │ ├── bootstrap-responsive.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ └── datepicker.css ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png └── js │ ├── bootstrap-datepicker.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.9.1.min.js │ └── moment.js ├── class ├── class.error.php ├── class.money.php └── class.user.php ├── config └── dbconfig.php ├── fpass.php ├── login.php ├── mailer ├── LICENSE ├── PHPMailerAutoload.php ├── README.md ├── SECURITY ├── VERSION ├── changelog.md ├── class.phpmailer.php ├── class.phpmaileroauth.php ├── class.phpmaileroauthgoogle.php ├── class.pop3.php ├── class.smtp.php ├── composer.json ├── composer.lock ├── extras │ ├── EasyPeasyICS.php │ ├── README.md │ ├── htmlfilter.php │ └── ntlm_sasl_client.php ├── get_oauth_token.php ├── language │ ├── phpmailer.lang-am.php │ ├── phpmailer.lang-ar.php │ ├── phpmailer.lang-az.php │ ├── phpmailer.lang-be.php │ ├── phpmailer.lang-bg.php │ ├── phpmailer.lang-br.php │ ├── phpmailer.lang-ca.php │ ├── phpmailer.lang-ch.php │ ├── phpmailer.lang-cz.php │ ├── phpmailer.lang-da.php │ ├── phpmailer.lang-de.php │ ├── phpmailer.lang-el.php │ ├── phpmailer.lang-eo.php │ ├── phpmailer.lang-es.php │ ├── phpmailer.lang-et.php │ ├── phpmailer.lang-fa.php │ ├── phpmailer.lang-fi.php │ ├── phpmailer.lang-fo.php │ ├── phpmailer.lang-fr.php │ ├── phpmailer.lang-gl.php │ ├── phpmailer.lang-he.php │ ├── phpmailer.lang-hr.php │ ├── phpmailer.lang-hu.php │ ├── phpmailer.lang-id.php │ ├── phpmailer.lang-it.php │ ├── phpmailer.lang-ja.php │ ├── phpmailer.lang-ka.php │ ├── phpmailer.lang-ko.php │ ├── phpmailer.lang-lt.php │ ├── phpmailer.lang-lv.php │ ├── phpmailer.lang-ms.php │ ├── phpmailer.lang-nl.php │ ├── phpmailer.lang-no.php │ ├── phpmailer.lang-pl.php │ ├── phpmailer.lang-pt.php │ ├── phpmailer.lang-ro.php │ ├── phpmailer.lang-ru.php │ ├── phpmailer.lang-se.php │ ├── phpmailer.lang-sk.php │ ├── phpmailer.lang-sl.php │ ├── phpmailer.lang-sr.php │ ├── phpmailer.lang-tr.php │ ├── phpmailer.lang-uk.php │ ├── phpmailer.lang-vi.php │ ├── phpmailer.lang-zh.php │ └── phpmailer.lang-zh_cn.php └── travis.phpunit.xml.dist ├── my ├── activity.php ├── deposit.php ├── home.php ├── logout.php ├── profile.php └── transfer.php ├── resetpass.php ├── signup.php ├── template ├── footer_ac.php ├── header.php ├── menu_ac.php └── misc.php └── verify.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Chi Bao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Payment Gateway 2 | This is a simple payment gateway written in PHP that allow you to run your own Paypal or Apple Pay. The source code are written in OOP style. 3 | 4 | **Help wanted: Feel free to open a pull request or report issues here, I am a bit busy right now but I will happy to help when I am available** 5 | 6 | We are in version 0.1.3 (Alpha Release). 7 | 8 | Deposit, credit card processing feature is not developing right now. 9 | 10 | ## Features 11 | - Open source and continue to be updated. 12 | - Simple to understand and work with. 13 | - Perfect for who are beginner in PHP developement. 14 | - OOP Styles. 15 | - PHP7 Supported. 16 | - MySQL PDO. 17 | - Secure from XSS attacks, MySQL injections,... 18 | - Design based on Bootstrap. 19 | 20 | 21 | ## Todo 22 | - Format the code, add some comment. 23 | - Change language of the source code from Vietnamese to English. 24 | - Implent 1Checkout or similar one to handle credit card processing. 25 | - Fix some bugs and improve the performance. 26 | - Improve the source code to maintain it more easy. 27 | 28 | ## How to install 29 | - Clone or download this repo and extract to your web directory. 30 | - Create a new database (recommended) or use existing one. 31 | - Import the banking.sql file into your database, this will create 2 tables: "activities" and "tbl_users". 32 | - Edit the dbconfig.php file in config directory and fill in with your database infomation and your website path. 33 | - You are ready to go. 34 | -------------------------------------------------------------------------------- /assets/scripts.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | // Side Bar Toggle 3 | $('.hide-sidebar').click(function() { 4 | $('#sidebar').hide('fast', function() { 5 | $('#content').removeClass('span9'); 6 | $('#content').addClass('span12'); 7 | $('.hide-sidebar').hide(); 8 | $('.show-sidebar').show(); 9 | }); 10 | }); 11 | 12 | $('.show-sidebar').click(function() { 13 | $('#content').removeClass('span12'); 14 | $('#content').addClass('span9'); 15 | $('.show-sidebar').hide(); 16 | $('.hide-sidebar').show(); 17 | $('#sidebar').show('fast'); 18 | }); 19 | }); -------------------------------------------------------------------------------- /assets/styles.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css?family=Roboto'); 2 | /** Home Page **/ 3 | body { 4 | /* padding-top: 60px; 5 | padding-bottom: 40px; 6 | background-color: #f5f5f5; 7 | background:#0ca2d1; */ 8 | font-family: 'Roboto', sans-serif; 9 | } 10 | 11 | 12 | /** Login Page **/ 13 | #login { 14 | padding-top: 40px; 15 | padding-bottom: 40px; 16 | } 17 | 18 | #login .form-signin { 19 | max-width: 300px; 20 | padding: 19px 29px 29px; 21 | margin: 0 auto 20px; 22 | background-color: #fff; 23 | border: 1px solid #e5e5e5; 24 | -webkit-border-radius: 5px; 25 | -moz-border-radius: 5px; 26 | border-radius: 5px; 27 | -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); 28 | -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05); 29 | box-shadow: 0 1px 2px rgba(0,0,0,.05); 30 | } 31 | #login .form-signin .form-signin-heading, 32 | #login .form-signin .checkbox { 33 | margin-bottom: 10px; 34 | } 35 | #login .form-signin input[type="text"], 36 | #login .form-signin input[type="password"], 37 | #login .form-signin input[type="email"] { 38 | font-size: 16px; 39 | height: auto; 40 | margin-bottom: 15px; 41 | padding: 7px 9px; 42 | } 43 | 44 | /** 2 level sub menu **/ 45 | .dropdown-menu-with-subs .sub-menu { 46 | left: 100%; 47 | position: absolute; 48 | top: 0; 49 | visibility: hidden; 50 | margin-top: -1px; 51 | } 52 | 53 | .dropdown-menu-with-subs li:hover .sub-menu { 54 | visibility: visible; 55 | display: block; 56 | } 57 | 58 | .navbar .sub-menu:before { 59 | border-bottom: 7px solid transparent; 60 | border-left: none; 61 | border-right: 7px solid rgba(0, 0, 0, 0.2); 62 | border-top: 7px solid transparent; 63 | left: -7px; 64 | top: 10px; 65 | } 66 | .navbar .sub-menu:after { 67 | border-top: 6px solid transparent; 68 | border-left: none; 69 | border-right: 6px solid #fff; 70 | border-bottom: 6px solid transparent; 71 | left: 10px; 72 | top: 11px; 73 | left: -6px; 74 | } 75 | 76 | /** Global **/ 77 | #content { 78 | margin-left:0px; 79 | } 80 | .hide-sidebar, .show-sidebar { 81 | cursor: pointer; 82 | } 83 | .padd-bottom { 84 | margin-bottom: 5px; 85 | } 86 | .breadcrumb { 87 | margin: 0 0 0px; 88 | padding: 10px 0px; 89 | background-color: transparent; 90 | } 91 | 92 | .block { 93 | border: 1px solid #ccc; 94 | background: white; 95 | margin: 1em 0em; 96 | border-top: none; 97 | } 98 | 99 | .block-content { 100 | margin: 1em; 101 | min-height: .25em; 102 | } 103 | 104 | .block-header { 105 | margin-bottom: 0px; 106 | border-right: none; 107 | border-left: none; 108 | -webkit-border-radius: 0px; 109 | -moz-border-radius: 0px; 110 | border-radius: 0px; 111 | } 112 | .block-header div { 113 | padding-top: 10px; 114 | } 115 | 116 | 117 | .chart-bottom-heading { 118 | margin-top: 5px; 119 | text-align: center; 120 | } 121 | 122 | /** Side Bar **/ 123 | .bs-docs-sidenav { 124 | max-width: 228px; 125 | margin: 30px 0 0; 126 | padding: 0; 127 | background-color: #fff; 128 | -webkit-border-radius: 6px; 129 | -moz-border-radius: 6px; 130 | border-radius: 6px; 131 | -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.065); 132 | -moz-box-shadow: 0 1px 4px rgba(0,0,0,.065); 133 | box-shadow: 0 1px 4px rgba(0,0,0,.065); 134 | } 135 | .bs-docs-sidenav > li > a { 136 | display: block; 137 | width: 190px \9; 138 | margin: 0 0 -1px; 139 | padding: 8px 14px; 140 | border: 1px solid #e5e5e5; 141 | } 142 | .bs-docs-sidenav > li:first-child > a { 143 | -webkit-border-radius: 6px 6px 0 0; 144 | -moz-border-radius: 6px 6px 0 0; 145 | border-radius: 6px 6px 0 0; 146 | } 147 | .bs-docs-sidenav > li:last-child > a { 148 | -webkit-border-radius: 0 0 6px 6px; 149 | -moz-border-radius: 0 0 6px 6px; 150 | border-radius: 0 0 6px 6px; 151 | } 152 | .bs-docs-sidenav > .active > a { 153 | position: relative; 154 | z-index: 2; 155 | padding: 9px 15px; 156 | border: 0; 157 | text-shadow: 0 1px 0 rgba(0,0,0,.15); 158 | -webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1); 159 | -moz-box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1); 160 | box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1); 161 | } 162 | /* Chevrons */ 163 | .bs-docs-sidenav .icon-chevron-right { 164 | float: right; 165 | margin-top: 2px; 166 | margin-right: -6px; 167 | opacity: .25; 168 | } 169 | .bs-docs-sidenav > li > a:hover { 170 | background-color: #f5f5f5; 171 | } 172 | .bs-docs-sidenav a:hover .icon-chevron-right { 173 | opacity: .5; 174 | } 175 | .bs-docs-sidenav .active .icon-chevron-right, 176 | .bs-docs-sidenav .active a:hover .icon-chevron-right { 177 | opacity: 1; 178 | } 179 | .bs-docs-sidenav.affix { 180 | top: 40px; 181 | } 182 | .bs-docs-sidenav.affix-bottom { 183 | position: absolute; 184 | top: auto; 185 | bottom: 270px; 186 | } 187 | 188 | /* Icons 189 | ------------------------- */ 190 | .the-icons { 191 | margin-left: 0; 192 | list-style: none; 193 | } 194 | .the-icons li { 195 | float: left; 196 | width: 25%; 197 | line-height: 25px; 198 | } 199 | .the-icons i:hover { 200 | background-color: rgba(255,0,0,.25); 201 | } 202 | -------------------------------------------------------------------------------- /banking.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.6.4 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: localhost:3306 6 | -- Generation Time: Mar 25, 2017 at 08:00 AM 7 | -- Server version: 10.1.19-MariaDB 8 | -- PHP Version: 7.0.12 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8mb4 */; 18 | 19 | -- 20 | -- Database: `banking` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- Table structure for table `activity` 27 | -- 28 | 29 | CREATE TABLE `activity` ( 30 | `id` int(11) NOT NULL, 31 | `fromEmail` varchar(100) NOT NULL, 32 | `toEmail` varchar(100) NOT NULL, 33 | `content` varchar(200) NOT NULL DEFAULT 'Chuyển tiền', 34 | `cash` decimal(10,0) NOT NULL, 35 | `date` date NOT NULL 36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 37 | 38 | 39 | -- -------------------------------------------------------- 40 | 41 | -- 42 | -- Table structure for table `tbl_users` 43 | -- 44 | 45 | CREATE TABLE `tbl_users` ( 46 | `userID` int(11) NOT NULL, 47 | `userName` varchar(100) NOT NULL, 48 | `userEmail` varchar(100) NOT NULL, 49 | `userPass` varchar(100) NOT NULL, 50 | `userStatus` enum('Y','N') NOT NULL DEFAULT 'N', 51 | `tokenCode` varchar(100) NOT NULL, 52 | `userBalance` decimal(10,0) NOT NULL 53 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 54 | 55 | 56 | -- 57 | -- Indexes for table `activity` 58 | -- 59 | ALTER TABLE `activity` 60 | ADD PRIMARY KEY (`id`), 61 | ADD KEY `toID` (`toEmail`), 62 | ADD KEY `fromID` (`fromEmail`); 63 | 64 | -- 65 | -- Indexes for table `tbl_users` 66 | -- 67 | ALTER TABLE `tbl_users` 68 | ADD PRIMARY KEY (`userID`), 69 | ADD UNIQUE KEY `userEmail` (`userEmail`); 70 | 71 | 72 | -- 73 | -- AUTO_INCREMENT for table `activity` 74 | -- 75 | ALTER TABLE `activity` 76 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; 77 | -- 78 | -- AUTO_INCREMENT for table `tbl_users` 79 | -- 80 | ALTER TABLE `tbl_users` 81 | MODIFY `userID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; 82 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 83 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 84 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 85 | -------------------------------------------------------------------------------- /bootstrap/css/datepicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Datepicker for Bootstrap 3 | * 4 | * Copyright 2012 Stefan Petre 5 | * Licensed under the Apache License v2.0 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | */ 9 | .datepicker { 10 | top: 0; 11 | left: 0; 12 | padding: 4px; 13 | margin-top: 1px; 14 | -webkit-border-radius: 4px; 15 | -moz-border-radius: 4px; 16 | border-radius: 4px; 17 | /*.dow { 18 | border-top: 1px solid #ddd !important; 19 | }*/ 20 | 21 | } 22 | .datepicker:before { 23 | content: ''; 24 | display: inline-block; 25 | border-left: 7px solid transparent; 26 | border-right: 7px solid transparent; 27 | border-bottom: 7px solid #ccc; 28 | border-bottom-color: rgba(0, 0, 0, 0.2); 29 | position: absolute; 30 | top: -7px; 31 | left: 6px; 32 | } 33 | .datepicker:after { 34 | content: ''; 35 | display: inline-block; 36 | border-left: 6px solid transparent; 37 | border-right: 6px solid transparent; 38 | border-bottom: 6px solid #ffffff; 39 | position: absolute; 40 | top: -6px; 41 | left: 7px; 42 | } 43 | .datepicker > div { 44 | display: none; 45 | } 46 | .datepicker table { 47 | width: 100%; 48 | margin: 0; 49 | } 50 | .datepicker td, 51 | .datepicker th { 52 | text-align: center; 53 | width: 20px; 54 | height: 20px; 55 | -webkit-border-radius: 4px; 56 | -moz-border-radius: 4px; 57 | border-radius: 4px; 58 | } 59 | .datepicker td.day:hover { 60 | background: #eeeeee; 61 | cursor: pointer; 62 | } 63 | .datepicker td.day.disabled { 64 | color: #eeeeee; 65 | } 66 | .datepicker td.old, 67 | .datepicker td.new { 68 | color: #999999; 69 | } 70 | .datepicker td.active, 71 | .datepicker td.active:hover { 72 | color: #ffffff; 73 | background-color: #006dcc; 74 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 75 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 76 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 77 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 78 | background-image: linear-gradient(to bottom, #0088cc, #0044cc); 79 | background-repeat: repeat-x; 80 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); 81 | border-color: #0044cc #0044cc #002a80; 82 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 83 | *background-color: #0044cc; 84 | /* Darken IE7 buttons by default so they stand out more given they won't have borders */ 85 | 86 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 87 | color: #fff; 88 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 89 | } 90 | .datepicker td.active:hover, 91 | .datepicker td.active:hover:hover, 92 | .datepicker td.active:focus, 93 | .datepicker td.active:hover:focus, 94 | .datepicker td.active:active, 95 | .datepicker td.active:hover:active, 96 | .datepicker td.active.active, 97 | .datepicker td.active:hover.active, 98 | .datepicker td.active.disabled, 99 | .datepicker td.active:hover.disabled, 100 | .datepicker td.active[disabled], 101 | .datepicker td.active:hover[disabled] { 102 | color: #ffffff; 103 | background-color: #0044cc; 104 | *background-color: #003bb3; 105 | } 106 | .datepicker td.active:active, 107 | .datepicker td.active:hover:active, 108 | .datepicker td.active.active, 109 | .datepicker td.active:hover.active { 110 | background-color: #003399 \9; 111 | } 112 | .datepicker td span { 113 | display: block; 114 | width: 47px; 115 | height: 54px; 116 | line-height: 54px; 117 | float: left; 118 | margin: 2px; 119 | cursor: pointer; 120 | -webkit-border-radius: 4px; 121 | -moz-border-radius: 4px; 122 | border-radius: 4px; 123 | } 124 | .datepicker td span:hover { 125 | background: #eeeeee; 126 | } 127 | .datepicker td span.active { 128 | color: #ffffff; 129 | background-color: #006dcc; 130 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 131 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 132 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 133 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 134 | background-image: linear-gradient(to bottom, #0088cc, #0044cc); 135 | background-repeat: repeat-x; 136 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); 137 | border-color: #0044cc #0044cc #002a80; 138 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 139 | *background-color: #0044cc; 140 | /* Darken IE7 buttons by default so they stand out more given they won't have borders */ 141 | 142 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 143 | color: #fff; 144 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 145 | } 146 | .datepicker td span.active:hover, 147 | .datepicker td span.active:focus, 148 | .datepicker td span.active:active, 149 | .datepicker td span.active.active, 150 | .datepicker td span.active.disabled, 151 | .datepicker td span.active[disabled] { 152 | color: #ffffff; 153 | background-color: #0044cc; 154 | *background-color: #003bb3; 155 | } 156 | .datepicker td span.active:active, 157 | .datepicker td span.active.active { 158 | background-color: #003399 \9; 159 | } 160 | .datepicker td span.old { 161 | color: #999999; 162 | } 163 | .datepicker th.switch { 164 | width: 145px; 165 | } 166 | .datepicker th.next, 167 | .datepicker th.prev { 168 | font-size: 21px; 169 | } 170 | .datepicker thead tr:first-child th { 171 | cursor: pointer; 172 | } 173 | .datepicker thead tr:first-child th:hover { 174 | background: #eeeeee; 175 | } 176 | .input-append.date .add-on i, 177 | .input-prepend.date .add-on i { 178 | display: block; 179 | cursor: pointer; 180 | width: 16px; 181 | height: 16px; 182 | } -------------------------------------------------------------------------------- /bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoc75/php-payment-gateway/2f49e66aa21aa7f457f56bdaaafde8cd8b4faefa/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoc75/php-payment-gateway/2f49e66aa21aa7f457f56bdaaafde8cd8b4faefa/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /bootstrap/js/moment.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoc75/php-payment-gateway/2f49e66aa21aa7f457f56bdaaafde8cd8b4faefa/bootstrap/js/moment.js -------------------------------------------------------------------------------- /class/class.error.php: -------------------------------------------------------------------------------- 1 | dbConnection(); 14 | $this->conn = $db; 15 | } 16 | 17 | 18 | 19 | function transfercash($sentemail,$pass,$recemail,$ccash,$cash,$content) 20 | { 21 | $password = md5($pass); 22 | $sentcash = $ccash - $cash; 23 | 24 | $stmt = $this->conn->prepare("SELECT * FROM tbl_users WHERE userEmail=:email_id"); 25 | $stmt->execute(array(":email_id"=>$recemail)); 26 | $userRow=$stmt->fetch(PDO::FETCH_ASSOC); 27 | $rececash = $cash + $userRow['userBalance']; 28 | 29 | if (!($cash > $ccash)) { 30 | if($stmt->rowCount() == 1) 31 | { 32 | if($sentemail != $recemail) 33 | { 34 | if($userRow['userPass']==$password) { 35 | $query = $this->conn->prepare("UPDATE tbl_users SET userBalance=:user_balance WHERE userEmail=:user_mail"); 36 | $query->bindparam(":user_mail",$sentemail); 37 | $query->bindparam(":user_balance",$sentcash); 38 | $query->execute(); 39 | 40 | $query = $this->conn->prepare("UPDATE tbl_users SET userBalance=:user_balance WHERE userEmail=:user_mail"); 41 | $query->bindparam(":user_mail",$recemail); 42 | $query->bindparam(":user_balance",$rececash); 43 | $query->execute(); 44 | 45 | $query = $this->conn->prepare("INSERT INTO activity (fromEmail,toEmail,content,cash,date) VALUES (:sentemail,:recemail,:content,:cash,:date)"); 46 | $query->bindparam(":sentemail",$sentemail); 47 | $query->bindparam(":recemail",$recemail); 48 | $query->bindparam(":content",$content); 49 | $query->bindparam(":cash",$cash); 50 | $query->bindparam(":date",date("Y-m-d")); 51 | $query->execute(); 52 | 53 | 54 | header("Location: transfer.php?success=4A"); 55 | exit; 56 | } 57 | else 58 | { 59 | header("Location: transfer.php?error=2B"); 60 | exit; 61 | } 62 | } 63 | else 64 | { 65 | header("Location: transfer.php?error=1A"); 66 | exit; 67 | } 68 | } 69 | else 70 | { 71 | header("Location: transfer.php?error=2A"); 72 | exit; 73 | } 74 | } 75 | else 76 | { 77 | header("Location: transfer.php?error=3A"); 78 | exit; 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /class/class.user.php: -------------------------------------------------------------------------------- 1 | dbConnection(); 14 | $this->conn = $db; 15 | } 16 | 17 | public function runQuery($sql) 18 | { 19 | $stmt = $this->conn->prepare($sql); 20 | return $stmt; 21 | } 22 | 23 | public function lasdID() 24 | { 25 | $stmt = $this->conn->lastInsertId(); 26 | return $stmt; 27 | } 28 | 29 | function emailtoname($email) 30 | { 31 | $stmt = $this->conn->prepare("SELECT * FROM tbl_users WHERE userEmail=:email"); 32 | $stmt->execute(array(":email"=>$email)); 33 | $userRow=$stmt->fetch(PDO::FETCH_ASSOC); 34 | return $userRow['userName']; 35 | } 36 | 37 | public function register($uname,$email,$upass,$code) 38 | { 39 | try 40 | { 41 | $password = md5($upass); 42 | $stmt = $this->conn->prepare("INSERT INTO tbl_users(userName,userEmail,userPass,tokenCode) 43 | VALUES(:user_name, :user_mail, :user_pass, :active_code)"); 44 | $stmt->bindparam(":user_name",$uname); 45 | $stmt->bindparam(":user_mail",$email); 46 | $stmt->bindparam(":user_pass",$password); 47 | $stmt->bindparam(":active_code",$code); 48 | $stmt->execute(); 49 | return $stmt; 50 | } 51 | catch(PDOException $ex) 52 | { 53 | echo $ex->getMessage(); 54 | } 55 | } 56 | 57 | 58 | public function login($email,$upass) 59 | { 60 | try 61 | { 62 | $stmt = $this->conn->prepare("SELECT * FROM tbl_users WHERE userEmail=:email_id"); 63 | $stmt->execute(array(":email_id"=>$email)); 64 | $userRow=$stmt->fetch(PDO::FETCH_ASSOC); 65 | 66 | if($stmt->rowCount() == 1) 67 | { 68 | if($userRow['userStatus']=="Y") 69 | { 70 | if($userRow['userPass']==md5($upass)) 71 | { 72 | $_SESSION['userSession'] = $userRow['userID']; 73 | return true; 74 | } 75 | else 76 | { 77 | header("Location: login.php?error=2B"); 78 | exit; 79 | } 80 | } 81 | else 82 | { 83 | header("Location: login.php?error=3B"); 84 | exit; 85 | } 86 | } 87 | else 88 | { 89 | header("Location: login.php?error=1B"); 90 | exit; 91 | } 92 | } 93 | catch(PDOException $ex) 94 | { 95 | echo $ex->getMessage(); 96 | } 97 | } 98 | 99 | 100 | public function is_logged_in() 101 | { 102 | if(isset($_SESSION['userSession'])) 103 | { 104 | return true; 105 | } 106 | } 107 | 108 | public function redirect($url) 109 | { 110 | header("Location: $url"); 111 | } 112 | 113 | public function logout() 114 | { 115 | session_destroy(); 116 | $_SESSION['userSession'] = false; 117 | } 118 | 119 | function send_mail($email,$message,$subject) 120 | { 121 | require_once('mailer/class.phpmailer.php'); 122 | $mail = new PHPMailer(); 123 | $mail->IsSMTP(); 124 | $mail->SMTPDebug = 0; 125 | $mail->SMTPAuth = true; 126 | $mail->SMTPSecure = "ssl"; 127 | $mail->Host = "smtp.gmail.com"; 128 | $mail->Port = 465; 129 | $mail->AddAddress($email); 130 | $mail->Username="your_gmail_id_here@gmail.com"; 131 | $mail->Password="your_gmail_password_here"; 132 | $mail->SetFrom('your_gmail_id_here@gmail.com','Coding Cage'); 133 | $mail->AddReplyTo("your_gmail_id_here@gmail.com","Coding Cage"); 134 | $mail->Subject = $subject; 135 | $mail->MsgHTML($message); 136 | $mail->Send(); 137 | } 138 | } -------------------------------------------------------------------------------- /config/dbconfig.php: -------------------------------------------------------------------------------- 1 | conn = null; 15 | try 16 | { 17 | $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password); 18 | $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 19 | $this->conn->exec("set names utf8"); 20 | } 21 | catch(PDOException $exception) 22 | { 23 | echo "Connection error: " . $exception->getMessage(); 24 | } 25 | 26 | return $this->conn; 27 | } 28 | } 29 | $url_path = "YOUR WEBSITE PATH HERE" 30 | ?> -------------------------------------------------------------------------------- /fpass.php: -------------------------------------------------------------------------------- 1 | is_logged_in()!="") 11 | { 12 | $user->redirect('home.php'); 13 | } 14 | 15 | if(isset($_POST['btn-submit'])) 16 | { 17 | $email = $_POST['txtemail']; 18 | if(filter_var($email,FILTER_VALIDATE_EMAIL)) 19 | { 20 | $stmt = $user->runQuery("SELECT userID FROM tbl_users WHERE userEmail=:email LIMIT 1"); 21 | $stmt->execute(array(":email"=>$email)); 22 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 23 | if($stmt->rowCount() == 1) 24 | { 25 | $id = base64_encode($row['userID']); 26 | $code = md5(uniqid(rand())); 27 | 28 | $stmt = $user->runQuery("UPDATE tbl_users SET tokenCode=:token WHERE userEmail=:email"); 29 | $stmt->execute(array(":token"=>$code,"email"=>$email)); 30 | 31 | $message= " 32 | Hello , $email 33 |

34 | We got requested to reset your password, if you do this then just click the following link to reset your password, if not just ignore this email, 35 |

36 | Click Following Link To Reset Your Password 37 |

38 | click here to reset your password 39 |

40 | thank you :) 41 | "; 42 | $subject = "Password Reset"; 43 | 44 | $user->send_mail($email,$message,$subject); 45 | header("Location: fpass.php?success=7B"); 46 | exit; 47 | } 48 | else 49 | { 50 | header("Location: fpass.php?success=7B"); 51 | exit; 52 | } 53 | } 54 | else 55 | { 56 | header("Location: fpass.php?error=2C"); 57 | exit; 58 | } 59 | 60 | 61 | } 62 | ?> 63 | 64 | 65 | 66 | 67 | Forgot Password 68 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 |
79 | 80 |
81 |
82 | 86 |
87 | 88 | ectt($_GET['error']); ?> 89 |
90 | 93 | 97 |
98 | 99 | ectt($_GET['success']); ?> 100 |
101 | 104 | 105 | 106 |
107 | 108 |
109 | 110 |
111 | 112 | 113 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | is_logged_in()!="") 11 | { 12 | $user_login->redirect('my/home.php'); 13 | } 14 | 15 | if(isset($_POST['btn-login'])) 16 | { 17 | $email = addslashes($_POST['txtemail']); 18 | $upass = addslashes($_POST['txtupass']); 19 | if(filter_var($email,FILTER_VALIDATE_EMAIL)) { 20 | if($user_login->login($email,$upass)) 21 | { 22 | $user_login->redirect('my/home.php'); 23 | } 24 | } 25 | else 26 | { 27 | header("Location: login.php?error=2C"); 28 | } 29 | 30 | } 31 | 32 | ?> 33 | 34 | 35 | 36 | 37 | Login | Coding Cage 38 | 39 | 40 | 41 | 42 | 43 | 46 | 47 | 48 | 49 |
50 |
51 | exist($_GET['error'])) 54 | { 55 | ?> 56 |
57 | 58 | ectt($_GET['error']); ?> 59 |
60 | 63 | exist($_GET['success'])) 66 | { 67 | ?> 68 |
69 | 70 | ectt($_GET['success']); ?> 71 |
72 | 75 |
76 | 77 | 78 |
79 | 80 | Sign Up
81 | Lost your Password ? 82 |
83 | 84 |
85 | 86 | 87 | -------------------------------------------------------------------------------- /mailer/PHPMailerAutoload.php: -------------------------------------------------------------------------------- 1 | 8 | * @author Jim Jagielski (jimjag) 9 | * @author Andy Prevost (codeworxtech) 10 | * @author Brent R. Matzelle (original founder) 11 | * @copyright 2012 - 2014 Marcus Bointon 12 | * @copyright 2010 - 2012 Jim Jagielski 13 | * @copyright 2004 - 2009 Andy Prevost 14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License 15 | * @note This program is distributed in the hope that it will be useful - WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /** 21 | * PHPMailer SPL autoloader. 22 | * @param string $classname The name of the class to load 23 | */ 24 | function PHPMailerAutoload($classname) 25 | { 26 | //Can't use __DIR__ as it's only in PHP 5.3+ 27 | $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; 28 | if (is_readable($filename)) { 29 | require $filename; 30 | } 31 | } 32 | 33 | if (version_compare(PHP_VERSION, '5.1.2', '>=')) { 34 | //SPL autoloading was introduced in PHP 5.1.2 35 | if (version_compare(PHP_VERSION, '5.3.0', '>=')) { 36 | spl_autoload_register('PHPMailerAutoload', true, true); 37 | } else { 38 | spl_autoload_register('PHPMailerAutoload'); 39 | } 40 | } else { 41 | /** 42 | * Fall back to traditional autoload for old PHP versions 43 | * @param string $classname The name of the class to load 44 | */ 45 | function __autoload($classname) 46 | { 47 | PHPMailerAutoload($classname); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mailer/README.md: -------------------------------------------------------------------------------- 1 | ![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png) 2 | 3 | # PHPMailer - A full-featured email creation and transfer class for PHP 4 | 5 | Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer) 6 | [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) 7 | [![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) 8 | 9 | [![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) 10 | 11 | ## Class Features 12 | 13 | - Probably the world's most popular code for sending email from PHP! 14 | - Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more 15 | - Integrated SMTP support - send without a local mail server 16 | - Send emails with multiple TOs, CCs, BCCs and REPLY-TOs 17 | - Multipart/alternative emails for mail clients that do not read HTML email 18 | - Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings 19 | - SMTP authentication with LOGIN, PLAIN, NTLM, CRAM-MD5 and Google's XOAUTH2 mechanisms over SSL and TLS transports 20 | - Error messages in 47 languages! 21 | - DKIM and S/MIME signing support 22 | - Compatible with PHP 5.0 and later 23 | - Much more! 24 | 25 | ## Why you might need it 26 | 27 | Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments. 28 | 29 | Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong! 30 | *Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc. 31 | 32 | The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server. 33 | 34 | ## License 35 | 36 | This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license. Please read LICENSE for information on the 37 | software availability and distribution. 38 | 39 | ## Installation & loading 40 | 41 | PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), so just add this line to your `composer.json` file: 42 | 43 | ```json 44 | "phpmailer/phpmailer": "~5.2" 45 | ``` 46 | 47 | or 48 | 49 | ```sh 50 | composer require phpmailer/phpmailer 51 | ``` 52 | 53 | If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package. 54 | 55 | Alternatively, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub. 56 | 57 | If you're not using composer's autoloader, PHPMailer provides an SPL-compatible autoloader, and that is the preferred way of loading the library - just `require '/path/to/PHPMailerAutoload.php';` and everything should work. The autoloader does not throw errors if it can't find classes so it prepends itself to the SPL list, allowing your own (or your framework's) autoloader to catch errors. SPL autoloading was introduced in PHP 5.1.0, so if you are using a version older than that you will need to require/include each class manually. 58 | 59 | PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3. 60 | 61 | If you want to use Google's XOAUTH2 authentication mechanism, you need to be running at least PHP 5.4, and load the dependencies listed in `composer.json`. 62 | 63 | ### Minimal installation 64 | 65 | While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [class.phpmailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.pop3.php). For all of these, we recommend you use [the autoloader](https://github.com/PHPMailer/PHPMailer/tree/master/PHPMailerAutoload.php) too as otherwise you will either have to `require` all classes manually or use some other autoloader. You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. You may need the additional classes in the [extras](extras/) folder if you are using those features, including NTLM authentication and ics generation. If you're using Google XOAUTH2 you will need `class.phpmaileroauth.php` and `class.oauth.php` classes too, as well as the composer dependencies. 66 | 67 | ## A Simple Example 68 | 69 | ```php 70 | SMTPDebug = 3; // Enable verbose debug output 76 | 77 | $mail->isSMTP(); // Set mailer to use SMTP 78 | $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers 79 | $mail->SMTPAuth = true; // Enable SMTP authentication 80 | $mail->Username = 'user@example.com'; // SMTP username 81 | $mail->Password = 'secret'; // SMTP password 82 | $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted 83 | $mail->Port = 587; // TCP port to connect to 84 | 85 | $mail->setFrom('from@example.com', 'Mailer'); 86 | $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient 87 | $mail->addAddress('ellen@example.com'); // Name is optional 88 | $mail->addReplyTo('info@example.com', 'Information'); 89 | $mail->addCC('cc@example.com'); 90 | $mail->addBCC('bcc@example.com'); 91 | 92 | $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments 93 | $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name 94 | $mail->isHTML(true); // Set email format to HTML 95 | 96 | $mail->Subject = 'Here is the subject'; 97 | $mail->Body = 'This is the HTML message body in bold!'; 98 | $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 99 | 100 | if(!$mail->send()) { 101 | echo 'Message could not be sent.'; 102 | echo 'Mailer Error: ' . $mail->ErrorInfo; 103 | } else { 104 | echo 'Message has been sent'; 105 | } 106 | ``` 107 | 108 | You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. 109 | 110 | That's it. You should now be ready to use PHPMailer! 111 | 112 | ## Localization 113 | PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find numerous (46 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: 114 | 115 | ```php 116 | // To load the French version 117 | $mail->setLanguage('fr', '/optional/path/to/language/directory/'); 118 | ``` 119 | 120 | We welcome corrections and new languages - if you're looking for corrections to do, run the [phpmailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations. 121 | 122 | ## Documentation 123 | 124 | Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps). 125 | 126 | There are tips and a troubleshooting guide in the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated. 127 | 128 | Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/). 129 | 130 | You'll find some basic user-level docs in the [docs](docs/) folder, and you can generate complete API-level documentation using the [generatedocs.sh](https://github.com/PHPMailer/PHPMailer/tree/master/docs/generatedocs.sh) shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerTest.php) a good source of how to do various operations such as encryption. 131 | 132 | If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). 133 | 134 | ## Tests 135 | 136 | There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder. 137 | 138 | Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer) 139 | 140 | If this isn't passing, is there something you can do to help? 141 | 142 | ## Security 143 | 144 | Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately. 145 | 146 | PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=) an SMTP CRLF injection bug permitting arbitrary message sending. 147 | 148 | PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file. 149 | 150 | See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY) for older security issues. 151 | 152 | ## Contributing 153 | 154 | Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). 155 | 156 | We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. 157 | 158 | With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone: 159 | 160 | ```sh 161 | git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git 162 | ``` 163 | 164 | Please *don't* use the SourceForge or Google Code projects any more. 165 | 166 | ## Sponsorship 167 | 168 | Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system. 169 | 170 | Smartmessages email marketing 171 | 172 | Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. 173 | 174 | ## Changelog 175 | 176 | See [changelog](changelog.md). 177 | 178 | ## History 179 | - PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). 180 | - Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004. 181 | - Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. 182 | - Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer). 183 | - Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer. 184 | - PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub. 185 | 186 | ### What's changed since moving from SourceForge? 187 | - Official successor to the SourceForge and Google Code projects. 188 | - Test suite. 189 | - Continuous integration with Travis-CI. 190 | - Composer support. 191 | - Public development. 192 | - Additional languages and language strings. 193 | - CRAM-MD5 authentication support. 194 | - Preserves full repo history of authors, commits and branches from the original SourceForge project. 195 | -------------------------------------------------------------------------------- /mailer/SECURITY: -------------------------------------------------------------------------------- 1 | # Security notices relating to PHPMailer 2 | 3 | Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately. 4 | 5 | PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=) an SMTP CRLF injection bug permitting arbitrary message sending. 6 | 7 | PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file. 8 | 9 | PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack. 10 | 11 | Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747). 12 | 13 | PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734). 14 | 15 | PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807). 16 | 17 | PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215). 18 | 19 | -------------------------------------------------------------------------------- /mailer/VERSION: -------------------------------------------------------------------------------- 1 | 5.2.16 -------------------------------------------------------------------------------- /mailer/class.phpmaileroauth.php: -------------------------------------------------------------------------------- 1 | 8 | * @author Jim Jagielski (jimjag) 9 | * @author Andy Prevost (codeworxtech) 10 | * @author Brent R. Matzelle (original founder) 11 | * @copyright 2012 - 2014 Marcus Bointon 12 | * @copyright 2010 - 2012 Jim Jagielski 13 | * @copyright 2004 - 2009 Andy Prevost 14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License 15 | * @note This program is distributed in the hope that it will be useful - WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /** 21 | * PHPMailerOAuth - PHPMailer subclass adding OAuth support. 22 | * @package PHPMailer 23 | * @author @sherryl4george 24 | * @author Marcus Bointon (@Synchro) 25 | */ 26 | class PHPMailerOAuth extends PHPMailer 27 | { 28 | /** 29 | * The OAuth user's email address 30 | * @var string 31 | */ 32 | public $oauthUserEmail = ''; 33 | 34 | /** 35 | * The OAuth refresh token 36 | * @var string 37 | */ 38 | public $oauthRefreshToken = ''; 39 | 40 | /** 41 | * The OAuth client ID 42 | * @var string 43 | */ 44 | public $oauthClientId = ''; 45 | 46 | /** 47 | * The OAuth client secret 48 | * @var string 49 | */ 50 | public $oauthClientSecret = ''; 51 | 52 | /** 53 | * An instance of the PHPMailerOAuthGoogle class. 54 | * @var PHPMailerOAuthGoogle 55 | * @access protected 56 | */ 57 | protected $oauth = null; 58 | 59 | /** 60 | * Get a PHPMailerOAuthGoogle instance to use. 61 | * @return PHPMailerOAuthGoogle 62 | */ 63 | public function getOAUTHInstance() 64 | { 65 | if (!is_object($this->oauth)) { 66 | $this->oauth = new PHPMailerOAuthGoogle( 67 | $this->oauthUserEmail, 68 | $this->oauthClientSecret, 69 | $this->oauthClientId, 70 | $this->oauthRefreshToken 71 | ); 72 | } 73 | return $this->oauth; 74 | } 75 | 76 | /** 77 | * Initiate a connection to an SMTP server. 78 | * Overrides the original smtpConnect method to add support for OAuth. 79 | * @param array $options An array of options compatible with stream_context_create() 80 | * @uses SMTP 81 | * @access public 82 | * @return bool 83 | */ 84 | public function smtpConnect($options = array()) 85 | { 86 | if (is_null($this->smtp)) { 87 | $this->smtp = $this->getSMTPInstance(); 88 | } 89 | 90 | if (is_null($this->oauth)) { 91 | $this->oauth = $this->getOAUTHInstance(); 92 | } 93 | 94 | // Already connected? 95 | if ($this->smtp->connected()) { 96 | return true; 97 | } 98 | 99 | $this->smtp->setTimeout($this->Timeout); 100 | $this->smtp->setDebugLevel($this->SMTPDebug); 101 | $this->smtp->setDebugOutput($this->Debugoutput); 102 | $this->smtp->setVerp($this->do_verp); 103 | $hosts = explode(';', $this->Host); 104 | $lastexception = null; 105 | 106 | foreach ($hosts as $hostentry) { 107 | $hostinfo = array(); 108 | if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { 109 | // Not a valid host entry 110 | continue; 111 | } 112 | // $hostinfo[2]: optional ssl or tls prefix 113 | // $hostinfo[3]: the hostname 114 | // $hostinfo[4]: optional port number 115 | // The host string prefix can temporarily override the current setting for SMTPSecure 116 | // If it's not specified, the default value is used 117 | $prefix = ''; 118 | $secure = $this->SMTPSecure; 119 | $tls = ($this->SMTPSecure == 'tls'); 120 | if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) { 121 | $prefix = 'ssl://'; 122 | $tls = false; // Can't have SSL and TLS at the same time 123 | $secure = 'ssl'; 124 | } elseif ($hostinfo[2] == 'tls') { 125 | $tls = true; 126 | // tls doesn't use a prefix 127 | $secure = 'tls'; 128 | } 129 | //Do we need the OpenSSL extension? 130 | $sslext = defined('OPENSSL_ALGO_SHA1'); 131 | if ('tls' === $secure or 'ssl' === $secure) { 132 | //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled 133 | if (!$sslext) { 134 | throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL); 135 | } 136 | } 137 | $host = $hostinfo[3]; 138 | $port = $this->Port; 139 | $tport = (integer)$hostinfo[4]; 140 | if ($tport > 0 and $tport < 65536) { 141 | $port = $tport; 142 | } 143 | if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { 144 | try { 145 | if ($this->Helo) { 146 | $hello = $this->Helo; 147 | } else { 148 | $hello = $this->serverHostname(); 149 | } 150 | $this->smtp->hello($hello); 151 | //Automatically enable TLS encryption if: 152 | // * it's not disabled 153 | // * we have openssl extension 154 | // * we are not already using SSL 155 | // * the server offers STARTTLS 156 | if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) { 157 | $tls = true; 158 | } 159 | if ($tls) { 160 | if (!$this->smtp->startTLS()) { 161 | throw new phpmailerException($this->lang('connect_host')); 162 | } 163 | // We must resend HELO after tls negotiation 164 | $this->smtp->hello($hello); 165 | } 166 | if ($this->SMTPAuth) { 167 | if (!$this->smtp->authenticate( 168 | $this->Username, 169 | $this->Password, 170 | $this->AuthType, 171 | $this->Realm, 172 | $this->Workstation, 173 | $this->oauth 174 | ) 175 | ) { 176 | throw new phpmailerException($this->lang('authenticate')); 177 | } 178 | } 179 | return true; 180 | } catch (phpmailerException $exc) { 181 | $lastexception = $exc; 182 | $this->edebug($exc->getMessage()); 183 | // We must have connected, but then failed TLS or Auth, so close connection nicely 184 | $this->smtp->quit(); 185 | } 186 | } 187 | } 188 | // If we get here, all connection attempts have failed, so close connection hard 189 | $this->smtp->close(); 190 | // As we've caught all exceptions, just report whatever the last one was 191 | if ($this->exceptions and !is_null($lastexception)) { 192 | throw $lastexception; 193 | } 194 | return false; 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /mailer/class.phpmaileroauthgoogle.php: -------------------------------------------------------------------------------- 1 | 8 | * @author Jim Jagielski (jimjag) 9 | * @author Andy Prevost (codeworxtech) 10 | * @author Brent R. Matzelle (original founder) 11 | * @copyright 2012 - 2014 Marcus Bointon 12 | * @copyright 2010 - 2012 Jim Jagielski 13 | * @copyright 2004 - 2009 Andy Prevost 14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License 15 | * @note This program is distributed in the hope that it will be useful - WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /** 21 | * PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider. 22 | * @package PHPMailer 23 | * @author @sherryl4george 24 | * @author Marcus Bointon (@Synchro) 25 | * @link https://github.com/thephpleague/oauth2-client 26 | */ 27 | class PHPMailerOAuthGoogle 28 | { 29 | private $oauthUserEmail = ''; 30 | private $oauthRefreshToken = ''; 31 | private $oauthClientId = ''; 32 | private $oauthClientSecret = ''; 33 | 34 | /** 35 | * @param string $UserEmail 36 | * @param string $ClientSecret 37 | * @param string $ClientId 38 | * @param string $RefreshToken 39 | */ 40 | public function __construct( 41 | $UserEmail, 42 | $ClientSecret, 43 | $ClientId, 44 | $RefreshToken 45 | ) { 46 | $this->oauthClientId = $ClientId; 47 | $this->oauthClientSecret = $ClientSecret; 48 | $this->oauthRefreshToken = $RefreshToken; 49 | $this->oauthUserEmail = $UserEmail; 50 | } 51 | 52 | private function getProvider() 53 | { 54 | return new League\OAuth2\Client\Provider\Google([ 55 | 'clientId' => $this->oauthClientId, 56 | 'clientSecret' => $this->oauthClientSecret 57 | ]); 58 | } 59 | 60 | private function getGrant() 61 | { 62 | return new \League\OAuth2\Client\Grant\RefreshToken(); 63 | } 64 | 65 | private function getToken() 66 | { 67 | $provider = $this->getProvider(); 68 | $grant = $this->getGrant(); 69 | return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]); 70 | } 71 | 72 | public function getOauth64() 73 | { 74 | $token = $this->getToken(); 75 | return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001"); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /mailer/class.pop3.php: -------------------------------------------------------------------------------- 1 | 8 | * @author Jim Jagielski (jimjag) 9 | * @author Andy Prevost (codeworxtech) 10 | * @author Brent R. Matzelle (original founder) 11 | * @copyright 2012 - 2014 Marcus Bointon 12 | * @copyright 2010 - 2012 Jim Jagielski 13 | * @copyright 2004 - 2009 Andy Prevost 14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License 15 | * @note This program is distributed in the hope that it will be useful - WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /** 21 | * PHPMailer POP-Before-SMTP Authentication Class. 22 | * Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication. 23 | * Does not support APOP. 24 | * @package PHPMailer 25 | * @author Richard Davey (original author) 26 | * @author Marcus Bointon (Synchro/coolbru) 27 | * @author Jim Jagielski (jimjag) 28 | * @author Andy Prevost (codeworxtech) 29 | */ 30 | class POP3 31 | { 32 | /** 33 | * The POP3 PHPMailer Version number. 34 | * @var string 35 | * @access public 36 | */ 37 | public $Version = '5.2.16'; 38 | 39 | /** 40 | * Default POP3 port number. 41 | * @var integer 42 | * @access public 43 | */ 44 | public $POP3_PORT = 110; 45 | 46 | /** 47 | * Default timeout in seconds. 48 | * @var integer 49 | * @access public 50 | */ 51 | public $POP3_TIMEOUT = 30; 52 | 53 | /** 54 | * POP3 Carriage Return + Line Feed. 55 | * @var string 56 | * @access public 57 | * @deprecated Use the constant instead 58 | */ 59 | public $CRLF = "\r\n"; 60 | 61 | /** 62 | * Debug display level. 63 | * Options: 0 = no, 1+ = yes 64 | * @var integer 65 | * @access public 66 | */ 67 | public $do_debug = 0; 68 | 69 | /** 70 | * POP3 mail server hostname. 71 | * @var string 72 | * @access public 73 | */ 74 | public $host; 75 | 76 | /** 77 | * POP3 port number. 78 | * @var integer 79 | * @access public 80 | */ 81 | public $port; 82 | 83 | /** 84 | * POP3 Timeout Value in seconds. 85 | * @var integer 86 | * @access public 87 | */ 88 | public $tval; 89 | 90 | /** 91 | * POP3 username 92 | * @var string 93 | * @access public 94 | */ 95 | public $username; 96 | 97 | /** 98 | * POP3 password. 99 | * @var string 100 | * @access public 101 | */ 102 | public $password; 103 | 104 | /** 105 | * Resource handle for the POP3 connection socket. 106 | * @var resource 107 | * @access protected 108 | */ 109 | protected $pop_conn; 110 | 111 | /** 112 | * Are we connected? 113 | * @var boolean 114 | * @access protected 115 | */ 116 | protected $connected = false; 117 | 118 | /** 119 | * Error container. 120 | * @var array 121 | * @access protected 122 | */ 123 | protected $errors = array(); 124 | 125 | /** 126 | * Line break constant 127 | */ 128 | const CRLF = "\r\n"; 129 | 130 | /** 131 | * Simple static wrapper for all-in-one POP before SMTP 132 | * @param $host 133 | * @param integer|boolean $port The port number to connect to 134 | * @param integer|boolean $timeout The timeout value 135 | * @param string $username 136 | * @param string $password 137 | * @param integer $debug_level 138 | * @return boolean 139 | */ 140 | public static function popBeforeSmtp( 141 | $host, 142 | $port = false, 143 | $timeout = false, 144 | $username = '', 145 | $password = '', 146 | $debug_level = 0 147 | ) { 148 | $pop = new POP3; 149 | return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level); 150 | } 151 | 152 | /** 153 | * Authenticate with a POP3 server. 154 | * A connect, login, disconnect sequence 155 | * appropriate for POP-before SMTP authorisation. 156 | * @access public 157 | * @param string $host The hostname to connect to 158 | * @param integer|boolean $port The port number to connect to 159 | * @param integer|boolean $timeout The timeout value 160 | * @param string $username 161 | * @param string $password 162 | * @param integer $debug_level 163 | * @return boolean 164 | */ 165 | public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) 166 | { 167 | $this->host = $host; 168 | // If no port value provided, use default 169 | if (false === $port) { 170 | $this->port = $this->POP3_PORT; 171 | } else { 172 | $this->port = (integer)$port; 173 | } 174 | // If no timeout value provided, use default 175 | if (false === $timeout) { 176 | $this->tval = $this->POP3_TIMEOUT; 177 | } else { 178 | $this->tval = (integer)$timeout; 179 | } 180 | $this->do_debug = $debug_level; 181 | $this->username = $username; 182 | $this->password = $password; 183 | // Reset the error log 184 | $this->errors = array(); 185 | // connect 186 | $result = $this->connect($this->host, $this->port, $this->tval); 187 | if ($result) { 188 | $login_result = $this->login($this->username, $this->password); 189 | if ($login_result) { 190 | $this->disconnect(); 191 | return true; 192 | } 193 | } 194 | // We need to disconnect regardless of whether the login succeeded 195 | $this->disconnect(); 196 | return false; 197 | } 198 | 199 | /** 200 | * Connect to a POP3 server. 201 | * @access public 202 | * @param string $host 203 | * @param integer|boolean $port 204 | * @param integer $tval 205 | * @return boolean 206 | */ 207 | public function connect($host, $port = false, $tval = 30) 208 | { 209 | // Are we already connected? 210 | if ($this->connected) { 211 | return true; 212 | } 213 | 214 | //On Windows this will raise a PHP Warning error if the hostname doesn't exist. 215 | //Rather than suppress it with @fsockopen, capture it cleanly instead 216 | set_error_handler(array($this, 'catchWarning')); 217 | 218 | if (false === $port) { 219 | $port = $this->POP3_PORT; 220 | } 221 | 222 | // connect to the POP3 server 223 | $this->pop_conn = fsockopen( 224 | $host, // POP3 Host 225 | $port, // Port # 226 | $errno, // Error Number 227 | $errstr, // Error Message 228 | $tval 229 | ); // Timeout (seconds) 230 | // Restore the error handler 231 | restore_error_handler(); 232 | 233 | // Did we connect? 234 | if (false === $this->pop_conn) { 235 | // It would appear not... 236 | $this->setError(array( 237 | 'error' => "Failed to connect to server $host on port $port", 238 | 'errno' => $errno, 239 | 'errstr' => $errstr 240 | )); 241 | return false; 242 | } 243 | 244 | // Increase the stream time-out 245 | stream_set_timeout($this->pop_conn, $tval, 0); 246 | 247 | // Get the POP3 server response 248 | $pop3_response = $this->getResponse(); 249 | // Check for the +OK 250 | if ($this->checkResponse($pop3_response)) { 251 | // The connection is established and the POP3 server is talking 252 | $this->connected = true; 253 | return true; 254 | } 255 | return false; 256 | } 257 | 258 | /** 259 | * Log in to the POP3 server. 260 | * Does not support APOP (RFC 2828, 4949). 261 | * @access public 262 | * @param string $username 263 | * @param string $password 264 | * @return boolean 265 | */ 266 | public function login($username = '', $password = '') 267 | { 268 | if (!$this->connected) { 269 | $this->setError('Not connected to POP3 server'); 270 | } 271 | if (empty($username)) { 272 | $username = $this->username; 273 | } 274 | if (empty($password)) { 275 | $password = $this->password; 276 | } 277 | 278 | // Send the Username 279 | $this->sendString("USER $username" . self::CRLF); 280 | $pop3_response = $this->getResponse(); 281 | if ($this->checkResponse($pop3_response)) { 282 | // Send the Password 283 | $this->sendString("PASS $password" . self::CRLF); 284 | $pop3_response = $this->getResponse(); 285 | if ($this->checkResponse($pop3_response)) { 286 | return true; 287 | } 288 | } 289 | return false; 290 | } 291 | 292 | /** 293 | * Disconnect from the POP3 server. 294 | * @access public 295 | */ 296 | public function disconnect() 297 | { 298 | $this->sendString('QUIT'); 299 | //The QUIT command may cause the daemon to exit, which will kill our connection 300 | //So ignore errors here 301 | try { 302 | @fclose($this->pop_conn); 303 | } catch (Exception $e) { 304 | //Do nothing 305 | }; 306 | } 307 | 308 | /** 309 | * Get a response from the POP3 server. 310 | * $size is the maximum number of bytes to retrieve 311 | * @param integer $size 312 | * @return string 313 | * @access protected 314 | */ 315 | protected function getResponse($size = 128) 316 | { 317 | $response = fgets($this->pop_conn, $size); 318 | if ($this->do_debug >= 1) { 319 | echo "Server -> Client: $response"; 320 | } 321 | return $response; 322 | } 323 | 324 | /** 325 | * Send raw data to the POP3 server. 326 | * @param string $string 327 | * @return integer 328 | * @access protected 329 | */ 330 | protected function sendString($string) 331 | { 332 | if ($this->pop_conn) { 333 | if ($this->do_debug >= 2) { //Show client messages when debug >= 2 334 | echo "Client -> Server: $string"; 335 | } 336 | return fwrite($this->pop_conn, $string, strlen($string)); 337 | } 338 | return 0; 339 | } 340 | 341 | /** 342 | * Checks the POP3 server response. 343 | * Looks for for +OK or -ERR. 344 | * @param string $string 345 | * @return boolean 346 | * @access protected 347 | */ 348 | protected function checkResponse($string) 349 | { 350 | if (substr($string, 0, 3) !== '+OK') { 351 | $this->setError(array( 352 | 'error' => "Server reported an error: $string", 353 | 'errno' => 0, 354 | 'errstr' => '' 355 | )); 356 | return false; 357 | } else { 358 | return true; 359 | } 360 | } 361 | 362 | /** 363 | * Add an error to the internal error store. 364 | * Also display debug output if it's enabled. 365 | * @param $error 366 | * @access protected 367 | */ 368 | protected function setError($error) 369 | { 370 | $this->errors[] = $error; 371 | if ($this->do_debug >= 1) { 372 | echo '
';
373 |             foreach ($this->errors as $error) {
374 |                 print_r($error);
375 |             }
376 |             echo '
'; 377 | } 378 | } 379 | 380 | /** 381 | * Get an array of error messages, if any. 382 | * @return array 383 | */ 384 | public function getErrors() 385 | { 386 | return $this->errors; 387 | } 388 | 389 | /** 390 | * POP3 connection error handler. 391 | * @param integer $errno 392 | * @param string $errstr 393 | * @param string $errfile 394 | * @param integer $errline 395 | * @access protected 396 | */ 397 | protected function catchWarning($errno, $errstr, $errfile, $errline) 398 | { 399 | $this->setError(array( 400 | 'error' => "Connecting to the POP3 server raised a PHP warning: ", 401 | 'errno' => $errno, 402 | 'errstr' => $errstr, 403 | 'errfile' => $errfile, 404 | 'errline' => $errline 405 | )); 406 | } 407 | } 408 | -------------------------------------------------------------------------------- /mailer/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpmailer/phpmailer", 3 | "type": "library", 4 | "description": "PHPMailer is a full-featured email creation and transfer class for PHP", 5 | "authors": [ 6 | { 7 | "name": "Marcus Bointon", 8 | "email": "phpmailer@synchromedia.co.uk" 9 | }, 10 | { 11 | "name": "Jim Jagielski", 12 | "email": "jimjag@gmail.com" 13 | }, 14 | { 15 | "name": "Andy Prevost", 16 | "email": "codeworxtech@users.sourceforge.net" 17 | }, 18 | { 19 | "name": "Brent R. Matzelle" 20 | } 21 | ], 22 | "require": { 23 | "php": ">=5.0.0" 24 | }, 25 | "require-dev": { 26 | "phpdocumentor/phpdocumentor": "*", 27 | "phpunit/phpunit": "4.7.*" 28 | }, 29 | "suggest": { 30 | "league/oauth2-google": "Needed for Google XOAUTH2 authentication" 31 | }, 32 | "autoload": { 33 | "classmap": [ 34 | "class.phpmailer.php", 35 | "class.phpmaileroauth.php", 36 | "class.phpmaileroauthgoogle.php", 37 | "class.smtp.php", 38 | "class.pop3.php", 39 | "extras/EasyPeasyICS.php", 40 | "extras/ntlm_sasl_client.php" 41 | ] 42 | }, 43 | "license": "LGPL-2.1" 44 | } 45 | -------------------------------------------------------------------------------- /mailer/extras/EasyPeasyICS.php: -------------------------------------------------------------------------------- 1 | 5 | * @author Manuel Reinhard 6 | * 7 | * Built with inspiration from 8 | * http://stackoverflow.com/questions/1463480/how-can-i-use-php-to-dynamically-publish-an-ical-file-to-be-read-by-google-calend/1464355#1464355 9 | * History: 10 | * 2010/12/17 - Manuel Reinhard - when it all started 11 | * 2014 PHPMailer project becomes maintainer 12 | */ 13 | 14 | /** 15 | * Class EasyPeasyICS. 16 | * Simple ICS data generator 17 | * @package phpmailer 18 | * @subpackage easypeasyics 19 | */ 20 | class EasyPeasyICS 21 | { 22 | /** 23 | * The name of the calendar 24 | * @var string 25 | */ 26 | protected $calendarName; 27 | /** 28 | * The array of events to add to this calendar 29 | * @var array 30 | */ 31 | protected $events = array(); 32 | 33 | /** 34 | * Constructor 35 | * @param string $calendarName 36 | */ 37 | public function __construct($calendarName = "") 38 | { 39 | $this->calendarName = $calendarName; 40 | } 41 | 42 | /** 43 | * Add an event to this calendar. 44 | * @param string $start The start date and time as a unix timestamp 45 | * @param string $end The end date and time as a unix timestamp 46 | * @param string $summary A summary or title for the event 47 | * @param string $description A description of the event 48 | * @param string $url A URL for the event 49 | * @param string $uid A unique identifier for the event - generated automatically if not provided 50 | * @return array An array of event details, including any generated UID 51 | */ 52 | public function addEvent($start, $end, $summary = '', $description = '', $url = '', $uid = '') 53 | { 54 | if (empty($uid)) { 55 | $uid = md5(uniqid(mt_rand(), true)) . '@EasyPeasyICS'; 56 | } 57 | $event = array( 58 | 'start' => gmdate('Ymd', $start) . 'T' . gmdate('His', $start) . 'Z', 59 | 'end' => gmdate('Ymd', $end) . 'T' . gmdate('His', $end) . 'Z', 60 | 'summary' => $summary, 61 | 'description' => $description, 62 | 'url' => $url, 63 | 'uid' => $uid 64 | ); 65 | $this->events[] = $event; 66 | return $event; 67 | } 68 | 69 | /** 70 | * @return array Get the array of events. 71 | */ 72 | public function getEvents() 73 | { 74 | return $this->events; 75 | } 76 | 77 | /** 78 | * Clear all events. 79 | */ 80 | public function clearEvents() 81 | { 82 | $this->events = array(); 83 | } 84 | 85 | /** 86 | * Get the name of the calendar. 87 | * @return string 88 | */ 89 | public function getName() 90 | { 91 | return $this->calendarName; 92 | } 93 | 94 | /** 95 | * Set the name of the calendar. 96 | * @param $name 97 | */ 98 | public function setName($name) 99 | { 100 | $this->calendarName = $name; 101 | } 102 | 103 | /** 104 | * Render and optionally output a vcal string. 105 | * @param bool $output Whether to output the calendar data directly (the default). 106 | * @return string The complete rendered vlal 107 | */ 108 | public function render($output = true) 109 | { 110 | //Add header 111 | $ics = 'BEGIN:VCALENDAR 112 | METHOD:PUBLISH 113 | VERSION:2.0 114 | X-WR-CALNAME:' . $this->calendarName . ' 115 | PRODID:-//hacksw/handcal//NONSGML v1.0//EN'; 116 | 117 | //Add events 118 | foreach ($this->events as $event) { 119 | $ics .= ' 120 | BEGIN:VEVENT 121 | UID:' . $event['uid'] . ' 122 | DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z 123 | DTSTART:' . $event['start'] . ' 124 | DTEND:' . $event['end'] . ' 125 | SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . ' 126 | DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . ' 127 | URL;VALUE=URI:' . $event['url'] . ' 128 | END:VEVENT'; 129 | } 130 | 131 | //Add footer 132 | $ics .= ' 133 | END:VCALENDAR'; 134 | 135 | if ($output) { 136 | //Output 137 | $filename = $this->calendarName; 138 | //Filename needs quoting if it contains spaces 139 | if (strpos($filename, ' ') !== false) { 140 | $filename = '"'.$filename.'"'; 141 | } 142 | header('Content-type: text/calendar; charset=utf-8'); 143 | header('Content-Disposition: inline; filename=' . $filename . '.ics'); 144 | echo $ics; 145 | } 146 | return $ics; 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /mailer/extras/README.md: -------------------------------------------------------------------------------- 1 | #PHPMailer Extras 2 | 3 | These classes provide optional additional functions to PHPMailer. 4 | 5 | These are not loaded by the PHPMailer autoloader, so in some cases you may need to `require` them yourself before using them. 6 | 7 | ##EasyPeasyICS 8 | 9 | This class was originally written by Manuel Reinhard and provides a simple means of generating ICS/vCal files that are used in sending calendar events. PHPMailer does not use it directly, but you can use it to generate content appropriate for placing in the `Ical` property of PHPMailer. The PHPMailer project is now its official home as Manuel has given permission for that and is no longer maintaining it himself. 10 | 11 | ##htmlfilter 12 | 13 | This class by Konstantin Riabitsev and Jim Jagielski implements HTML filtering to remove potentially malicious tags, such as ` 155 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /my/deposit.php: -------------------------------------------------------------------------------- 1 | is_logged_in()) 12 | { 13 | $user_home->redirect('../login.php'); 14 | } 15 | 16 | $stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid"); 17 | $stmt->execute(array(":uid"=>$_SESSION['userSession'])); 18 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 19 | 20 | 21 | if(isset($_POST['transfer'])) 22 | { 23 | $sentemail = addslashes($row['userEmail']); 24 | $pass = addslashes($_POST['password']); 25 | $receemail = addslashes($_POST['email']); 26 | $ccash = addslashes($row['userBalance']); 27 | $balance = addslashes($_POST['balance']); 28 | $content = addslashes($_POST['content']); 29 | $money_home->transfercash($sentemail,$pass,$receemail,$ccash,$balance,$content); 30 | } 31 | ?> 32 | 33 | 34 | 35 | 36 | 37 | Nạp tiền vào tài khoản - PiggyBank 38 | 39 | 40 | 41 | 42 | 43 |
44 |

45 |

Nạp tiền vào tài khoản

46 |

Chuyển tiền vào tài khoản PiggyBank của bạn và tiến hành mua sắm, chuyển tiền cho người thân, bạn bè ngay từ bây giờ.

47 |
48 | 54 | 55 |
56 |
57 |

Chuyển khoản ngân hàng

58 |

Chúng tôi sẽ tiếp nhận việc nạp tiền vào tài khoản của bạn thông qua chuyển khoản ngân hàng và sẽ không tính phí quý khách. Xin hãy chuyển khoản vào giờ hành chính (8h-16h) để 59 | có yêu cầu có thể được xử lí nhanh chóng.
Nội dung chuyển khoản: "Email tài khoản muốn chuyển" + PiggyBank.
60 | VD: nguyenvanhai@abc.com PiggyBank

61 |
62 |

Ngân hàng TMCP Ngoại Thương Việt Nam (Vietcombank)
63 | Chi nhánh: Tân Định - TP.HCM
64 | Số tài khoản: 0371000397238
65 | Chủ tài khoản: Lê Thị Nga
66 | Swift Code: BFTVVNVX

67 |
68 |
69 |

Thẻ cào điện thoại/thẻ dịch vụ

70 |

Sử dụng thẻ cào điện thoại để nạp tiền vào tài khoản của bạn. Lưu ý rằng việc sử dụng thẻ cào điện thoại để nạp tiền sẽ bị tính phí 10%.
71 | Chúng tôi hiện đang hỗ trợ: Viettel, Vinaphone, Mobifone, Vietnammobile, Gate.

72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
VinaphoneMobifoneViettelVietnammobileGate
20%20%20%21%14%
92 |

Giao dịch của bạn hiện đang được bảo mật bởi SSL

93 |
94 |
95 |

Thẻ tín dụng

96 |

Sử dụng thẻ thẻ tín dụng để nạp tiền vào tài khoản của bạn. Lưu ý rằng việc sử dụng thẻ tín dụng sẽ bị tính phí chuyển đổi ngoại tệ sang VNĐ.
97 | Chúng tôi hiện đang hỗ trợ: Visa, Mastercard

98 |

Giao dịch của bạn hiện đang được bảo mật bởi SSL

99 |
100 |
101 |

Trực tiếp tại văn phòng

102 |

Bạn có thể đến trực tiếp tại văn phòng của chúng tôi để nạp tiền vào tài khoản PiggyBank. Phương thức chuyển tiền này sẽ không bị tính phí, vô cùng thuận tiện và nhanh chóng.

103 |
104 |

Trụ sở TP.HCM:
105 | Địa chỉ: 427/2 Tân Kỳ Tân Quý, phường Tân Quý, quận Tân Phú, thành phố Hồ Chí Minh.
106 | Văn phòng An Giang:
107 | Địa chỉ: 724 Chu Văn An, thị trấn Phú Mỹ, huyện Phú Tân, tỉnh An Giang.

108 |
109 |
110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /my/home.php: -------------------------------------------------------------------------------- 1 | is_logged_in()) 8 | { 9 | $user_home->redirect('../login.php'); 10 | } 11 | 12 | $stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid"); 13 | $stmt->execute(array(":uid"=>$_SESSION['userSession'])); 14 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 15 | 16 | ?> 17 | 18 | 19 | 20 | 21 | 22 | Tài khoản của bạn - PiggyBank 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 |
31 |
32 |
33 |

Chào mừng bạn ,

34 |

Số tiền trong tài khoản của bạn hiện giờ là Đ

35 |
36 |
37 | 38 |
39 |

Giao dịch gần đây

40 | runQuery("SELECT * from activity where fromEmail=:userEmail OR toEmail=:userEmail ORDER BY `activity`.`id` DESC LIMIT 0 , 4"); 42 | $query->execute(array(":userEmail"=>$row['userEmail'])); 43 | // Display search result 44 | if (!$query->rowCount() == 0) { 45 | echo ""; 46 | echo ""; 47 | while ($results = $query->fetch()) { 48 | echo ""; 58 | } 59 | else 60 | { 61 | echo "".$user_home->emailtoname($results['toEmail']); 62 | echo ""; 66 | } 67 | 68 | } 69 | echo "
Thời gianNgười nhậnSố tiền
"; 49 | echo "".date("d-m-Y", strtotime($results['date'])); 50 | echo ""; 51 | if (($results['toEmail'])==($row['userEmail'])) 52 | { 53 | echo "Bạn"; 54 | echo ""; 55 | echo "+".$results['cash'].'đ'; 56 | echo ""; 57 | echo "
"; 63 | echo "-".$results['cash'].'đ'; 64 | echo ""; 65 | echo "
"; 70 | } else { 71 | echo '

Chúng tôi không tìm thấy kết quả nào, xin hãy thử lại!

'; 72 | } 73 | ?> 74 |

Xem chi tiết lịch sử giao dịch 75 |

76 |

Bạn có thể làm gì với PiggyBank?


77 |

Ưu đãi cho bạn

78 |
79 |
80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /my/logout.php: -------------------------------------------------------------------------------- 1 | is_logged_in()) 8 | { 9 | $user->redirect('../login.php'); 10 | } 11 | 12 | if($user->is_logged_in()!="") 13 | { 14 | $user->logout(); 15 | $user->redirect('../login.php'); 16 | } 17 | ?> -------------------------------------------------------------------------------- /my/profile.php: -------------------------------------------------------------------------------- 1 | is_logged_in()) 9 | { 10 | $user_activity->redirect('../login.php'); 11 | } 12 | 13 | $stmt = $user_activity->runQuery("SELECT * FROM tbl_users WHERE userID=:uid"); 14 | $stmt->execute(array(":uid"=>$_SESSION['userSession'])); 15 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 16 | 17 | $dateFrom = date("d/m/Y"); 18 | $dateTo = date("d/m/Y"); 19 | 20 | if(isset($_POST['date-search'])) 21 | { 22 | $dateFrom = addslashes($_POST['timeCheckIn']); 23 | $dateTo = addslashes($_POST['timeCheckOut']); 24 | if ((checkdate((int)substr($dateFrom,4,2),(int)substr($dateFrom,1,2),(int)substr($dateFrom,7,4))) AND (checkdate((int)substr($dateTo,4,2),(int)substr($dateTo,1,2),(int)substr($dateTo,7,4)))) 25 | if ((strlen($dateTo)==10) AND (strlen($dateFrom)==10)) 26 | { 27 | 28 | } 29 | else 30 | { 31 | header("Location: activity.php?error=4C"); 32 | exit; 33 | } 34 | } 35 | ?> 36 | 37 | 38 | 39 | 40 | 41 | Sửa thông tin cá nhân - PiggyBank 42 | 43 | 44 | 45 | 46 | 47 | 48 |

49 |
50 | exist($_GET['error'])) 53 | { 54 | ?> 55 |
56 | 57 | ectt($_GET['error']); ?> 58 |
59 | 62 | exist($_GET['success'])) 65 | { 66 | ?> 67 |
68 | 69 | ectt($_GET['success']); ?> 70 |
71 | 74 |

Thông tin cá nhân

75 | 129 |
130 | 131 | 132 |
133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /my/transfer.php: -------------------------------------------------------------------------------- 1 | is_logged_in()) 12 | { 13 | $user_home->redirect('../index.php'); 14 | } 15 | 16 | $stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid"); 17 | $stmt->execute(array(":uid"=>$_SESSION['userSession'])); 18 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 19 | 20 | 21 | if(isset($_POST['transfer'])) 22 | if (filter_var(addslashes($_POST['email']),FILTER_VALIDATE_EMAIL)) 23 | { 24 | if ((filter_var(addslashes($_POST['balance']), FILTER_VALIDATE_INT)) AND ($_POST['balance']>0)) 25 | { 26 | $sentemail = addslashes($row['userEmail']); 27 | $pass = addslashes($_POST['password']); 28 | $receemail = addslashes($_POST['email']); 29 | $ccash = addslashes($row['userBalance']); 30 | $balance = addslashes($_POST['balance']); 31 | $content = addslashes($_POST['content']); 32 | $money_home->transfercash($sentemail,$pass,$receemail,$ccash,$balance,$content); 33 | } 34 | else 35 | { 36 | header("Location: transfer.php?error=3C"); 37 | } 38 | } 39 | else 40 | { 41 | header("Location: transfer.php?error=2C"); 42 | } 43 | 44 | 45 | ?> 46 | 47 | 48 | 49 | 50 | 51 | Chuyển tiền & thanh toán - PiggyBank 52 | 53 | 54 | 55 | 56 |
57 |

58 |

Chuyển tiền & thanh toán

59 |

Chuyển tiền cho người thân, bạn bè,... của bạn bằng cách nhập email tài khoản PiggyBank của người nhận. Việc chuyển tiền trong hệ thống hoàn toàn miễn phí.

60 |
61 | exist($_GET['error'])) 64 | { 65 | ?> 66 |
67 | 68 | ectt($_GET['error']); ?> 69 |
70 | 73 | exist($_GET['success'])) 76 | { 77 | ?> 78 |
79 | 80 | ectt($_GET['success']); ?> 81 |
82 | 85 |
86 |
87 | 88 | 89 |
90 |
91 | 92 |
93 | 94 | đ 95 |
96 |
97 |
98 | 99 | 100 |
101 |
102 | 103 | 104 |
105 | 106 |
107 |
108 |

Giao dịch của bạn hiện đang được bảo mật bởi SSL

109 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /resetpass.php: -------------------------------------------------------------------------------- 1 | redirect('login.php'); 9 | } 10 | 11 | if(isset($_GET['id']) && isset($_GET['code'])) 12 | { 13 | $id = base64_decode($_GET['id']); 14 | $code = $_GET['code']; 15 | 16 | $stmt = $user->runQuery("SELECT * FROM tbl_users WHERE userID=:uid AND tokenCode=:token"); 17 | $stmt->execute(array(":uid"=>$id,":token"=>$code)); 18 | $rows = $stmt->fetch(PDO::FETCH_ASSOC); 19 | 20 | if($stmt->rowCount() == 1) 21 | { 22 | if(isset($_POST['btn-reset-pass'])) 23 | { 24 | $pass = $_POST['pass']; 25 | $cpass = $_POST['confirm-pass']; 26 | 27 | if($cpass!==$pass) 28 | { 29 | $msg = "
30 | 31 | Sorry! Password Doesn't match. 32 |
"; 33 | } 34 | else 35 | { 36 | $password = md5($cpass); 37 | $stmt = $user->runQuery("UPDATE tbl_users SET userPass=:upass WHERE userID=:uid"); 38 | $stmt->execute(array(":upass"=>$password,":uid"=>$rows['userID'])); 39 | 40 | $msg = "
41 | 42 | Password Changed. 43 |
"; 44 | header("refresh:5;index.php"); 45 | } 46 | } 47 | } 48 | else 49 | { 50 | $msg = "
51 | 52 | No Account Found, Try again 53 |
"; 54 | 55 | } 56 | 57 | 58 | } 59 | 60 | ?> 61 | 62 | 63 | 64 | Password Reset 65 | 66 | 67 | 68 | 69 | 70 | 73 | 74 | 75 |
76 |
77 | Hello ! you are here to reset your forgetton password. 78 |
79 | 93 | 94 |
95 | 96 | 97 | -------------------------------------------------------------------------------- /signup.php: -------------------------------------------------------------------------------- 1 | is_logged_in()!="") 11 | { 12 | $reg_user->redirect('my/home.php'); 13 | } 14 | 15 | 16 | if(isset($_POST['btn-signup'])) 17 | { 18 | $uname = addslashes($_POST['txtuname']); 19 | $email = addslashes($_POST['txtemail']); 20 | $upass = addslashes($_POST['txtpass']); 21 | $code = md5(uniqid(rand())); 22 | if(filter_var($email,FILTER_VALIDATE_EMAIL)) 23 | { 24 | $stmt = $reg_user->runQuery("SELECT * FROM tbl_users WHERE userEmail=:email_id"); 25 | $stmt->execute(array(":email_id"=>$email)); 26 | $row = $stmt->fetch(PDO::FETCH_ASSOC); 27 | 28 | if($stmt->rowCount() > 0) 29 | { 30 | header("Location: signup.php?error=4B"); 31 | exit; 32 | } 33 | else 34 | { 35 | if($reg_user->register($uname,$email,$upass,$code)) 36 | { 37 | $id = $reg_user->lasdID(); 38 | $key = base64_encode($id); 39 | $id = $key; 40 | 41 | $message = " 42 | Hello $uname, 43 |

44 | Welcome to Coding Cage!
45 | To complete your registration please , just click following link
46 |

47 | Click HERE to Activate :) 48 |

49 | Thanks,"; 50 | 51 | $subject = "Confirm Registration"; 52 | 53 | $reg_user->send_mail($email,$message,$subject); 54 | header("Location: signup.php?success=5B"); 55 | exit; 56 | } 57 | else 58 | { 59 | header("Location: signup.php?error=C1"); 60 | exit; 61 | } 62 | } 63 | } 64 | else 65 | { 66 | header("Location: signup.php?error=2C"); 67 | } 68 | } 69 | ?> 70 | 71 | 72 | 73 | Signup | Coding Cage 74 | 75 | 76 | 77 | 78 | 79 | 82 | 83 | 84 | 85 |
86 | 117 | 118 |
119 | 120 | 121 | -------------------------------------------------------------------------------- /template/footer_ac.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Copyright © 2016 PiggyBank. Liên hệ hỗ trợ    5 | Giới thiệu   Blog   Người bán & Lập trình viên   Phụ phí

6 |
7 |
-------------------------------------------------------------------------------- /template/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /template/menu_ac.php: -------------------------------------------------------------------------------- 1 | 26 |
-------------------------------------------------------------------------------- /template/misc.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /verify.php: -------------------------------------------------------------------------------- 1 | redirect('login.php'); 9 | } 10 | 11 | if(isset($_GET['id']) && isset($_GET['code'])) 12 | { 13 | $id = base64_decode($_GET['id']); 14 | $code = $_GET['code']; 15 | 16 | $statusY = "Y"; 17 | $statusN = "N"; 18 | 19 | $stmt = $user->runQuery("SELECT userID,userStatus FROM tbl_users WHERE userID=:uID AND tokenCode=:code LIMIT 1"); 20 | $stmt->execute(array(":uID"=>$id,":code"=>$code)); 21 | $row=$stmt->fetch(PDO::FETCH_ASSOC); 22 | if($stmt->rowCount() > 0) 23 | { 24 | if($row['userStatus']==$statusN) 25 | { 26 | $stmt = $user->runQuery("UPDATE tbl_users SET userStatus=:status WHERE userID=:uID"); 27 | $stmt->bindparam(":status",$statusY); 28 | $stmt->bindparam(":uID",$id); 29 | $stmt->execute(); 30 | 31 | $msg = " 32 |
33 | 34 | WoW ! Your Account is Now Activated : Login here 35 |
36 | "; 37 | } 38 | else 39 | { 40 | $msg = " 41 |
42 | 43 | sorry ! Your Account is allready Activated : Login here 44 |
45 | "; 46 | } 47 | } 48 | else 49 | { 50 | $msg = " 51 |
52 | 53 | sorry ! No Account Found : Signup here 54 |
55 | "; 56 | } 57 | } 58 | 59 | ?> 60 | 61 | 62 | 63 | Confirm Registration 64 | 65 | 66 | 67 | 68 | 69 | 72 | 73 | 74 | 75 |
76 | 77 |
78 | 79 | 80 | --------------------------------------------------------------------------------