示例#1
0
 public static function chk($username, $accounts_id = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "session_CFG");
     $userKey;
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($username));
     //----------------------------------------------------------
     if ($chk['bool']) {
         if (is_null(Constants::$mysqli)) {
             GenFun::hostConnect();
         }
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     session_start();
     $session_id = GenFun::encrypt(session_id() . self::SALT . $username);
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = MySQL::getTable(SessionLog_const::TBL, array("session_id" => $session_id, "userKey" => $_COOKIE['user']));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     $userKey = $username . "-" . rand(0, 13000000);
     setcookie("user", $userKey);
     //----------------------------------------------------------
     if (sizeof($chk['result']) == 0) {
         $chk = InsertINTO::go(array("tableID" => SessionLog_const::TBL, "setArr" => array("userKey" => $userKey, "accounts_id" => $accounts_id, "session_id" => $session_id)));
     } else {
         $chk = Update::go(SessionLog_const::TBL, array("userKey" => $userKey), array("session_id" => $session_id));
         if ($chk['bool']) {
             $chk['message'] = "session for this user has already been established!!!";
         }
     }
     //----------------------------------------------------------
     return $chk;
 }
示例#2
0
function archive($folderPath = NULL)
{
    $folderPath = dirname(__FILE__) . "/files/new_files/";
    //----------------------------------------------------------
    //init var
    //----------------------------------------------------------
    $chk = array("bool" => true, "func" => "archive");
    $dirArray = array();
    $myDirectory;
    //----------------------------------------------------------
    //$this->move(dirname(__FILE__)."/files/videoOrganizer/thumb/",$folderPath.'thumb/');
    //$this->move(dirname(__FILE__)."/files/videoOrganizer/",$folderPath);
    //----------------------------------------------------------
    $myDirectory = opendir($folderPath);
    //----------------------------------------------------------
    $videoPath = GenFun::get_full_url(dirname(__FILE__)) . "files/videoOrganizer/";
    //----------------------------------------------------------
    $this->move($folderPath, $folderPath, " ", "_");
    //----------------------------------------------------------
    $this->move($folderPath . 'thumb/', $folderPath . 'thumb/', " ", "_");
    //----------------------------------------------------------
    while ($entryName = readdir($myDirectory)) {
        if (stristr($entryName, '.mp4')) {
            array_push($dirArray, array('title' => $entryName, 'orig_title' => $entryName, 'hash' => GenFun::encrypt($entryName), 'path' => $videoPath, 'mp4' => $entryName, 'thumbnail_url' => "thumb/" . GenFun::str_lreplace(".mp4", ".png", $entryName)));
        }
    }
    //----------------------------------------------------------
    $this->move($folderPath, $folderPath, "_", " ");
    //----------------------------------------------------------
    $this->move($folderPath . 'thumb/', $folderPath . 'thumb/', "_", " ");
    //----------------------------------------------------------
    $this->move($folderPath . 'thumb/', dirname(__FILE__) . "/files/videoOrganizer/thumb/");
    $this->move($folderPath, dirname(__FILE__) . "/files/videoOrganizer/");
    //----------------------------------------------------------
    $chk = $this->_insertContents($dirArray);
    return $chk;
}
示例#3
0
 public function changePassword($hash, $password)
 {
     Trace::output($this->traceID, "changePassword");
     //----------------------------------------------------------
     $chk = GenFun::error_chk(array($hash, $password));
     //----------------------------------------------------------
     $this->tblName = ForgotPwRequest_const::TBL;
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "traceID" => "changePassword");
     //----------------------------------------------------------
     $chk = $this->getAccountRow($hash);
     //----------------------------------------------------------
     if (!$chk['bool']) {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['result'][0]['confirmed'] == 1) {
         $chk['bool'] = false;
     }
     //----------------------------------------------------------
     if (sizeof($chk['result']) != 0 && $chk['bool']) {
         $chk = Update::go(Accounts_const::TBL, array("password" => GenFun::encrypt($password . $this->salt)), array("id" => $chk['result'][0]['accounts_id']));
         $chk = $this->confirm($hash, "forgotPwRequest");
     } else {
         $chk['bool'] = false;
         $chk['message'] = "This link has been disabled!!!";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk['message'] = "Password Updated!!!";
     }
     //----------------------------------------------------------
     return $chk;
 }
