当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::Connect方法代码示例

本文整理汇总了PHP中COM::Connect方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::Connect方法的具体用法?PHP COM::Connect怎么用?PHP COM::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::Connect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ChangePassword

 /**
  * @param \RainLoop\Model\Account $oHmailAccount
  * @param string $sPrevPassword
  * @param string $sNewPassword
  *
  * @return bool
  */
 public function ChangePassword(\RainLoop\Account $oHmailAccount, $sPrevPassword, $sNewPassword)
 {
     if ($this->oLogger) {
         $this->oLogger->Write('Try to change password for ' . $oHmailAccount->Email());
     }
     $bResult = false;
     try {
         $oHmailApp = new COM("hMailServer.Application");
         $oHmailApp->Connect();
         if ($oHmailApp->Authenticate($this->sLogin, $this->sPassword)) {
             $sEmail = $oHmailAccount->Email();
             $sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
             $oHmailDomain = $oHmailApp->Domains->ItemByName($sDomain);
             if ($oHmailDomain) {
                 $oHmailAccount = $oHmailDomain->Accounts->ItemByAddress($sEmail);
                 if ($oHmailAccount) {
                     $oHmailAccount->Password = $sNewPassword;
                     $oHmailAccount->Save();
                     $bResult = true;
                 } else {
                     $this->oLogger->Write('HMAILSERVER: Unknown account (' . $sEmail . ')', \MailSo\Log\Enumerations\Type::ERROR);
                 }
             } else {
                 $this->oLogger->Write('HMAILSERVER: Unknown domain (' . $sDomain . ')', \MailSo\Log\Enumerations\Type::ERROR);
             }
         } else {
             $this->oLogger->Write('HMAILSERVER: Auth error', \MailSo\Log\Enumerations\Type::ERROR);
         }
     } catch (\Exception $oException) {
         if ($this->oLogger) {
             $this->oLogger->WriteException($oException);
         }
     }
     return $bResult;
 }
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:42,代码来源:HmailserverChangePasswordDriver.php

示例2: dbactionDelete

 function dbactionDelete()
 {
     $srv = new COM("SQLDMO.SQLServer");
     $srv->LoginSecure = true;
     $DB = new COM("SQLDMO.Database");
     try {
         $srv->Connect("localhost,1433");
         //$srv->Connect(".");
     } catch (Exception $e) {
         throw new lxException('MsSql Server Connection is Failed', '', '');
         exit;
     }
     $strDatabaseDelete = $this->main->dbname;
     $login = $this->main->username;
     $DB = $srv->Databases($strDatabaseDelete);
     if ($DB->IsUser($login)) {
         $DB->Users->Remove($login);
     }
     //print("\nRestored\n");
     //$srv->Logins->Remove($login);
     print "\n" . $login . "\n";
     $srv->DisConnect();
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:23,代码来源:mssqldbuser__mssqllib.php

示例3: getHmsComServer

 function getHmsComServer($user)
 {
     $conf = $this->rc->config->get('hmailserver_server_for_hmsrc');
     $obBaseApp = new COM("hMailServer.Application", NULL, CP_UTF8);
     $obBaseApp->Connect();
     $obBaseApp->Authenticate($conf['Username'], $conf['Password']);
     $obDomain = $obBaseApp->Domains->ItemByName(substr($user, strpos($user, "@") + 1));
     return $obDomain->Accounts->ItemByAddress($user);
 }
开发者ID:hazarkarabay,项目名称:hmsfromrc,代码行数:9,代码来源:hmsfromrc.php

示例4: GetSystemOption

     $ExMessagePort = '110';
 }
 #Get the hmail domain id for the users mailbox
 $hmaildatabase = GetSystemOption('hmailserver_db');
 $sql = "SELECT accountdomainid FROM hm_accounts WHERE accountid='" . $faaccountid . "'";
 $listaccountdomainid = DataExchange("r", $hmaildatabase, $sql);
 $rowaccountdomainid = mysql_fetch_assoc($listaccountdomainid);
 $faadomainid = $rowaccountdomainid['accountdomainid'];
 #we try to connect to the hmailserver
 $obBaseApp = new COM("hMailServer.Application");
 if (!$obBaseApp) {
     header("location: " . GetNormalModuleURL($returnurl) . "&r=hmcomerror");
     exit;
 }
 #connection established, now we authenticate
 $obBaseApp->Connect();
 // Authenticate the user
 $obBaseApp->Authenticate($Usermailbox, $ExMessageAuth);
 if (!$obBaseApp->Authenticate($Usermailbox, $ExMessageAuth)) {
     header("location: " . GetNormalModuleURL($returnurl) . "&r=hmautherror&mb=" . $Usermailbox . "");
     exit;
 }
 #we have authenticated, and all our variables set up so lets move on...
 $domainid = $faadomainid;
 $accountid = $faaccountid;
 $obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
 $obAccount = $obDomain->Accounts->ItemByDBID($accountid);
 $obFetchAccounts = $obAccount->FetchAccounts();
 $obFA = $obFetchAccounts->Add();
 $obFA->Enabled = '1';
 $obFA->Name = $ExMessageAccount;
