예제 #1
0
파일: fetch.php 프로젝트: iamanony/b64trans
function fetchPage($r, $f, $m, $mode)
{
    $c = access_url($r);
    //$output will be written in a file.
    //$out will be printed.
    $encoded = '';
    if ($mode == "enc") {
        $output = base64_encode($c[0]);
        $encoded .= encodeString($output);
        $out = "[" . $encoded . "]";
    } else {
        if ($mode == "raw") {
            $out = $c[0];
            $output = base64_encode($c[0]);
        } else {
            if ($mode == "script") {
                $output = base64_encode($c[0]);
                $out = 'eval(Base64.decode("' . $output . '"));';
            }
        }
    }
    $hrh = $c[1];
    if (strlen($encoded) == 0) {
        $encoded = encodeString($output);
    }
    $ContentType = getheader($hrh, "Content-type");
    $Filename = getheader($hrh, "Filename");
    //Generate json data
    $arrayData = array();
    $arrayData["Content-type"] = $ContentType;
    $arrayData["Request-url"] = $r;
    $arrayData["md5sum"] = md5($encoded);
    $arrayData["Filename"] = $Filename;
    $jsonData = json_encode($arrayData);
    if (!$mode == "enc") {
        print "(" . base64_encode($jsonData) . ")\n";
    } else {
        header("Content-type: " . $ContentType, true);
        header("Filename: " . $Filename, true);
    }
    if (ENABLE_CACHE) {
        $o = gzopen($f, GZ_WRITE_MODE);
        @gzwrite($o, "[");
        @gzwrite($o, $output);
        @gzwrite($o, "]");
        @gzwrite($o, "(");
        @gzwrite($o, $jsonData);
        @gzwrite($o, ")");
        @gzclose($o);
    }
    echo $out;
}
예제 #2
0
    $oimgpath2 = substr($oimgpath, strripos($oimgpath, "."));
    //去除尺寸数据
    //$oimgpath = $oimgpath1."_y".$oimgpath2;
    $oimgpath = $oimgpath1 . $oimgpath2;
    if (strpos($oimgpath, '/Data/Shop/') !== false) {
        $data = array();
        $data['filePath'] = substr($oimgpath, strpos($oimgpath, '/Data/Shop/') + 11);
        $data['width'] = $width;
        $data['height'] = $height;
        $data['newfile'] = substr($imgpath, strpos($imgpath, '/Data/Shop/') + 11);
        //$data['newfile'] = str_replace('_y',"_".$size,$data['filePath']);
        $data = shop_imageIntercept($data);
        $pathinfo = json_decode($data, true);
        if (is_array($pathinfo)) {
            if (@file_exists($localfile)) {
                getheader($imgpath);
                echo file_get_contents($localfile, 'r');
                exit;
            }
        }
    }
}
//获取扩展
function getheader($file)
{
    $file = strtolower($file);
    if (strpos($file, '.jpg') !== false) {
        header("Content-type: image/jpeg");
    } elseif (strpos($file, '.jpeg') !== false) {
        header("Content-type: image/jpeg");
    } elseif (strpos($file, '.gif') !== false) {
예제 #3
0
<?php 
include "headers.php";
include "container.php";
getheader();
if ($_SESSION['user_id'] == '') {
    header('location:index.php');
}
?>
<script src="./content/jquery.js"></script>
<!-- JQUERY -->
<link href="jquery.custom.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(function() {
    $( "#admission" ).datepicker({dateFormat: 'yy-mm-dd'});
	
});
$(function() {
    $( "#graduation" ).datepicker({dateFormat: 'yy-mm-dd'});
	
});
</script>
<script type="text/javascript">

