Post Reply 
Quick Php help
Author Message
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #1
Quick Php help

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?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 Erk
Any help would be greatly appreciated. Probably my own stupidity. Emptyone

Like i said, it was my own stupidity, i was missing a "}". I really need to turn on error reporting Sadist


[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
(This post was last modified: 25/04/2009 11:27 PM by Mickey.)
25/04/2009 11:21 PM
Find all posts by this user Quote this message in a reply
amzter
The bird stole my shoe.

Posts: 1,830.3066
Threads: 342
Joined: 3rd May 2007
Reputation: -4.56241
E-Pigs: 54.7074
Offline
Post: #2
RE: Quick Php help
I have never seen php before but that looks harder than javascript. Nice u fixed it though

[Image: 494851774.png]
Search:
26/04/2009 02:36 AM
Visit this user's website Find all posts by this user Quote this message in a reply
lembas
yuri princess

Posts: 4,365.2931
Threads: 184
Joined: 30th Apr 2008
Reputation: -2.56923
E-Pigs: 154.3525
Offline
Post: #3
RE: Quick Php help
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.

I'm gay.
Spoiler for online game stuff:
[Image: 76561198003967361.png]
[Image: thelemmingbas.png]
3DS FC: 4184-1632-9353
Spoiler:
[Image: wQZsI.jpg]
Spoiler:
In the words of the wise trademark91:
windows Proud
26/04/2009 02:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
amzter
The bird stole my shoe.

Posts: 1,830.3066
Threads: 342
Joined: 3rd May 2007
Reputation: -4.56241
E-Pigs: 54.7074
Offline
Post: #4
RE: Quick Php help
Yeah those $ really get me confused even in excel

[Image: 494851774.png]
Search:
26/04/2009 03:08 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,023.4213
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.0333
Offline
Post: #5
RE: Quick Php help
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).
(This post was last modified: 26/04/2009 03:19 AM by ZiNgA BuRgA.)
26/04/2009 03:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #6
RE: Quick Php help
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 Hero but now i have no ideas so back to the back of the brain.

[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
26/04/2009 10:07 AM
Find all posts by this user Quote this message in a reply
Necro-Bot
Non-existent

 
Post: #7
Thread Revived!!!
[Image: gd9au.jpg]
29/05/2009 12:36 AM
Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #8
RE: Quick Php help

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!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/


[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
(This post was last modified: 29/05/2009 12:39 AM by Mickey.)
29/05/2009 12:36 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,023.4213
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.0333
Offline
Post: #9
RE: Quick Php help
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
Visit this user's website Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #10
RE: Quick Php help
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

[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
29/05/2009 01:27 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: