當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crypt::getCrypt方法代碼示例

本文整理匯總了PHP中Crypt::getCrypt方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt::getCrypt方法的具體用法?PHP Crypt::getCrypt怎麽用?PHP Crypt::getCrypt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crypt的用法示例。


在下文中一共展示了Crypt::getCrypt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: launchBackup


//.........這裏部分代碼省略.........
             //Ajout du cryptage
             $fe = @fopen($path_name, "a");
             if (!$fe) {
                 $report[] = stop("The file {$path_name} could not be opened", $logid);
                 $result = array("logid" => $logid, "report" => $report);
                 return $result;
             }
             fwrite($fe, "#Crypt : 1\r\n");
             $ftemp = @fopen($temp_path_name, "r");
             if (!$ftemp) {
                 $report[] = stop("Temporary file for SQL export could not be opened for crypting", $logid);
                 $result = array("logid" => $logid, "report" => $report);
                 return $result;
             }
             if ($res->sauv_sauvegarde_key1 == "") {
                 $cle1 = $sauvegarde_cle_crypt1;
             } else {
                 $cle1 = $res->sauv_sauvegarde_key1;
             }
             if ($res->sauv_sauvegarde_key2 == "") {
                 $cle2 = $sauvegarde_cle_crypt2;
             } else {
                 $cle2 = $res->sauv_sauvegarde_key2;
             }
             $cr = new Crypt($cle1, $cle2);
             $to_crypt = fread($ftemp, filesize($temp_path_name));
             fclose($ftemp);
             $ftemp = @fopen($temp_path_name, "w+");
             if (!$ftemp) {
                 $report[] = stop("Temporary file for SQL export could not be opened for crypting", $logid);
                 $result = array("logid" => $logid, "report" => $report);
                 return $result;
             }
             fwrite($ftemp, $cr->getCrypt("PMBCrypt"));
             fwrite($ftemp, $cr->getCrypt($to_crypt));
             write_log("Crypt OK : Crypting file is OK", $logid);
             $result[] = "Crypt OK : Crypting file is OK";
             fclose($ftemp);
             //
         } else {
             //			$result[] = $msg["sauv_misc_end_message"];
         }
         //Succeed - Executer cette requete si le fichier a bien été crée
         $requete = "update sauv_log set sauv_log_succeed=1 where sauv_log_id=" . $logid;
         @mysql_query($requete);
         $fe = @fopen($path_name, "a");
         $fsql = @fopen($temp_path_name, "rb");
         if (!$fe || !$fsql) {
             $report[] = stop("Could not create final file", $logid);
             $result = array("logid" => $logid, "report" => $report);
             return $result;
         }
         //$to_happend=fread($fsql,filesize($temp_file));
         //fwrite($fe,"#data-section\r\n".$to_happend);
         // MaxMan: modified because this error:
         //Fatal error: Allowed memory size of 8388608 bytes exhausted
         //(tried to allocate 6495315 bytes) in
         ///var/www/pmb/admin/sauvegarde/end_save.php on line 52
         fwrite($fe, "#data-section\r\n");
         do {
             $to_append = fread($fsql, 8192);
             if (strlen($to_append) == 0) {
                 break;
             }
             fwrite($fe, $to_append);
         } while (true);
開發者ID:bouchra012,項目名稱:PMB,代碼行數:67,代碼來源:pmbesBackup.class.php

示例2: abort

}
fwrite($fe, "#Crypt : 1\r\n");
$ftemp = @fopen($temp_file, "r");
if (!$ftemp) {
    abort("Temporary file for SQL export could not be opened for crypting", $logid);
}
if ($res->sauv_sauvegarde_key1 == "") {
    $cle1 = $sauvegarde_cle_crypt1;
} else {
    $cle1 = $res->sauv_sauvegarde_key1;
}
if ($res->sauv_sauvegarde_key2 == "") {
    $cle2 = $sauvegarde_cle_crypt2;
} else {
    $cle2 = $res->sauv_sauvegarde_key2;
}
$cr = new Crypt($cle1, $cle2);
$to_crypt = fread($ftemp, filesize($temp_file));
fclose($ftemp);
$ftemp = @fopen($temp_file, "w+");
if (!$ftemp) {
    abort("Temporary file for SQL export could not be opened for crypting", $logid);
}
fwrite($ftemp, $cr->getCrypt("PMBCrypt"));
fwrite($ftemp, $cr->getCrypt($to_crypt));
write_log("Crypt OK : Crypting file is OK", $logid);
fclose($ftemp);
echo "</form></body></html>";
//Suite de la sauvegarde
echo "<script>document.sauv.action=\"end_save.php\"; document.sauv.submit();</script>";
echo "</div>";
開發者ID:bouchra012,項目名稱:PMB,代碼行數:31,代碼來源:crypt.php


注:本文中的Crypt::getCrypt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。