示例#4
0
 public function session_CHK($email = NULL, $accounts_id = NULL)
 {
     Trace::output($this->traceID, "session_CHK", func_get_args());
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "session_CFG");
     $userKey;
     $last_userKey;
     //----------------------------------------------------------
     if (is_null($email) && !isset($_COOKIE[$this->cookiePrefix . "user"])) {
         $chk['bool'] = false;
     }
     //----------------------------------------------------------
     if (!$chk['bool']) {
         $chk['message'] = "No session or email exist!!!";
         return $chk;
     }
     //----------------------------------------------------------
     if (session_id() == '') {
         session_start();
     }
     //----------------------------------------------------------
     if ($chk['bool'] && isset($_COOKIE[$this->cookiePrefix . "user"]) && is_null($email)) {
         $chk = $this->getSession($_COOKIE[$this->cookiePrefix . 'user']);
         if ($chk['bool']) {
             //Constants::$loggedIN = $chk['result'][0];
             $email = $chk['result'][0]['email'];
             $accounts_id = $chk['result'][0]['id'];
         }
     } else {
         $chk['bool'] = false;
     }
     //----------------------------------------------------------
     if (!$chk['bool'] && is_null($email)) {
         $chk['bool'] = false;
         $chk['message'] = "No session or email exist!!!";
         return $chk;
     }
     //----------------------------------------------------------
     $session_id = GenFun::encrypt(session_id() . $this->salt . $email);
     //----------------------------------------------------------
     $last_userKey = $_COOKIE[$this->cookiePrefix . "user"];
     //----------------------------------------------------------
     $userKey = $email . "-" . alphaID(time() . rand(0, 13000000));
     //----------------------------------------------------------
     setcookie($this->cookiePrefix . "user", $userKey, GenFun::getCookieTime());
     //----------------------------------------------------------
     $this->setAndChk($email);
     //----------------------------------------------------------
     if (!$chk['bool']) {
         $chk = GetTable::go(Accounts_const::TBL, array("email" => $email));
         //------------------------------------------------------
         if ($chk['bool'] && sizeof($chk['result']) > 0) {
             Update::go(SessionLog_const::TBL, array("disabled" => "{function}NOW()"), array("accounts_id" => $chk['result'][0]['id']));
         }
         //------------------------------------------------------
         session_regenerate_id();
         $session_id = GenFun::encrypt(session_id() . $this->salt . $email);
         if ($chk['bool']) {
             $chk = InsertINTO::go(SessionLog_const::TBL, array("userKey" => $userKey, "accounts_id" => $chk['result'][0]['id'], "session_id" => $session_id));
         }
         //------------------------------------------------------
         $session = $this->getSession($userKey);
         //------------------------------------------------------
         if ($session['bool']) {
             Constants::$loggedIN = $session['result'][0];
         }
     } else {
         setcookie("shit", $userKey, GenFun::getCookieTime());
         $chk = Update::go(SessionLog_const::TBL, array("userKey" => $userKey), array("userKey" => $last_userKey));
         Constants::$loggedIN['userKey'] = $userKey;
         if ($chk['bool']) {
             $chk['message'] = "session for this user has already been established!!!";
         }
     }
     //----------------------------------------------------------
     return $chk;
 }
示例#5
0
 private function process($table, $row, $format)
 {
     $chk = array("bool" => true);
     if (!empty($row[$format])) {
         $chk = InsertINTO::go('files', array("name" => $row[$format], 'hash' => GenFun::encrypt($row[$format] . $row['id'])), array("ignore" => true));
     }
     if ($chk['bool'] && !empty($row[$format])) {
         $chk = Update::go("videos", array($format => Constants::$mysqli->insert_id), array("id" => $row['id']));
     }
     print_r($chk);
     return $chk;
 }
示例#6
0
<?php

//------------------------------------------------------------------------
//------------------------------------------------------------------------
//php imports
//------------------------------------------------------------------------
//------------------------------------------------------------------------
require_once '../../uber_src/client/werm/utils/GenFun.php';
//------------------------------------------------------------------------
echo GenFun::encrypt("nickelman");
示例#7
0
 public function insertInvites($obj)
 {
     $hash;
     $queryString = "INSERT INTO invites\n\t\t(from_accounts_id, to_accounts_id, teams_id, events_id, auto_approve, email, hash)\n\t\tVALUES ";
     for ($i = 0; $i < sizeof($obj["players"]); $i++) {
         $hash = alphaID($i . $obj['events_id'] . $obj['to_accounts_id'] . $obj['teams_id'] . strtotime(date("Y-m-d H:i:s")));
         //--------------------------------------------------
         $queryString .= "('116', '" . $obj['players'][$i]['id'] . "', '" . $obj['teams_id'] . "', '" . $obj['events_id'] . "',";
         $queryString .= $obj['players'][$i]['info']['rosterOption'] == 1 ? "'1'," : "DEFAULT,";
         $queryString .= "DEFAULT,";
         $queryString .= "'" . $hash . "'";
         $queryString .= ")";
         if ($i < sizeof($obj["players"]) - 1) {
             $queryString .= ",";
         }
         $obj['players'][$i]['hash'] = $hash;
     }
     //----------------------------------------------------------
     if (sizeof($obj["emails"]) != 0) {
         $queryString .= ",";
         //------------------------------------------------------
         for ($i = 0; $i < sizeof($obj["emails"]); $i++) {
             $hash = alphaID(GenFun::encrypt($obj['emails'][$i]['id']) . $i . $obj['events_id'] . $obj['teams_id'] . strtotime(date("Y-m-d H:i:s")));
             //--------------------------------------------------
             $queryString .= "('116', DEFAULT, '" . $obj['teams_id'] . "', '" . $obj['events_id'] . "',";
             $queryString .= $obj['emails'][$i]['info']['rosterOption'] == 1 ? "1" : "DEFAULT, ";
             $queryString .= "'" . $obj['emails'][$i]['id'] . "',";
             $queryString .= "'" . $hash . "'";
             $queryString .= ")";
             if ($i < sizeof($obj["emails"]) - 1) {
                 $queryString .= ",";
             }
             $obj['emails'][$i]['hash'] = $hash;
         }
     }
     //----------------------------------------------------------
     $chk = Result::go($queryString);
     //----------------------------------------------------------
     $chk['obj'] = $obj;
     //----------------------------------------------------------
     return $chk;
 }