Autor Zpráva
26lukas26
Profil
Ahoj potreboval by som upravit tento skript tak aby po uploade obrazok zobrazoval v urcitom rozliseni a url obrazku nebola taka ista ako bola nahravana ale aby bola napr šifrovana "img87aas.png" dakujem

<script language='Javascript'>
function replace(string,text,by) {
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
function doact(a, d)
{
	if (a == 's')
	{
		var dod = eval("document.result."+d);
		dod.focus();
		dod.select();
	}
	else if (a == 'c')
	{
		var doc = eval("document.result."+d);
		cp = doc.createTextRange();
		doc.focus();
		doc.select();
		cp.execCommand("Copy");
	}
	else if (a == 'v')
	{
		var dob = eval("document.result."+d);
		var c = dob.value;
		code = replace(c,'<','<');
		code = replace(code,'>','>');
		code = replace(code,'<br>','\n');
		code = replace(code,'\n','<br>');
		nwin = open('', 'Code', 'toolbar=no,location=no,scrollbars=yes,resizable=no,statusbar=no,top=0,width=500,height=500');
		nwin.document.open();
		nwin.document.write("<title>View Code</title><style type='text/css'><!--a:link {color: #000000;text-decoration: none;}a:visited {color: #000000;text-decoration: none;}a:hover {color: #000000;text-decoration: underline;}.table {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 9px;color: #000000;}input {font-family: Verdana;font-size: 9px;color: #000000;background-color: #A2AEC5;border: 1px solid #000000;}.textarea {font-family: Verdana;font-size: 9px;color: #000000;background-color: #A2AEC5;border: 1px solid #000000;}.hidden {VISIBILITY: hidden; POSITION: static}.show {VISIBILITY: visible; POSITION: static}
		</style><body bgcolor='#7A8AAA'><center><div align='justify'><table width='90%' height='211' border='0' align='center' cellpadding='3' cellspacing='3' class='table' style='background-color: #8E9EBA; border: 1px solid black'><tr><td align='justify' valign='top'>");
		nwin.document.write(code);
		nwin.document.write("</td></tr></table><center><p><span style='font-family: Verdana; font-size: 9px; color: #000000;'><a href='javascript:location.reload()'>Reload</a> - <a href='javascript:self.close()'>Close Window</a></span></div>");
		nwin.document.close();
	}
}
</script>-->
</head>
<body>
	<table width="100%" cellspacing="1" id="submenu" align="right">
		<tr>
			<td valign="top"> <img src="http://levade.homeip.net/fszone/forums/style_images/1/tile_back_small.gif" width="100%" height="22"> 
			<font size="4" color="3A4F6C">
			<div align="center">
			Upload
			<br>
			</font>
			<font size="1" color="3A4F6C">

<!--Upload form-->

<?php

error_reporting(0);

$site_name = $_SERVER['HTTP_HOST'];
$url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this =  "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

$upload_dir = "upload_files/";
$upload_url = $url_dir."/upload_files/";
$message ="";

//create upload_files directory if not exist
//If it does not work, create on your own and change permission.
if (!is_dir("upload_files")) {
	die ("upload_files directory doesn't exist");
}

if ($_FILES['userfile']) {
	$message = do_upload($upload_dir, $upload_url);
}
else {
	$message = "";
}

print $message;

function do_upload($upload_dir, $upload_url) {

	$temp_name = $_FILES['userfile']['tmp_name'];
	$file_name = $_FILES['userfile']['name']; 
	$file_type = $_FILES['userfile']['type']; 
	$file_size = $_FILES['userfile']['size']; 
	$result    = $_FILES['userfile']['error'];
	$file_url  = $upload_url.$file_name;
	$file_path = $upload_dir.$file_name;

	//File Name Check
    if ( $file_name ==".jpg .png .jpeg .gif") { 
    	$message = "Invalid File Name Specified, be sure its a '.jpg'";
    	return $message;
    }
    //File Size Check
    else if ( $file_size > 1024000) {
        $message = "The file size is too big.";
        return $message;
    }
    //File Type Check
    else if ( $file_type == "text/plain" ) {
        $message = "Sorry, You cannot upload any script file" ;
        return $message;
    }

    $result  =  move_uploaded_file($temp_name, $file_path);
    $message = ($result)?"[IMG]<a href=$file_url>$file_url</a>[/IMG]" :
    	      "Somthing is wrong with uploading the image.";

    return $message;
}
?>
			<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
			<br><br>
			Upload Image
			<br>
			<input type="file" id="userfile" name="userfile">
			<input type="submit" name="upload" value="Upload">
			</form>  
			</font>
			<br>
			<font size="2" color="red">
			Please Click Upload Only ONCE! May Take A While To Upload!
			</font>
			<br><br>
			<font size="3" color="3A4F6C">
			Please Note The Following Guidelines:
			<br>
			</font>
			<font size="1.5" color="3A4F6C">
			- Max picture size of 1024 KB's
			<br>
			- Only accepts '.jpg'
			<br>
			-If you have problems please <a href="mailto:Martymydog@aol.com?subject=Image Uploader&">E-Mail us</a>. (Martymydog@aol.com)
			</div>
fuckin
Profil *
si myslis ze ti tady bude nekdo prepisovat cely kod a jeste k tomu kod ktery urcite neni tvuj? Chyba...
26lukas26
Profil
aha tak nic.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0