Jump to content

Mencarta

Members
  • Content Count

    182
  • Joined

  • Last visited

Posts posted by Mencarta

  1. java script:

    function changeOpacity(var opacity){	// CSS3	document.getElementById("gallery-pic").style.opacity = opacity / 100;	// IE	document.getElementById("gallery-pic").style.filter = "alpha(opacity=" + opacity + ")";}

    For some strange reason this code won't work. Nothing is wrong with it as far as I can tell. Any help would be greatly appreciated.

  2. I have created a design for a wiki for the site ROBLOX. I was wondering what I could do to improve it. All suggestions are appreciated. Thanks.Design 1.0:design.png

  3. Doesn't work. I modified to the code to:upload.php

    <?php	$links = 5242880;	$pics = 2060451840;	$pptx = 2060451840;	$path = "http://localhost/projects";		if (isset($_POST["type"])) {		if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {			if ($_POST["type"] == "pptx" && $_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.presentationml.presentation") {				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				if ($handle = opendir("pptx")) {					$size = 0;					while (false !== ($file = readdir($handle))) {						$size += filesize($path."/gallery/".$file);					}				}				if ($size >= $pptx) {					$files = 0;					while (false !== ($file = readdir($handle1))) {						if ($files == 3) break;						unlink($file);					}				}				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}			if ($_POST["type"] == "scrapbooks" || $_POST["type"] == "gallery" && $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/gif") {				if ($handle = opendir("scrapbooks")) {					$size = 0;					while (false !== ($file = readdir($handle))) {						$size += filesize($path."/gallery/".$file);					}				}				if ($handle1 = opendir("gallery")) {					$size1 = 0;					while (false !== ($file = readdir($handle1))) {						$size1 += filesize($path."/gallery/".$file);					}				}				if ($size >= $pics || $size1 >= $pics) {					if ($size >= $pics) {						$files = 0;						while (false !== ($file = readdir($handle))) {							if ($files == 3) break;							unlink($file);						}					}					if ($size1 >= $pics) {						$files = 0;						while (false !== ($file = readdir($handle1))) {							if ($files == 3) break;							unlink($file);						}					}				}				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}		}		if ($_POST["type"] == "links") {			$text = $_POST["link"];			if (filesize("links.txt") < $links) {				$file = fopen("links.txt","a");				fwrite($file,"\r\n".$text);				fclose($file);				header("Location: uploaded.php?link=".$text);			}			else {				$links = array();				$file = fopen("links.txt");				while (true) {					$line = fgets($file);					if ($line == null) break;					$links[] = $line;				}								for ($i = 0;$i < 5;$i++) {					unset($links[$i]);				}								$file = fopen("links.txt","w");				foreach ($links as $link) {					fwrite($file,$link);				}				fwrite($file,"\r\n".$text);				fclose($file);				header("Location: uploaded.php?link=".$text);			}		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Upload</title>		<link rel="stylesheet" type="text/css" href="fever.css" />		<script type="text/javascript" src="jquery.js"></script>		<script type="text/javascript">			$(function() {				$("div.file").slideUp("fast");				$("div.link").slideUp("fast");				$("input.file").click(function() {					$("div.link").slideUp("slow");					$("div.file").slideDown("slow");				});				$("input.link").click(function() {					$("div.file").slideUp("slow");					$("div.link").slideDown("slow");				});			})		</script>	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<form enctype="multipart/form-data" action="upload.php" method="post">			<b>Select the item you would like to upload</b>			<br />			Upload: <input class="link" type="radio" name="type" value="links"> <b>Link</b> | <input class="file" type="radio" name="type" value="pptx"> <b>Powerpoint</b> | <input class="file" type="radio" name="type" value="scrapbooks"> <b>Scrapbook</b> | <input class="file" type="radio" name="type" value="gallery"> <b>Gallery</b>			<br />			<br />			<br />			<div class="file">				<b>Choose the file</b>				<br />				File: <input type="file" name="file">				<br />				<input type="submit" value="Upload" />			</div>			<div class="link">				<b>Type the link</b>				<br />				Link: <input name="link" type="text" maxlength="200" />				<br />				<input type="submit" value="Upload" />			</div>			</form>			<br />			<br />			<a style="color:rgb(0,0,0);" href="fever.php" title="Home">Home</a>		</div>	</body></html>

    And got the error: Warning: filesize() [function.filesize]: stat failed for http://localhost/projects/gallery/burntpaper.png in C:\apache\server\projects\upload.php on line 45

  4. I get the error: Warning: filesize() [function.filesize]: stat failed for Fever 1.0.png in C:\apache\server\projects\upload.php on line 38 When I submit an image through this code.upload.php

    <?php	$links = 5242880;	$pics = 2060451840;	$pptx = 2060451840;		if (isset($_POST["type"])) {		if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {			if ($_POST["type"] == "pptx" && $_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.presentationml.presentation") {				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				if ($handle = opendir("pptx")) {					$size = 0;					while (false !== ($file = readdir($handle))) {						$size += filesize($file);					}				}				if ($size >= $pptx) {					$files = 0;					while (false !== ($file = readdir($handle1))) {						if ($files == 3) break;						unlink($file);					}				}				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}			if ($_POST["type"] == "scrapbooks" || $_POST["type"] == "gallery" && $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/gif") {				if ($handle = opendir("scrapbooks")) {					$size = 0;					while (false !== ($file = readdir($handle))) {						$size += filesize($file);					}				}				if ($handle1 = opendir("gallery")) {					$size1 = 0;					while (false !== ($file = readdir($handle1))) {						$size1 += filesize($file);					}				}				if ($size >= $pics || $size1 >= $pics) {					if ($size >= $pics) {						$files = 0;						while (false !== ($file = readdir($handle))) {							if ($files == 3) break;							unlink($file);						}					}					if ($size1 >= $pics) {						$files = 0;						while (false !== ($file = readdir($handle1))) {							if ($files == 3) break;							unlink($file);						}					}				}				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}		}		if ($_POST["type"] == "links") {			$text = $_POST["link"];			if (filesize("links.txt") < $links) {				$file = fopen("links.txt","a");				fwrite($file,"\r\n".$text);				fclose($file);				header("Location: uploaded.php?link=".$text);			}			else {				$links = array();				$file = fopen("links.txt");				while (true) {					$line = fgets($file);					if ($line == null) break;					$links[] = $line;				}								for ($i = 0;$i < 5;$i++) {					unset($links[$i]);				}								$file = fopen("links.txt","w");				foreach ($links as $link) {					fwrite($file,$link);				}				fwrite($file,"\r\n".$text);				fclose($file);				header("Location: uploaded.php?link=".$text);			}		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Upload</title>		<link rel="stylesheet" type="text/css" href="fever.css" />		<script type="text/javascript" src="jquery.js"></script>		<script type="text/javascript">			$(function() {				$("div.file").slideUp("fast");				$("div.link").slideUp("fast");				$("input.file").click(function() {					$("div.link").slideUp("slow");					$("div.file").slideDown("slow");				});				$("input.link").click(function() {					$("div.file").slideUp("slow");					$("div.link").slideDown("slow");				});			})		</script>	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<form enctype="multipart/form-data" action="upload.php" method="post">			<b>Select the item you would like to upload</b>			<br />			Upload: <input class="link" type="radio" name="type" value="links"> <b>Link</b> | <input class="file" type="radio" name="type" value="pptx"> <b>Powerpoint</b> | <input class="file" type="radio" name="type" value="scrapbooks"> <b>Scrapbook</b> | <input class="file" type="radio" name="type" value="gallery"> <b>Gallery</b>			<br />			<br />			<br />			<div class="file">				<b>Choose the file</b>				<br />				File: <input type="file" name="file">				<br />				<input type="submit" value="Upload" />			</div>			<div class="link">				<b>Type the link</b>				<br />				Link: <input name="link" type="text" maxlength="200" />				<br />				<input type="submit" value="Upload" />			</div>			</form>			<br />			<br />			<a style="color:rgb(0,0,0);" href="fever.php" title="Home">Home</a>		</div>	</body></html>

    What should I do?

  5. I have the code

    <?php	if (isset($_POST["type"])) {		if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {			if ($_POST["type"] == "pptx" && $_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.presentationml.presentation") {				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}			if ($_POST["type"] == "scrapbooks" || $_POST["type"] == "gallery" && $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/gif") {				$tmp = $_FILES["file"]["tmp_name"];				$name = $_FILES["file"]["name"];				$dir = $_POST["type"]."/".$name;				move_uploaded_file($tmp,$dir);				if (file_exists($dir)) {					header("Location: uploaded.php?file=".$name);				}				else {					header("Location: error.php?file=".$name);				}			}			if ($_POST["type"] == "links") {				echo "OK";				$text = $_POST["link"];				$file = fopen("links.txt","w");				fwrite($file,$text);				fclose($file);			}		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Upload</title>		<link rel="stylesheet" type="text/css" href="fever.css" />		<script type="text/javascript" src="jquery.js"></script>		<script type="text/javascript">			$(function() {				$("div.file").slideUp("fast");				$("div.link").slideUp("fast");				$("input.file").click(function() {					$("div.link").slideUp("slow");					$("div.file").slideDown("slow");				});				$("input.link").click(function() {					$("div.file").slideUp("slow");					$("div.link").slideDown("slow");				});			})		</script>	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<form enctype="multipart/form-data" action="upload.php" method="post">			Upload: <input class="link" type="radio" name="type" value="links"> <b>Link</b> | <input class="file" type="radio" name="type" value="pptx"> <b>Powerpoint</b> | <input class="file" type="radio" name="type" value="scrapbooks"> <b>Scrapbook</b> | <input class="file" type="radio" name="type" value="gallery"> <b>Gallery</b>			<br />			<br />			<div class="file">				File: <input type="file" name="file">				<br />				<input type="submit" value="Upload" />			</div>			<div class="link">				Link: <input name="link" type="text" maxlength="200" />				<br />				<input type="submit" value="Upload" />			</div>			</form>		</div>	</body></html>

  6. I get the error: Warning: move_uploaded_file(http://localhost/projects/pptxfever.pptx) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in C:\apache\server\projects\upload.php on line 8Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\TEMP\php1B8.tmp' to 'http://localhost/projects/pptxfever.pptx' in C:\apache\server\projects\upload.php on line 8When I try to run upload files with this script:upload.php

    <?php	if (isset($_POST["type"])) {		if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {			$tmp = $_FILES["file"]["tmp_name"];			$name = $_FILES["file"]["name"];			$dir = "http://localhost/projects/".$_POST["type"].$name;			move_uploaded_file($tmp,$dir);		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Upload</title>		<link rel="stylesheet" type="text/css" href="fever.css" />		<script type="text/javascript" src="jquery.js"></script>		<script type="text/javascript">			$(function() {				$("div.file").slideUp("fast");				$("div.link").slideUp("fast");				$("input.file").click(function() {					$("div.link").slideUp("slow");					$("div.file").slideDown("slow");				});				$("input.link").click(function() {					$("div.file").slideUp("slow");					$("div.link").slideDown("slow");				});			})		</script>	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<form enctype="multipart/form-data" action="upload.php" method="post">			Upload: <input class="link" type="radio" name="type" value="link"> <b>Link</b> | <input class="file" type="radio" name="type" value="pptx"> <b>Powerpoint</b> | <input class="file" type="radio" name="type" value="scrapbooks"> <b>Scrapbook</b> | <input class="link" type="radio" name="type" value="gallery"> <b>Gallery</b>			<br />			<br />			<div class="file">				File: <input type="file" name="file">				<br />				<input type="submit" value="Upload" />			</div>			<div class="link">				Link: <input name="link" type="text" maxlength="200" />				<br />				<input type="submit" value="Upload" />			</div>			</form>		</div>	</body></html>

    Does anybody know why?

  7. My code:index.php

    <?php	$dir = "/files";	$files = array();		if ($handle = opendir("/files")) {		while ($false !== ($file = readdir($handle))) {			$files[] = $file;		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Home</title>		<link rel="stylesheet" type="text/css" href="fever.css" />	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<h2>Fever 1793</h2>			<div id="desc">Fever 1793 is a novel by Laurie Halse Anderson that takes place in Philidelphia. Mattie, a young girl, lives in Philidelphia						   during the Yellow Fever outbreak in 1793. The novel is in a diary format where Mattie shares her view of the day. Characters						   in the book include: Grandfather, Mother, Eliza, and Nethaniel Benson.			</div>			<div id="wrap">			<div id="powerpoint">				<h2>Powerpoint</h2>				<?php										print_r($files);									?>			</div>			<div id="scrapbook">				<h2>Scrapbook</h2>				<?php																	?>			</div>			<div id="links">				<h2>Links</h2>				<?php																	?>			</div>			<div id="gallery">				<h2>Gallery</h2>				<?php																	?>			</div>			</div>		</div>	</body></html>

    Generates the error: Warning: opendir(/files) [function.opendir]: failed to open dir: No error in C:\apache\server\projects\fever.php on line 6Any ideas?

  8. Now the real challenge italics and bold. I got italics working, but when I try to use it in the same field it does the italics and bold, but the tags are left in. Here is my code:fml.php

    <html>	<head>		<title>Server - PHP - FML</title>		<style>			a,			a:link,			a:visited,			a:hover {				color:blue;			}						ul {				list-style-type:none;				position:relative;				left:-17px;			}		</style>	</head>	<body>		<center>			<h1>Server - PHP - FML</h1>			<p>Please enter some text with using the following format:</p>			<ul>				<li><b>[b]</b> and <b>[/b]</b> for bold</li>				<li><b>[i]</b> and <b>[/i]</b> for italics</li>			</ul>			<br />			<?php				if (!isset($_POST["text"])) {			?>				<form action="http://localhost/php/fml.php" method="post">					<input type="text" name="text" />					<br />					<input type="submit" value="Submit" />				</form>			<?php				}				if (isset($_POST["text"])) {					if (strpos($_POST["text"],"[b]") !== false) {						if (strpos($_POST["text"],"[/b]") === false) {							$_POST["text"] .= "[/b]";						}						$text = str_replace("[b]","<b>",$_POST["text"]);						$text = str_replace("[/b]","</b>",$text);						echo $text;					}					if (strpos($_POST["text"],"[i]") !== false) {						if (strpos($_POST["text"],"[/i]") === false) {							$_POST["text"] .= "[/i]";						}						$text = str_replace("[i]","<i>",$_POST["text"]);						$text = str_replace("[/i]","</i>",$text);						echo $text;					}				}				else {  echo $text;  }			?>		</center>	</body></html>

  9. I did that, but it will not change the to <b>. My code:fml.php

    <html>	<head>		<title>Server - PHP - FML</title>		<style>			a,			a:link,			a:visited,			a:hover {				color:blue;			}						ul {				list-style-type:none;				position:relative;				left:-17px;			}		</style>	</head>	<body>		<center>			<h1>Server - PHP - FML</h1>			<p>Please enter some text that has the text "[b]" and "[/b]".</p>			<br />			<?php				if (!isset($_POST["text"])) {			?>				<form action="http://localhost/php/fml.php" method="post">					<input type="text" name="text" />					<br />					<input type="submit" value="Submit" />				</form>			<?php				}				if (isset($_POST["text"])) {					if (strstr($_POST["text"],"[b]")) {						if (strstr($_POST["text"],"[/b]")) {							$text = str_replace("[b]","<b>",$_POST["text"]);							$text = str_replace("[/b]","</b>",$_POST["text"]);							echo $text;						}						else {							$_POST["text"] .= "[/b]";							$text = str_replace("[b]","<b>",$_POST["text"]);							$text = str_replace("[/b]","</b>",$_POST["text"]);							echo $text;						}					}					else {  echo $_POST["text"];  }				}			?>		</center>	</body></html>

  10. <html>	<head>		<title>Server - PHP - FML</title>		<style>			a,			a:link,			a:visited,			a:hover {				color:blue;			}						ul {				list-style-type:none;				position:relative;				left:-17px;			}		</style>	</head>	<body>		<center>			<h1>Server - PHP - FML</h1>			<p>Please enter some text that has the text "[b]" and "[/b]".</p>			<br />			<?php				if (!isset($_POST["text"])) {			?>				<form action="http://localhost/php/fml.php" method="post">					<input type="text" name="text" />					<br />					<input type="submit" value="Submit" />				</form>			<?php				}				if (isset($_POST["text"])) {					if (strstr($_POST["text"],"[b]")) {						if (strstr($_POST["text"],"[/b]")) {							$text = str_replace("[b]","<b>",$text);							$text = str_replace("[/b]","</b>",$text);							echo $text;						}						else {							$_POST["text"] += "[/b]";							$text = str_replace("[b]","<b>",$text);							$text = str_replace("[/b]","</b>",$text);							echo $text;						}					}					else {  echo $_POST["text"];  }				}			?>		</center>	</body></html>

  11. I have a script that finds and and then replaces that with <b> and </b> so it when I echo it, it is in bold. I get the error: Parse error: syntax error, unexpected '{' in C:\apache\server\php\fml.php on line 35. Thanks.fml.php

    <html>	<head>		<title>Server - PHP - FML</title>		<style>			a,			a:link,			a:visited,			a:hover {				color:blue;			}						ul {				list-style-type:none;				position:relative;				left:-17px;			}		</style>	</head>	<body>		<center>			<h1>Server - PHP - FML</h1>			<p>Please enter some text that has the text "[b]" and "[/b]".</p>			<br />			<?php				if (!isset($_POST["text"])) {			?>				<form action="/" method="post">					<input type="text" name="text" />					<br />					<input type="submit" value="Submit" />				</form>			<?php				}				if (isset($_POST["text"])) {					if (strstr($_POST["text"],"[b]") {						if (strstr($_POST["text"],"[/b]") {							$text = str_replace("[b]","<b>",$text);							$text = str_replace("[/b]","</b>",$text);						}						else {							$_POST["text"] += "[/b]";							$text = str_replace("[b]","<b>",$text);							$text = str_replace("[/b]","</b>",$text);						}					}					else {  echo $_POST["text"]  }				}			?>		</center>	</body></html>

×
×
  • Create New...