开发者ID:shishenkov,项目名称:zpanel,代码行数:31,代码来源:obj_mail.php

示例5: mkdir

 function do_backup()
 {
     $sBAKFilePath = "C:/SQL_Backup";
     if (!is_dir($sBAKFilePath)) {
         mkdir($sBAKFilePath, 0777);
     }
     $dir = "{$sBAKFilePath}/mssql";
     $mode = 0700;
     $sBAKFilePath = $dir . mt_rand(0, 9999999);
     //create unique directory everytime.
     mkdir($sBAKFilePath, $mode);
     $srv = new COM("SQLDMO.SQLServer");
     $srv->LoginSecure = true;
     try {
         $srv->Connect("localhost,1433");
     } catch (Exception $e) {
         throw new lxException('MsSql Connection is Failed', '', '');
     }
     $bkp = new COM("SQLDMO.Backup");
     $dbname = $this->main->dbname;
     $bkp->Database = $dbname;
     $docf = $sBAKFilePath . "/" . $dbname . ".bak";
     $bkp->Files = $docf;
     $bkp->Action = 0;
     //FullBackup
     $bkp->SQLBackup($srv);
     $srv->DisConnect();
     print "{$sBAKFilePath}/" . $dbname;
     return array($sBAKFilePath, array(basename($docf)));
 }
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:30,代码来源:mssqldb__mssqllib.php

示例6: array

<?php

$arr = array('один', 'ляляля', "два");
//phpinfo();
$app = new COM("v82.COMConnector") or die("Невозможно создать COM соединение");
print "<br />Loaded 1Cn<br />";
//Путь к базе и имя пользователя. Третьим параметром
//может выступать пароль пользователя (если задан
//в конфигураторе)
$path = "C:\\1c_basesxtra_abz";
$user = "root";
$pass = '';
//Подсоединяемся к нужной базе
echo 'File="' . $path . '";Usr="' . $user . '";pwd="' . $pass . '"';
try {
    $con = $app->Connect('File="' . $path . '";Usr="' . $user . '";pwd="' . $pass . '"');
} catch (Exception $e) {
    print_r($e);
}
echo "<br />";
echo $con->test($arr) . "|<br />";
//echo iconv("ASCII", "UTF-8", $con->test($arr));
//В качестве проверки результата получаем глобальную
//переменную glCurrUser определенную в модуле внешенего
//соединения 1С Предприятия v8 и инициализированную
//при начале работы системы
$con = null;
$app = null;
开发者ID:sbrilenko,项目名称:vsort,代码行数:28,代码来源:com.php

