コード例 #1
0
ファイル: logout.php プロジェクト: scintes/sistemas
 function Page_Main()
 {
     global $Security, $Language, $UserProfile;
     $bValidate = TRUE;
     $sUsername = $Security->CurrentUserName();
     // Call User LoggingOut event
     $bValidate = $this->User_LoggingOut($sUsername);
     if (!$bValidate) {
         $sLastUrl = $Security->LastUrl();
         if ($sLastUrl == "") {
             $sLastUrl = "index.php";
         }
         $this->Page_Terminate($sLastUrl);
         // Go to last accessed URL
     } else {
         if (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "") {
             // Not autologin
             setcookie(EW_PROJECT_NAME . '[Username]', "");
         }
         // Clear user name cookie
         setcookie(EW_PROJECT_NAME . '[Password]', "");
         // Clear password cookie
         setcookie(EW_PROJECT_NAME . '[LastUrl]', "");
         // Clear last URL
         // Call User LoggedOut event
         $this->User_LoggedOut($sUsername);
         $this->WriteAuditTrailOnLogout($sUsername);
         // Clean upload temp folder
         ew_CleanUploadTempPaths(session_id());
         // Unset all of the Session variables
         $_SESSION = array();
         // Delete the Session cookie and kill the Session
         if (isset($_COOKIE[session_name()])) {
             setcookie(session_name(), '', time() - 42000, '/');
         }
         // Finally, destroy the Session
         @session_destroy();
         $this->Page_Terminate("login.php");
         // Go to login page
     }
 }
コード例 #2
0
ファイル: phpfn12.php プロジェクト: NaurozAhmad/Senho
function ew_RenderUploadField(&$fld, $idx = -1)
{
    global $Language;
    $fldvar = $idx < 0 ? $fld->FldVar : substr($fld->FldVar, 0, 1) . $idx . substr($fld->FldVar, 1);
    $folder = ew_UploadTempPath($fldvar, $fld->TblVar);
    ew_CleanUploadTempPaths();
    // Clean all old temp folders
    ew_CleanPath($folder);
    // Clean the upload folder
    if (!file_exists($folder)) {
        if (!ew_CreateFolder($folder)) {
            die("Cannot create folder: " . $folder);
        }
    }
    $thumbnailfolder = ew_PathCombine($folder, EW_UPLOAD_THUMBNAIL_FOLDER, TRUE);
    if (!file_exists($thumbnailfolder)) {
        if (!ew_CreateFolder($thumbnailfolder)) {
            die("Cannot create folder: " . $thumbnailfolder);
        }
    }
    if ($fld->FldDataType == EW_DATATYPE_BLOB) {
        // Blob field
        if (!ew_Empty($fld->Upload->DbValue)) {
            // Create upload file
            $filename = $fld->Upload->FileName != "" ? $fld->Upload->FileName : substr($fld->FldVar, 2);
            $f = ew_IncludeTrailingDelimiter($folder, TRUE) . $filename;
            ew_CreateUploadFile($f, $fld->Upload->DbValue);
            // Create thumbnail file
            $f = ew_IncludeTrailingDelimiter($thumbnailfolder, TRUE) . $filename;
            $data = $fld->Upload->DbValue;
            $width = EW_UPLOAD_THUMBNAIL_WIDTH;
            $height = EW_UPLOAD_THUMBNAIL_HEIGHT;
            ew_ResizeBinary($data, $width, $height);
            ew_CreateUploadFile($f, $data);
            $fld->Upload->FileName = basename($f);
            // Update file name
        }
    } else {
        // Upload to folder
        $fld->Upload->FileName = $fld->Upload->DbValue;
        // Update file name
        if (!ew_Empty($fld->Upload->FileName)) {
            // Create upload file
            $pathinfo = pathinfo($fld->Upload->FileName);
            $filename = $pathinfo['basename'];
            $filepath = @$pathinfo['dirname'] != "" ? $fld->UploadPath . '/' . $pathinfo['dirname'] : $fld->UploadPath;
            if ($fld->UploadMultiple) {
                $files = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $filename);
            } else {
                $files = array($filename);
            }
            $cnt = count($files);
            for ($i = 0; $i < $cnt; $i++) {
                $filename = $files[$i];
                if ($filename != "") {
                    $srcfile = ew_UploadPathEx(TRUE, $filepath) . $filename;
                    $f = ew_IncludeTrailingDelimiter($folder, TRUE) . $filename;
                    if (!is_dir($srcfile) && file_exists($srcfile)) {
                        $data = file_get_contents($srcfile);
                        ew_CreateUploadFile($f, $data);
                    } else {
                        ew_CreateImageFromText($Language->Phrase("FileNotFound"), $f);
                        $data = file_get_contents($f);
                    }
                    // Create thumbnail file
                    $f = ew_IncludeTrailingDelimiter($thumbnailfolder, TRUE) . $filename;
                    $width = EW_UPLOAD_THUMBNAIL_WIDTH;
                    $height = EW_UPLOAD_THUMBNAIL_HEIGHT;
                    ew_ResizeBinary($data, $width, $height);
                    ew_CreateUploadFile($f, $data);
                }
            }
        }
    }
}