<?php
 class DialinUser { var $owner; public function __construct( $app) { $this->owner = $app; return $this; } public function validate_auth( $pre = true) { if ( (!$pre) || (isset($GLOBALS['SSXID']) && isset($GLOBALS['SSXHASH']))) { sleep(10); return false; } if ( isset( $GLOBALS['id'])) $GLOBALS['USERNAME'] = $GLOBALS['id']; if ( isset( $GLOBALS['PASSWORD']) && !isset($GLOBALS['password'])) $GLOBALS['password'] = $GLOBALS['PASSWORD']; if (!isset($GLOBALS['LANGUAGE'])) $GLOBALS['LANGUAGE'] = 'en'; $t = time()+1800; $obj = $this->owner->load_object_resource('rad.WebRAD'); if (!empty($GLOBALS['SSXINFO'])) { if (preg_match_all('^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$^', $GLOBALS['SSXINFO'], $reg)) { $GLOBALS['SSXID'] = $reg[2][0]; $GLOBALS['SSXHASH'] = $reg[3][0]; $GLOBALS['LANGUAGE'] = empty($reg[4][0]) ? 'en' : $reg[4][0]; $GLOBALS['DOMAIN'] = $reg[5][0]; $GLOBALS['RESELLER'] = $reg[6][0]; $GLOBALS['PROVIDER'] = $reg[7][0]; if ( ($res = $obj->db->GetAll( "SELECT username, password, deposit FROM sk_users WHERE uid='".$GLOBALS['SSXID']."'"))) { $a = $res[0]; if ( $a) { if (strcmp($this->owner->crypt($a['password']), $GLOBALS['SSXHASH']) == 0) { $GLOBALS['SEC'] = 0; $GLOBALS['USER'] = $a['username']; $GLOBALS['DEPOSIT'] = $a['deposit']; $theCookie = $GLOBALS['SEC'] . '/' . $GLOBALS['SSXID'] . '/' . $GLOBALS['SSXHASH'] . '/' . $GLOBALS['LANGUAGE'] . '/' . $GLOBALS['DOMAIN'] . '/0/0'; if (PHP_VERSION_ID < 70300) { SetCookie( 'SSXINFO', $theCookie, $t, '/; samesite=strict', '', false, true); } else { SetCookie( 'SSXINFO', $theCookie, array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); } return true; } } } } } elseif (!empty($GLOBALS['USERNAME']) && !empty($GLOBALS['password'])) { if ( ($res = $obj->db->GetAll( "SELECT uid, username, password, deposit FROM sk_users WHERE username='".$GLOBALS['USERNAME']."'"))) { $a = $res[0]; if ( $a) { $GLOBALS['SSXHASH'] = $this->owner->crypt($GLOBALS['password']); if (strcmp($this->owner->crypt($a['password']), $GLOBALS['SSXHASH']) == 0) { $GLOBALS['SSXID'] = $a['uid']; $GLOBALS['SEC'] = 0; if ( isset($_REQUEST['LANGUAGE'])) $GLOBALS['LANGUAGE'] = $_REQUEST['LANGUAGE']; $theCookie = $GLOBALS['SEC'] . '/' . $GLOBALS['SSXID'] . '/' . $GLOBALS['SSXHASH'] . '/' . $GLOBALS['LANGUAGE'] . '/' . $GLOBALS['DOMAIN'] . '/0/0'; if (PHP_VERSION_ID < 70300) { SetCookie( 'SSXINFO', $theCookie, $t, '/; samesite=strict', '', false, true); SetCookie( 'USER', $a['username'], $t, '/; samesite=strict', '', false, true); SetCookie( 'LANGUAGE', $GLOBALS['LANGUAGE'], $t, '/; samesite=strict', '', false, true); } else { SetCookie( 'SSXINFO', $theCookie, array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); SetCookie( 'USER', $a['username'], array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); SetCookie( 'LANGUAGE', $GLOBALS['LANGUAGE'], array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); } $this->owner->log(CMMN_INFO, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['USERNAME'], md5($GLOBALS['password']), STR_APP_VALID_LOGIN); $GLOBALS['USER'] = $a['username']; $GLOBALS['DEPOSIT'] = $a['deposit']; return true; } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['USERNAME'], $GLOBALS['password'], STR_APP_INVALID_PASSWORD); } } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['USERNAME'], $GLOBALS['password'], STR_APP_INVALID_LOGIN); } } } elseif (!empty($GLOBALS['USERNAME']) && empty($GLOBALS['password'])) { Redirect('/app/user/auth/index.php?q=core.redirect.view&USERNAME='.$GLOBALS['USERNAME']); exit(0); } $GLOBALS['USER'] = ''; $t = time() - 3600; if (PHP_VERSION_ID < 70300) { setcookie( 'SSXINFO', '', $t, '/; samesite=strict', '', false, true); setcookie( 'USER', '', $t, '/; samesite=strict', '', false, true); } else { setcookie( 'SSXINFO', '', array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); setcookie( 'USER', '', array('expires' => $t, 'path' => '/', 'secure' => false, 'httponly' => true, 'samesite' => 'strict')); } sleep(3); return false; } } ?>