示例7: doQuery

 function doQuery($action)
 {
     // Note that because of the way in which CAFEphp and FileMaker are implemented, CAFEphp must be running on the same
     // machine that is serving as the web server.  (You'll note that PHP creates a COM object which looks for a locally
     // running application.)  For this same reason, the server IP and port are irrelevant.
     $availableActions = array('-delete', '-edit', '-find', '-findall', '-new', '-sqlquery');
     if (!in_array(strtolower($action), $availableActions)) {
         // first off, toss out any requests for actions NOT supported under CAFEphp
         return new FX_Error("The action requested ({$action}) is not supported in CAFEphp.");
     }
     $CAFEphp_res = new COM('CAFEphp.Application');
     // although username and password are optional for this function, FX.php expects them to be set
     if ($CAFEphp_res == false) {
         return new FX_Error('Unable to load to CAFEphp.');
     }
     if (defined("DEBUG") and DEBUG or DEBUG_FUZZY) {
         $currentDebugString = "<p>CAFEphp version: " . $CAFEphp_res->Version() . "</p>\n";
         $this->FX->lastDebugMessage .= $currentDebugString;
         if (defined("DEBUG") and DEBUG) {
             echo $currentDebugString;
         }
     }
     $theResult = $CAFEphp_res->Connect($this->FX->database, $this->FX->DBUser, $this->FX->DBPassword);
     if ($theResult != 0) {
         $CAFEphp_res->EndConnection();
         switch ($theResult) {
             case -1:
                 return new FX_Error('Unable to connect.  Be sure the FileMaker database and CAFEphp are running.');
                 break;
             case -2:
                 return new FX_Error('Certificate not present.  You MUST have a certificate.');
                 break;
             case -3:
                 return new FX_Error('Certificate is corrupt.');
                 break;
             case -4:
                 return new FX_Error('CAFEphp is not running or the demo version has expired.');
                 break;
             case -5:
                 return new FX_Error('The current demo of CAFEphp has expired.');
                 break;
             default:
                 return new FX_Error('An unknown error has occured while attempting to create the COM object.');
                 break;
         }
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->FX->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->FX->dataQuery)) {
                 return $this->FX->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             if (substr(trim($this->FX->dataQuery), 0, 6) == 'SELECT') {
                 $currentSelect = true;
                 $theResult = $CAFEphp_res->Query($this->FX->dataQuery, $this->FX->groupSize);
             } else {
                 $currentSelect = false;
                 $theResult = $CAFEphp_res->Execute($this->FX->dataQuery);
             }
             if ($theResult < 0) {
                 $CAFEphp_res->EndConnection();
                 switch ($theResult) {
                     case -1:
                         return new FX_Error('No CAFEphp connection for the query.');
                         break;
                     default:
                         return new FX_Error('An unknown error occured during the query.');
                         break;
                 }
             }
             $this->FX->foundCount = $theResult;
             $theResult = $CAFEphp_res->FieldCount();
             if ($theResult < 0) {
                 $CAFEphp_res->EndConnection();
                 switch ($theResult) {
                     case -1:
                         return new FX_Error('No CAFEphp connection for the field count.');
                         break;
                     case -2:
                         return new FX_Error('No query was performed for a field count.');
                         break;
                     default:
                         return new FX_Error('An unknown error occured during the query.');
                         break;
                 }
             } else {
                 $currentFieldCount = $theResult;
             }
             for ($i = 0; $i < $currentFieldCount; ++$i) {
                 $theResult = $CAFEphp_res->FieldName($i);
                 if ($theResult == '$-CAFEphpNOCONNECTION') {
                     $CAFEphp_res->EndConnection();
                     return new FX_Error("No CAFEphp connection while retieving the name of field {$i}.");
                 } elseif ($theResult == '$-CAFEphpNOQUERY') {
//.........这里部分代码省略.........
开发者ID:SmartPCGuy,项目名称:fxphp,代码行数:101,代码来源:RetrieveCafePHP4pcData.class.php


注:本文中的COM::Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。