Page 2 of 2
Posted: Mon Nov 17, 2003 6:54 pm
by hammer32
Weirdan,
I tried modifying the line, and it kind of works, after loading the initial image at:
http://192.168.1.100/~hammer32/images/p ... eshow1.php
it keeps reloading the same one, after the refresh time, over and over at:
http://192.168.1.100/~hammer32/images/p ... hp?index=1
The index number doesn't seem to want to increment.
Thanks!
-Sean
Posted: Mon Nov 17, 2003 8:11 pm
by Weirdan
Paddy, you are completely wrong. Read some manuals. Try to use this html:
Code: Select all
<form action="something.php" method="GET">
<input type="text" name="some_text" value="something">
<input type=submit>
</form>
It works. Paddy, read some good book on html. Visit the
http://w3c.org/
Posted: Mon Nov 17, 2003 8:21 pm
by Weirdan
Look at this code:
Code: Select all
//..............skipped...............
# Which image to display?
# if no index specified, default to first page
if ($index == "") {
$index = 0;
} elseif ($index >= count($fileArray)) {
$index = 0; # loop back to beginning
}
//............skipped............
As we already know you have register_globals turned off. So you need to rewrite it as follows:
Code: Select all
//..............skipped...............
# Which image to display?
# if no index specified, default to first page
$index=@$_GET['index']; //use index from $_GET array
if ($index == "") {
$index = 0;
} elseif ($index >= count($fileArray)) {
$index = 0; # loop back to beginning
}
//............skipped............
Posted: Mon Nov 17, 2003 8:36 pm
by Paddy
Weirdan wrote:Paddy, you are completely wrong. Read some manuals. Try to use this html:
Code: Select all
<form action="something.php" method="GET">
<input type="text" name="some_text" value="something">
<input type=submit>
</form>
It works. Paddy, read some good book on html. Visit the
http://w3c.org/
Ah, didn't realise you could put get there. I use get when I throw something into the URL. Can I ask why you would use get?
Posted: Mon Nov 17, 2003 8:51 pm
by Weirdan
Paddy wrote:
Can I ask why you would use get?
I use get method where it's appropriate (i.e. when requests are idempotent as says
RFC2616) And I use forms where I want to give the user ability to construct the request visually. Look at the google.com. They use the GET method for their search form because the request doesn't change the resourse (database in this case). It just retrieves,
GETs information from it.
Posted: Sun Jan 11, 2004 10:51 am
by hammer32
Weirdan wrote:
As we already know you have register_globals turned off. So you need to rewrite it as follows:
Code: Select all
//..............skipped...............
# Which image to display?
# if no index specified, default to first page
$index=@$_GET['index']; //use index from $_GET array
if ($index == "") {
$index = 0;
} elseif ($index >= count($fileArray)) {
$index = 0; # loop back to beginning
}
//............skipped............
I entered that code, but I get an error "Parse error: parse error in /Users/hammer32/Sites/images/pictures/slideshow1.php on line 84
Code: Select all
77 # Read in the list of filenames that have any of the
78 # accepted extensions
79 $handle=opendir(getcwd());
80 while (false !== ($file = readdir($handle))) {
81 # get the file extension
82 $parts = explode(".", $file);
83 $extension = end($parts);
84
85 # add file to fileArray if it has a matching extension
86 foreach ($image_extensions as $img_ext) {
87 if (!strcasecmp($extension, $img_ext)) {
88 $fileArray[count($fileArray)] = $file;
89 break;
90 }
91 }
92 }
93 closedir($handle);
94 sort($fileArray);