本文整理汇总了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);
示例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>";