forked from kevinowino869/mitrobill
Path Configuration
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
* by https://t.me/ibnux
|
||||
@ -10,21 +11,21 @@ if (isset($routes['1'])) {
|
||||
$do = 'register-display';
|
||||
}
|
||||
|
||||
$otpPath = 'system/cache/sms/';
|
||||
$otpPath = $CACHE_PATH . File::pathFixer('/sms/');
|
||||
|
||||
switch ($do) {
|
||||
case 'post':
|
||||
$otp_code = _post('otp_code');
|
||||
$username = alphanumeric(_post('username'),"+_.");
|
||||
$username = alphanumeric(_post('username'), "+_.");
|
||||
$email = _post('email');
|
||||
$fullname = _post('fullname');
|
||||
$password = _post('password');
|
||||
$cpassword = _post('cpassword');
|
||||
$address = _post('address');
|
||||
if(!empty($config['sms_url'])){
|
||||
if (!empty($config['sms_url'])) {
|
||||
$phonenumber = Lang::phoneFormat($username);
|
||||
$username = $phonenumber;
|
||||
}else if(strlen($username)<21){
|
||||
} else if (strlen($username) < 21) {
|
||||
$phonenumber = $username;
|
||||
}
|
||||
$msg = '';
|
||||
@ -44,16 +45,16 @@ switch ($do) {
|
||||
$msg .= Lang::T('Passwords does not match') . '<br>';
|
||||
}
|
||||
|
||||
if(!empty($config['sms_url'])){
|
||||
$otpPath .= sha1($username.$db_password).".txt";
|
||||
if (!empty($config['sms_url'])) {
|
||||
$otpPath .= sha1($username . $db_password) . ".txt";
|
||||
run_hook('validate_otp'); #HOOK
|
||||
//expired 10 minutes
|
||||
if(file_exists($otpPath) && time()-filemtime($otpPath)>1200){
|
||||
if (file_exists($otpPath) && time() - filemtime($otpPath) > 1200) {
|
||||
unlink($otpPath);
|
||||
r2(U . 'register', 's', 'Verification code expired');
|
||||
}else if(file_exists($otpPath)){
|
||||
} else if (file_exists($otpPath)) {
|
||||
$code = file_get_contents($otpPath);
|
||||
if($code!=$otp_code){
|
||||
if ($code != $otp_code) {
|
||||
$ui->assign('username', $username);
|
||||
$ui->assign('fullname', $fullname);
|
||||
$ui->assign('address', $address);
|
||||
@ -63,10 +64,10 @@ switch ($do) {
|
||||
$ui->assign('notify_t', 'd');
|
||||
$ui->display('register-otp.tpl');
|
||||
exit();
|
||||
}else{
|
||||
} else {
|
||||
unlink($otpPath);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
r2(U . 'register', 's', 'No Verification code');
|
||||
}
|
||||
}
|
||||
@ -77,7 +78,7 @@ switch ($do) {
|
||||
if ($msg == '') {
|
||||
run_hook('register_user'); #HOOK
|
||||
$d = ORM::for_table('tbl_customers')->create();
|
||||
$d->username = alphanumeric($username,"+_.");
|
||||
$d->username = alphanumeric($username, "+_.");
|
||||
$d->password = $password;
|
||||
$d->fullname = $fullname;
|
||||
$d->address = $address;
|
||||
@ -110,38 +111,38 @@ switch ($do) {
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!empty($config['sms_url'])){
|
||||
if (!empty($config['sms_url'])) {
|
||||
$username = _post('username');
|
||||
if(!empty($username)){
|
||||
if (!empty($username)) {
|
||||
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
||||
if ($d) {
|
||||
r2(U . 'register', 's', Lang::T('Account already axist'));
|
||||
}
|
||||
if(!file_exists($otpPath)){
|
||||
if (!file_exists($otpPath)) {
|
||||
mkdir($otpPath);
|
||||
touch($otpPath.'index.html');
|
||||
touch($otpPath . 'index.html');
|
||||
}
|
||||
$otpPath .= sha1($username.$db_password).".txt";
|
||||
$otpPath .= sha1($username . $db_password) . ".txt";
|
||||
//expired 10 minutes
|
||||
if(file_exists($otpPath) && time()-filemtime($otpPath)<1200){
|
||||
if (file_exists($otpPath) && time() - filemtime($otpPath) < 1200) {
|
||||
$ui->assign('username', $username);
|
||||
$ui->assign('notify', 'Please wait '.(1200-(time()-filemtime($otpPath))).' seconds before sending another SMS');
|
||||
$ui->assign('notify', 'Please wait ' . (1200 - (time() - filemtime($otpPath))) . ' seconds before sending another SMS');
|
||||
$ui->assign('notify_t', 'd');
|
||||
$ui->display('register-otp.tpl');
|
||||
}else{
|
||||
$otp = rand(100000,999999);
|
||||
} else {
|
||||
$otp = rand(100000, 999999);
|
||||
file_put_contents($otpPath, $otp);
|
||||
Message::sendSMS($username,$config['CompanyName']."\nYour Verification code are: $otp");
|
||||
Message::sendSMS($username, $config['CompanyName'] . "\nYour Verification code are: $otp");
|
||||
$ui->assign('username', $username);
|
||||
$ui->assign('notify', 'Verification code has been sent to your phone');
|
||||
$ui->assign('notify_t', 's');
|
||||
$ui->display('register-otp.tpl');
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
run_hook('view_otp_register'); #HOOK
|
||||
$ui->display('register-rotp.tpl');
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$ui->assign('username', "");
|
||||
$ui->assign('fullname', "");
|
||||
$ui->assign('address', "");
|
||||
|
Reference in New Issue
Block a user