<?php
 class VPI { var $owner; public function __construct( $app) { $this->owner = $app; if (!is_object($this->owner->db)) die(); return $this; } public function validate_auth() { if (!empty($GLOBALS['login']) && !empty($GLOBALS['tkn']) && !empty($GLOBALS['nonce']) && !empty($GLOBALS['key'])) { if (($a=$this->owner->db->get_auth_data_on_uname($GLOBALS['login']))) { $GLOBALS['SSXHASH'] = md5($GLOBALS['nonce'].':'.$GLOBALS['login'].':'.$a[0]['password']); if (strcmp($GLOBALS['tkn'], $GLOBALS['SSXHASH']) == 0) { if ($a[0]['level'] >= $this->owner->config['SECURITY']['RESELLER_OPERATORS']) { if (($b=$this->owner->db->get_provider_from_operator($a[0]['obj_id'], $GLOBALS['key']))) { $GLOBALS['RESELLER'] = $b[0][0]; if (($c=$this->owner->db->get_provider_from_track($GLOBALS['RESELLER']))) { $GLOBALS['PROVIDER'] = $c[0][0]; $GLOBALS['SSXID'] = $a[0]['obj_id']; $GLOBALS['SEC'] = $a[0]['level']; $this->owner->log(CMMN_INFO, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], md5($GLOBALS['tkn']), STR_APP_VALID_LOGIN); $GLOBALS['USER'] = $a[0]['fn']; return true; } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], $GLOBALS['tkn'], STR_APP_ACCESSDENIED); } } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], $GLOBALS['tkn'], STR_APP_DBERR); } } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], $GLOBALS['tkn'], STR_APP_ACCESSDENIED); } } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], $GLOBALS['tkn'], STR_APP_INVALID_PASSWORD); } } else { $this->owner->log(CMMN_ERROR, $_SERVER['REMOTE_ADDR'], $_SERVER['PHP_SELF'], $GLOBALS['login'], $GLOBALS['tkn'], STR_APP_INVALID_LOGIN); } } sleep(5); return false; } } ?>
