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
Panther and PHP
Moderator: General Moderators
Paddy, you are completely wrong. Read some manuals. Try to use this html:
It works. Paddy, read some good book on html. Visit the http://w3c.org/
Code: Select all
<form action="something.php" method="GET">
<input type="text" name="some_text" value="something">
<input type=submit>
</form>Look at this code:hammer32 wrote: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
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............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............-
Paddy
- Forum Contributor
- Posts: 244
- Joined: Wed Jun 11, 2003 8:16 pm
- Location: Hobart, Tas, Aussie
- Contact:
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?Weirdan wrote:Paddy, you are completely wrong. Read some manuals. Try to use this html:It works. Paddy, read some good book on html. Visit the http://w3c.org/Code: Select all
<form action="something.php" method="GET"> <input type="text" name="some_text" value="something"> <input type=submit> </form>
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.Paddy wrote: Can I ask why you would use get?
I entered that code, but I get an error "Parse error: parse error in /Users/hammer32/Sites/images/pictures/slideshow1.php on line 84Weirdan 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............
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);