PHP Code:
<?php
$id = $_GET['id'];
if ($id !== NULL) {
$dir = $id;
$files = scandir($dir);
foreach ($files as $url) {
if ($url == ".." OR $url == ".") {
end;
} else {
echo "<a href=\"./{$dir}/{$url}\">".$url."</a></br>";
}
} else {
echo("Select a folder from the left pane.");
}
?>
|
Why can't i get the if loop to work? Page won't load when I have that in, and if i don't i get damn . and .. and links
Any help would be greatly appreciated. Probably my own stupidity. 
Like i said, it was my own stupidity, i was missing a "}". I really need to turn on error reporting 
I have never seen php before but that looks harder than javascript. Nice u fixed it though
amzter Wrote:I have never seen php before but that looks harder than javascript. Nice u fixed it though
it looks a lot like Perl.
and they both look confusing as hell with all those '$' and whatnot.
Yeah those $ really get me confused even in excel
Xitherun Wrote:amzter Wrote:I have never seen php before but that looks harder than javascript. Nice u fixed it though
it looks a lot like Perl.
and they both look confusing as hell with all those '$' and whatnot.
Perl is "confusing" (or rather, ugly). PHP isn't (well, not syntactically anyway) - it follows C syntax quite closely. You just have to prefix all variables with a "$" (like shell scripting).
amzter Wrote:I have never seen php before but that looks harder than javascript. Nice u fixed it though
If it looks hard its probably cause of me @.@ but its actually pretty easy, ive only used it once before but that was following this tut thingy, this is the first thingy i code on my own

but now i have no ideas so back to the back of the brain.
Strict Standards: Only variables should be passed by reference in
/var/www/endlessparadigm/forum/inc/highlighter.php(1007) : regexp code on line
23
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upload Image</title>
</head>
<body>
<?php
if (isset($_POST['submit'])){
echo "<pre>";
print_r ($_POST['file']);
print_r ($_POST);
echo "</pre>";
} else {
echo "Not Set";
}
?>
<div id="container">
<div id="rules">
<ul>
<li>Image size must be less than 3 megabytes</li>
<li>Image must be PNG, JPG, JPEG, or GIF.</li>
<li>Image name may only contain A-Z, 1-9, and _.</li>
<li>Spaces will be replaced with "_"</li>
</ul>
</div>
<div id="uploadForm">
<form action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="3145728" />
<label for="file">File: </label><input type="file" id="file" name="file" /><br />
<input type="submit" name="submit" value="Upload File" />
</form>
</div>
</div>
</body>
</html>
|
Need help again, for some reason it won't post the image's array :(
Here it is: http://mickeys-home.com/image/
Uploads are in the $_FILES array I believe. Also, it's a very bad idea to stick the max file size as a client variable (at least, rely on it) - someone could forge it, for example.
ZiNgA BuRgA Wrote:Uploads are in the $_FILES array I believe. Also, it's a very bad idea to stick the max file size as a client variable (at least, rely on it) - someone could forge it, for example.
your right... and im going to add more protection via php, make it if $_FILES['file']['size'] > 3mb then end or break. That's just what ive done so far. ty zinga