function UlozFoto($soubor, $typ, &$novy_nazev, $poradi, $chyba) { global $login; if($soubor<>"none") { if($typ=="image/gif") $novy_nazev = $ucitel_login.$poradi.".gif"; else $novy_nazev = $ucitel_login.$poradi.".jpg"; Copy($soubor, "./photos/".$novy_nazev); } }
function WriteToLog($txt, $level) { $this->logLevel = IntVal(COption::GetOptionString("mail", "smtp_log_level", "4")); if ($this->logLevel < $level) { return; } if (MicroTime(true) - $this->startPeriodTimeTruncate > 600) { if ($this->logFile) { FClose($this->logFile); } $this->logFile = null; if (File_Exists($_SERVER["DOCUMENT_ROOT"] . $this->logFileName)) { $logSize = @FileSize($_SERVER["DOCUMENT_ROOT"] . $this->logFileName); $logSize = IntVal($logSize); if ($logSize > $this->logMaxSize) { if (($fp = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "rb")) && ($fp1 = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", "wb"))) { $iSeekLen = IntVal($logSize - $this->logMaxSize / 2.0); FSeek($fp, $iSeekLen); @FWrite($fp1, "Truncated " . Date("Y-m-d H:i:s") . "\n---------------------------------\n"); do { $data = FRead($fp, 8192); if (StrLen($data) == 0) { break; } @FWrite($fp1, $data); } while (true); @FClose($fp); @FClose($fp1); @Copy($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", $_SERVER["DOCUMENT_ROOT"] . $this->logFileName); @UnLink($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_"); } } ClearStatCache(); } $this->startPeriodTimeTruncate = MicroTime(true); } if (!$this->logFile || $this->logFile == null) { $this->logFile = FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "a"); } if (!$this->logFile) { echo "Can't write to log\n---------------------------------\n"; return; } FWrite($this->logFile, Date("Y-m-d H:i:s") . "\t" . trim($txt) . "\n"); FFlush($this->logFile); //if ($level > 4) echo trim($txt) . "\n---------------------------------\n"; }
} //updating 'ICON' (image) global $icon; global $icon_name; global $delete_icon; if ($icon!="" && file_exists($icon) && (!$delete_icon)) { $filename=strtolower(basename($icon_name)); $ext=strtolower(end(explode(".",basename($icon_name)))); if ( (filesize($icon)<=(0*1024) || 0==0) && (Is_Integer(strpos('gif jpg png', $ext))) ) { $filename=$rec["ID"]."_icon_".time().".".$ext; if ($rec["ICON"]!='') { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); } Copy($icon, ROOT.'./cms/calendar/'.$filename); $rec["ICON"]=$filename; SQLUpdate($table_name, $rec); } } elseif ($delete_icon) { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); $rec["ICON"]=''; SQLUpdate($table_name, $rec); } $out['OK']=1; } else { $out['ERR']=1; } } if (is_array($rec)) { foreach($rec as $k=>$v) {
// first device added, need reboot } } //updating 'MIB_FILE' (file) global $mib_file; global $mib_file_name; global $delete_mib_file; if ($mib_file != "" && file_exists($mib_file) && !$delete_mib_file) { $filename = strtolower(basename($mib_file_name)); $ext = strtolower(end(explode(".", basename($mib_file_name)))); if (filesize($mib_file) <= 0 * 1024 || 0 == 0) { $filename = $rec["ID"] . "_mib_file_" . time() . "." . $ext; if ($rec["MIB_FILE"] != '') { @Unlink(ROOT . './cms/snmpdevices/' . $rec["MIB_FILE"]); } Copy($mib_file, ROOT . './cms/snmpdevices/' . $filename); $rec["MIB_FILE"] = $filename; SQLUpdate($table_name, $rec); } } elseif ($delete_mib_file) { @Unlink(ROOT . './cms/snmpdevices/' . $rec["MIB_FILE"]); $rec["MIB_FILE"] = ''; SQLUpdate($table_name, $rec); } if ($rec['ID']) { $properties = SQLSelect("SELECT * FROM snmpproperties WHERE DEVICE_ID='" . $rec['ID'] . "'"); $total = count($properties); for ($i = 0; $i < $total; $i++) { global ${'oid_' . $properties[$i]['ID']}; global ${'type_' . $properties[$i]['ID']}; global ${'ptitle_' . $properties[$i]['ID']};
$rec['ID'] = SQLInsert($table_name, $rec); // adding new record } //updating 'IMAGE' (image) global $image; global $image_name; global $delete_image; if ($image != "" && file_exists($image) && !$delete_image) { $filename = strtolower(basename($image_name)); $ext = strtolower(end(explode(".", basename($image_name)))); if ((filesize($image) <= 0 * 1024 || 0 == 0) && Is_Integer(strpos('gif jpg png', $ext))) { $filename = $rec["ID"] . "_image_" . time() . "." . $ext; if ($rec["IMAGE"] != '') { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); } Copy($image, ROOT . './cms/products//' . $filename); $rec["IMAGE"] = $filename; SQLUpdate($table_name, $rec); } } elseif ($delete_image) { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); $rec["IMAGE"] = ''; SQLUpdate($table_name, $rec); } $out['OK'] = 1; } else { $out['ERR'] = 1; } } // step: default if ($this->tab == '') {
<?php include "./inc/redakce.inc"; $redakce = new CLASS_REDAKCE(); include "./inc/form.inc"; $LocalImageDir = "/testwebs/kyberia/images/"; $LocalTitleImageDir = "/testwebs/kyberia/title_images/"; if ($submit == "update") { Copy($title_image, $LocalTitleImageDir . $title_image_name); Copy($image, $LocaImageDir . $image_name); $redakce->updateArticle($HTTP_POST_VARS, $title_image_name, $image_name); } $set = $redakce->getArticle($id); $set->next(); echo "<html><head><link rel=stylesheet type=\"text/css\" href=\"./kyberia.css\"></head>"; $form = new HTML_Form($PHP_SELF, "POST", "", "multipart/form-data"); echo "<html><head><title>Pridanie clanku</title></head><body>\n"; $redakce->listArticles(); echo "<body><table><tr>\n"; $form->addText("nazov", "Nazov:", $set->getString('nazov')); $form->addText("autor", "Autor:", $set->getString('nazov')); $form->addSelect("id_rubrika", "Rubrika", $redakce->listRubrikyArray()); $form->addSelect("id_rubrika_secondary", "Sekundarna rubrika", $redakce->listRubrikyArray()); $form->addText("id_forum", "ID forum:", $set->getString('id_forum')); $form->addText("id_forum_secondary", "ID forum sekundarne:", $set->getString('id_forum_secondary')); $form->addTextarea("short_desc", "Kratky popis", $set->getString('short_desc'), 40, 6); $form->addTextarea("text", "Text:", $set->getString('text'), 40, 6); $form->addSubmit("submit", "update", ""); $form->display(); echo "</body></html>";
function Img($Image, $Dw = 200, $Dh = 300, $Type = 2) { if (!File_Exists($Image)) { return False; } #如果需要生成缩略图,则将原图拷贝一下重新给$Image赋值 // IF($Type!=1){ Copy($Image, Str_Replace(".", "_x.", $Image)); $Image = Str_Replace(".", "_x.", $Image); // } var_dump($Image); #取得文件的类型,根据不同的类型建立不同的对象 $ImgInfo = GetImageSize($Image); var_dump($ImgInfo); switch ($ImgInfo[2]) { case 1: $Img = @ImageCreateFromGIF($Image); break; case 2: $Img = @ImageCreateFromJPEG($Image); break; case 3: $Img = @ImageCreateFromPNG($Image); break; } #如果对象没有创建成功,则说明非图片文件 if (empty($Img)) { #如果是生成缩略图的时候出错,则需要删掉已经复制的文件 if ($Type != 1) { Unlink($Image); } return False; } #如果是执行调整尺寸操作则 if ($Type == 1) { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; if ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; } } elseif ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; } } else { $width = $width; $height = $height; } $nImg = ImageCreateTrueColor($width, $height); #新建一个真彩色画布 ImageCopyReSampled($nImg, $Img, 0, 0, 0, 0, $width, $height, $w, $h); #重采样拷贝部分图像并调整大小 ImageJpeg($nImg, $Image); #以JPEG格式将图像输出到浏览器或文件 return True; #如果是执行生成缩略图操作则 } else { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; $nImg = ImageCreateTrueColor($Dw, $Dh); if ($h / $w > $Dh / $Dw) { #高比较大 $width = $Dw; $height = $h * $Dw / $w; $IntNH = $height - $Dh; ImageCopyReSampled($nImg, $Img, 0, -$IntNH / 1.8, 0, 0, $Dw, $height, $w, $h); } else { #宽比较大 $height = $Dh; $width = $w * $Dh / $h; $IntNW = $width - $Dw; ImageCopyReSampled($nImg, $Img, -$IntNW / 1.8, 0, 0, 0, $width, $Dh, $w, $h); } ImageJpeg($nImg, $Image); return True; } }
$form->addfile("title_image", "Titulni Obrazok:"); $form->addfile("image1", "Obrazok:"); $form->addfile("image2", "Obrazok:"); $form->addhidden("id", $id); $form->addfile("image3", "Obrazok:"); $form->addSelect("id_rubrika", "Rubrika", $redakce->listRubrikyArray()); $form->addSelect("id_rubrika_secondary", "Sekundarna rubrika", $redakce->listRubrikyArray()); $form->addTextarea("short_desc", "Kraktky popis", $article->getString("short_desc"), 40, 6); $form->addTextarea("text1", "Text:", stripslashes($article->getString("text1")), 80, 23); $form->addTextarea("text2", "Text:", stripslashes($article->getString("text2")), 40, 6); $form->addTextarea("text3", "Text:", stripslashes($article->getString("text3")), 40, 6); $form->addTextarea("keywords", "Keywords:", stripslashes($article->getString("keywords")), 40, 6); $form->addSubmit("submit", "pridaj", ""); $form->display(); echo "</body></html>"; } if ($submit == "pridaj") { if (isset($title_image)) { Copy($title_image, $LocalImageDir . $title_image_name); } if (isset($image1)) { Copy($image1, $LocaImageDir . $image1_name); } if ($image2 != "") { Copy($image2, $LocaImageDir . $image2_name); } if ($image3 != "") { Copy($image3, $LocaImageDir . $image3_name); } $redakce->updateArticle($HTTP_POST_VARS); }
<?php include "../inc/redakce.inc"; $redakce = new CLASS_REDAKCE(); include "../inc/form.inc"; $ltid = "/home/webs/www.kyberia.sk/images/rubriky/"; echo $submit; if ($submit == "pridajrubriku") { echo $ltid; if (isset($obrazok)) { Copy($obrazok, $ltid . $obrazok_name); } $redakce->addRubrika($HTTP_POST_VARS, $obrazok_name, $obrazok_articles_name); } if ($submit == "pridajtitle") { $redakce->addTitle($HTTP_POST_VARS); } if ($submit == "pridajintro") { $redakce->addIntro($HTTP_POST_VARS); } if ($submit == "pridajskin") { $redakce->addSkin($nazov, $address); } $form = new HTML_Form($PHP_SELF, "POST", "", "multipart/form-data"); echo "<html><head><title>Pridanie rubriky</title></head><body>\n"; $form->addText("nazov", "Nazov:", ""); $form->addFile("obrazok", "Obrazok:", ""); $form->addSelect("id_parent", "Rodicovska rubrika", $redakce->listRubrikyArray()); $form->addSubmit("submit", "pridajrubriku", ""); $form->display(); echo "<br>";
<?php #------------------------------------------------------------------------------- $Path = SPrintF('%s/styles/%s/Images', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- $Sign = SPrintF('%s/Sign.bmp', $Path); #------------------------------------------------------------------------------- if (!File_Exists($Sign)) { return TRUE; } #------------------------------------------------------------------------------- if (!@Copy($Sign, SPrintF('%s/dSign.bmp', $Path))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!@Copy($Sign, SPrintF('%s/aSign.bmp', $Path))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!@UnLink($Sign)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
<?php #------------------------------------------------------------------------------- $Path = SPrintF('%s/%s/Images/LogoMono.bmp', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- if (File_Exists($Path)) { #----------------------------------------------------------------------------- if (!Copy($Path, SPrintF('%s/%s/Images/Logo.bmp', SYSTEM_PATH, HOST_ID))) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- UnLink($Path); } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
<?php //checks if username exists, else creates account include "config.php"; $myusername = $_POST['username']; $mypassword = $_POST['password']; $email = $_POST['email']; $sql = "SELECT id_merchant FROM merchant WHERE username='******' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $active = $row['active']; $count = mysql_num_rows($result); if ($myusername == "index") { $count = 1; } if ($count == 0) { $filehandle = fopen($_SERVER['DOCUMENT_ROOT'] . "/main/market/{$myusername}.php", "wb"); fclose($filehandle); Copy($_SERVER['DOCUMENT_ROOT'] . "/main/market/base/abc.php", $_SERVER['DOCUMENT_ROOT'] . "/main/market/{$myusername}.php"); $sql = "SELECT max(id_merchant) FROM merchant"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $idfetch = $row[0] + 1; $sql = "INSERT INTO merchant values({$idfetch}, '{$myusername}','{$email}','{$mypassword}')"; $result = mysql_query($sql); //create file in market folder for showroom(virtual market) for companies in stealth mode echo "<script type='text/javascript'>window.location = 'signup.php?flag=1'</script>"; } else { echo "<script type='text/javascript'>window.location = 'signup.php?flag=2'</script>"; }
public function Install_Template() { # Was this a Post request with data enctype? if (!Is_Array($_FILES) || empty($_FILES)) { return False; } # Check the files foreach ($_FILES as $field_name => $arr_file) { if (!Is_File($arr_file['tmp_name'])) { unset($_FILES[$field_name]); } } # Check if there are uploaded files if (empty($_FILES)) { return False; } # Create template dir if (!Is_Dir($this->template_dir)) { MkDir($this->template_dir); ChMod($this->template_dir, 0755); } # Copy the template file if (isset($_FILES['template_zip'])) { # Install the ZIP Template $zip_file = $_FILES['template_zip']['tmp_name']; require_once 'includes/file.php'; WP_Filesystem(); return UnZip_File($zip_file, $this->template_dir); } elseif (isset($_FILES['template_php']) && $this->Get_Template_Properties($_FILES['template_php']['tmp_name'])) { # Install the PHP Template $php_file = $_FILES['template_php']['tmp_name']; $template_name = BaseName($_FILES['template_php']['name'], '.php'); # Create dir and copy file if (!Is_Dir($this->template_dir . '/' . $template_name)) { MkDir($this->template_dir . '/' . $template_name); ChMod($this->template_dir . '/' . $template_name, 0755); } Copy($php_file, $this->template_dir . '/' . $template_name . '/' . $template_name . '.php'); ChMod($this->template_dir . '/' . $template_name . '/' . $template_name . '.php', 0755); } else { return False; } # Template installed return True; }
?> "><input type="text" name="folder"><input type="submit" value="Create"></p></form></body></html><?php } elseif ($filebrowser->action == 'getfile') { Header('Status: 200'); Header('Content-Type: application/' . PathInfo($filebrowser->file, PATHINFO_EXTENSION)); Header(SPrintF('Content-Disposition: attachment; filename="%s"', BaseName($filebrowser->file))); Header('Content-Length:' . FileSize($filebrowser->file)); ReadFile($filebrowser->file); exit; } elseif ($filebrowser->action == 'delfile') { Unlink($filebrowser->file); Header('Status: 307'); Header('Location: ' . $filebrowser->build_link('browse', DirName($filebrowser->file))); exit; } elseif ($filebrowser->action == 'uploadfile') { Copy($_FILES['file']['tmp_name'], $filebrowser->directory . $_FILES['file']['name']); Header('Status: 307'); Header('Location: ' . $filebrowser->build_link('browse', $filebrowser->directory)); exit; } elseif ($filebrowser->action == 'createfolder') { $new_folder = $filebrowser->directory . Trim($_REQUEST['folder']); MKDir($new_folder, 0777, True); Header('Status: 307'); Header('Location: ' . $filebrowser->build_link('browse', $filebrowser->directory)); exit; } elseif ($filebrowser->action == 'delfolder') { $filebrowser->delete_folder($filebrowser->directory); Header('Status: 307'); Header('Location: ' . $filebrowser->build_link('browse', DirName($filebrowser->directory))); exit; }
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Path = $File['tmp_name']; #------------------------------------------------------------------------------- $Hash = Md5(Time() + Rand(100, 999)); #------------------------------------------------------------------------------- $Uploads = SPrintF('%s/uploads', $Tmp); #------------------------------------------------------------------------------- if (!File_Exists($Uploads)) { if (!@MkDir(SPrintF('%s/uploads', $Tmp), 0777, TRUE)) { return ERROR | @Trigger_Error(500); } } #------------------------------------------------------------------------------- if (!Copy($Path, SPrintF('%s/%s', $Uploads, $Hash))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Name = $File['name']; #------------------------------------------------------------------------------- $NamesPath = SPrintF('%s/names.txt', $Uploads); #------------------------------------------------------------------------------- $Names = Is_Error($Names = IO_Read($NamesPath)) ? array() : JSON_Decode($Names, true); #------------------------------------------------------------------------------- $Names[$Hash] = $Name; #------------------------------------------------------------------------------- $IsWrite = IO_Write($NamesPath, JSON_Encode($Names), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); }
"abcdefghijklmnopqrstuvwxyz0123456789-_.")<>StrLen($nazev) or $nazev=="") $chyba .= "<li>nový název pøilo¾eného souboru nesmí být prázdný a mù¾e obsahovat pouze tyto znaky: <br> a-z, A-Z, 0-9, ., _, - </li>"; else { $pom = explode(".", $nazev); if($pom[1]=="") { $pom2 = explode(".", $soubor_name); $nazev .= ".".$pom2[count($pom2)-1]; } $novy = c_files."files_kalendar/$nazev"; if(file_exists($novy)) $chyba .= "<li>soubor se stejným názvem jste u¾ v minulosti ulo¾il(a)</li>"; else { Copy($soubor, $novy); $velikost = $soubor_size; $platnost_do = Datum_datab($platnost_do); $SQL = "insert into soubory (login_uc, nazev, popis, velikost, trida, predmet, datum, typ) values ('$login', '$nazev', '$popis', '$velikost', '$trida', '$predmet', Now(), 'akce')"; DB_insert($SQL, $id_soub); } $SQL = "update kalendar set id_soub='$id_soub' where id = '$id_akce'"; DB_exec($SQL); } } } } } else if($odstranit_soubor<>"")