Strict Standards: Only variables should be passed by reference in /var/www/endlessparadigm/forum/inc/highlighter.php(1007) : regexp code on line 23 Quick Php help ~
<?php$id=$_GET['id'];if($id!==NULL){$dir=$id;$files= scandir($dir);foreach($filesas$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
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).
(This post was last modified: 26/04/2009 03:19 AM by ZiNgA BuRgA.)
26/04/2009 03:18 AM
Mickey
Down with MJ yo
Posts: 3,663.2843 Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
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.
<!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";}?><divid="container"><divid="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><divid="uploadForm"><formaction=""method="post"enctype="multipart/form-data"><inputtype="hidden"name="MAX_FILE_SIZE"value="3145728"/><labelfor="file">File: </label><inputtype="file"id="file"name="file"/><br/><inputtype="submit"name="submit"value="Upload File"/></form></div></div></body></html>
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.
29/05/2009 01:13 AM
Mickey
Down with MJ yo
Posts: 3,663.2843 Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
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