function nameSearch(str,divid)
	{
			
		if (str.length<2)
		{ 
예제 #4
0
function showdiff($old_host, $old_user, $old_pass, $old_db, $sqls, $errors = array(), $keys = array())
{
    getheader("对比结果");
    $table_html = '';
    foreach ($sqls as $key => $sql) {
        $table_html .= '<tr><td><input type="checkbox" name="keys[]" id="key_' . $key . '" value="' . $key . '"' . (in_array($key, $keys) ? 'checked="checked"' : '') . ' /></td><td><label for="key_' . $key . '">' . htmlentities($sql) . '</label></td></tr>';
    }
    $server_html = '<input type="hidden" name="old_host" value="' . $old_host . '" /><input type="hidden" name="old_user" value="' . $old_user . '" /><input type="hidden" name="old_pass" value="' . $old_pass . '" /><input type="hidden" name="old_db" value="' . $old_db . '"/>';
    $error_html = "<div>";
    if (!empty($errors)) {
        foreach ($errors as $error) {
            $error_html .= "<p class='red'>" . $error . "</p>";
        }
    }
    $error_html .= "</div>";
    $form_html = '
<div style="margin:20px 200px 30px 200px;">
	<div class="title">对比结果 —— MySQL_DB_Diff </div>
	' . $error_html . '
	<p>共' . count($sqls) . '条</p>
	<form method="POST">
		<table width="100%" border="0" cellpadding="5" cellspacing="0">
			' . $table_html . '
			<tr>
				<td><input type="hidden" name="action" value="write" /><input type="hidden" name="sqls" value="' . htmlentities(serialize($sqls)) . '" />' . $server_html . '</td>
				<td><input type="submit" name="submit" value="提交" onclick="return confirm(\'确认要执行指定SQL吗?\')"/></td>
			</tr>
		</table>
	</form>
</div>';
    echo $form_html;
    getfooter();
}
예제 #5
0
 /**
  * upload_remoto efetua o download/copia de uma imagem de outro servidor pra esse
  * @param string a url da imagem
  * @return string nome/endereço da imagem ou mensagem em caso de erro
  */
 private function upload_remoto($url = '', $tipo = 'upload_remote')
 {
     $imgs = isset($_SESSION['imgs_upadas']) ? $_SESSION['imgs_upadas'] : array();
     if (count($imgs) >= $this->__config['uploadMax']) {
         return '["' . $tipo . '", "erro", "' . $this->msgs['limite_uploads'] . '"]';
     }
     $url = urldecode($url);
     if (!val('url', $url)) {
         return '["' . $tipo . '", "erro", "' . $this->msgs['url_invalido'] . '"]';
     }
     $header = getheader($url);
     if (!is_array($header)) {
         return '["' . $tipo . '", "erro", "' . $this->msgs['servidor_nao_respondeu'] . '"]';
     }
     if ($header['http_code'] != 200 && isset($this->__config['http_code'][$header['http_code']])) {
         $erro = str_replace('%file%', $url, $this->__config['http_code'][$header['http_code']]);
         return '["' . $tipo . '", "erro", "' . $erro . '"]';
     }
     if (!isset($header['download_content_length']) || $header['download_content_length'] == 0) {
         return '["' . $tipo . '", "erro", "' . str_replace('%file%', $url, $this->msgs['servidor_nao_tamanho']) . '"]';
     }
     if ($header['download_content_length'] > $this->__config['_tamanho']) {
         return '["' . $tipo . '", "erro", "' . $this->msgs['arquivo_muito_grande'] . '"]';
     }
     $mime = $header['content_type'];
     $is_image = $this->is_image($mime);
     if (!$is_image) {
         return '["' . $tipo . '", "erro", "' . $this->msgs['arquivo_incorreto'] . '"]';
     }
     $img = file_get_contents($url);
     if ($img) {
         $nome = gerar_nome_valido($is_image, $this->__config['diretorio']);
         if (file_put_contents($this->__config['diretorio'] . $nome, $img)) {
             require_once 'classes/upload/class.upload.php';
             $new_img = new Upload($this->__config['diretorio'] . $nome, 'pt_BR');
             $new_img->image_max_width = $this->__config['larguraMax'];
             $new_img->image_max_height = $this->__config['alturaMax'];
             $new_img->image_resize = $this->__config['resize'];
             $new_img->image_ratio_x = true;
             $new_img->image_ratio_y = true;
             $new_img->image_x = $this->__config['img_x'];
             $new_img->image_y = $this->__config['img_y'];
             $new_img->image_convert = $this->__config['convert_to'];
             $new_img->jpeg_quality = $this->__config['jpeg_quality'];
             $new_img->image_text = $this->__config['image_text'];
             $new_img->image_text_direction = $this->__config['image_text_direction'];
             $new_img->image_text_color = $this->__config['image_text_color'];
             $new_img->image_text_percent = $this->__config['image_text_percent'];
             $new_img->image_text_position = $this->__config['image_text_position'];
             $new_img->image_text_alignment = $this->__config['image_text_alignment'];
             $new_img->process($this->__config['diretorio']);
             if ($new_img->processed) {
                 $new_img->clean();
                 clearstatcache();
                 $this->set($new_img->file_dst_name);
                 return '["' . $tipo . '", "' . $new_img->file_dst_name . '"]';
             } else {
                 $new_img->clean();
                 @unlink($this->__config['diretorio'] . $new_img->file_dst_name);
                 clearstatcache();
                 return '["' . $tipo . '", "erro", "' . $new_img->error . '"]';
             }
         } else {
             return '["' . $tipo . '", "erro", "' . $this->msgs['nao_copio_image'] . '"]';
         }
     } else {
         return '["' . $tipo . '", "erro", "' . $this->msgs['nao_copio_image'] . '"]';
     }
     return '["' . $tipo . '", "erro", "' . $this->msgs['erro_desconhecido'] . '"]';
 }