1 |
On Sun, 2011-01-30 at 14:55 -0600, Michael Sullivan wrote: |
2 |
> On Sat, 2011-01-15 at 13:21 -0600, Michael Sullivan wrote: |
3 |
> > On Sat, 2011-01-15 at 12:31 -0500, Mark Shields wrote: |
4 |
> > > On Fri, Jan 14, 2011 at 10:53 PM, Michael Sullivan |
5 |
> > > <msulli1355@×××××.com> wrote: |
6 |
> > > On Fri, 2011-01-14 at 22:37 -0500, Mark Shields wrote: |
7 |
> > > <trimmed> |
8 |
> > > > |
9 |
> > > > |
10 |
> > > > |
11 |
> > > > |
12 |
> > > > It's no problem. Gmail realized you had already sent the |
13 |
> > > same message |
14 |
> > > > and collapsed the whole reply as "quoted text" :) |
15 |
> > > > |
16 |
> > > > |
17 |
> > > > Try running this: |
18 |
> > > > |
19 |
> > > > |
20 |
> > > > # echo "phpinfo();" | xargs php -r |
21 |
> > > > |
22 |
> > > > |
23 |
> > > > What does it output? anything? |
24 |
> > > |
25 |
> > > |
26 |
> > > It outputs a lot of stuff. More than my gnome-terminal buffer |
27 |
> > > could |
28 |
> > > display (as in I issue a reset before I issue the command you |
29 |
> > > sent and I |
30 |
> > > can't see the command when I scroll all the way up.) Anything |
31 |
> > > in |
32 |
> > > particular I should be looking for? Anything I should grep |
33 |
> > > for? |
34 |
> > > |
35 |
> > > |
36 |
> > > |
37 |
> > > |
38 |
> > > I just wanted to see if php-cli works. And it does. |
39 |
> > > |
40 |
> > > |
41 |
> > > I would recommend re-emerging php at this point, then run etc-update |
42 |
> > > or dispatch-conf. |
43 |
> > > |
44 |
> > |
45 |
> > I did all three and restarted apache and went to the page. Still only |
46 |
> > see code... |
47 |
> |
48 |
> I've done some further research/testing and discovered that it's only my picture page that's not executing: |
49 |
> |
50 |
> From http://carter.espersunited.com/~michael/test.php: |
51 |
> |
52 |
> Warning: Unknown: failed to open stream: Permission denied in Unknown on |
53 |
> line 0 |
54 |
> |
55 |
> Fatal error: Unknown: Failed opening required |
56 |
> '/home/michael/public_html/test.php' (include_path='.:/usr/share/php5:/usr/share/php') in Unknown on line 0 |
57 |
> |
58 |
> PHP executed. It returned errors, but it executed, now from one |
59 |
> directory down: |
60 |
> |
61 |
> From http://carter.espersunited.com/~michael/camera/index.php: |
62 |
> |
63 |
> \n"; print " \n"; print " \n"; print " \n"; print "\n"; print "\n"; |
64 |
> print "\n"; print " |
65 |
> \n"; print "\n"; print " \n"; print " \n"; print " \n"; print " |
66 |
> \n"; print " |
67 |
> $title |
68 |
> \n"; print " |
69 |
> \n"; print " |
70 |
> \n |
71 |
> \n"; print " |
72 |
> \n"; $dirname = "."; $dh = opendir($dirname); print " |
73 |
> \n"; while ( gettype($file = readdir($dh)) != boolean) { if |
74 |
> (is_dir("$dirname/$file") && strlen($file) == 6) { #We are in a |
75 |
> directory $strMonth = substr($file, 0, 2); $strDay = substr($file, 2, |
76 |
> 2); $strYear = substr($file, 4, 2); $file = $strYear.$strMonth.$strDay; |
77 |
> $dirarray[] = $file; } } closedir($dh); $value = $_POST['Set']; if (! |
78 |
> isset($value)) $value="current"; rsort($dirarray, SORT_STRING); if |
79 |
> ($value == "Current") $value = "current"; if ($value == "current") |
80 |
> include("current.php"); if ($value=="All") { foreach ($dirarray as |
81 |
> $file) { $strMonth = substr($file, 2, 2); $strDay = substr($file, 4, 2); |
82 |
> $strYear = substr($file, 0, 2); $file = $strMonth.$strDay.$strYear; |
83 |
> makeTable($dirname, $file); } } if ($value !="current" && $value != |
84 |
> "All") makeTable($dirname, $value); showList(); print " |
85 |
> \n"; print " \n"; print "\n"; function makeTable($dirname, $file) |
86 |
> { global $text; global $bgcolor; #The name of this directory is in |
87 |
> mmddyy format. We need to spit it into its individual parts and print it |
88 |
> (mm/dd/yy) $strMonth = substr($file, 0, 2); $strDay = substr($file, 2, |
89 |
> 2); $strYear = substr($file, 4); print "\n"; print " \n"; print " \n"; |
90 |
> print "\n"; print " |
91 |
> \n"; print " |
92 |
> Added $strMonth"."/".$strDay."/".$strYear." |
93 |
> \n"; print " |
94 |
> \n"; $subdirname = $file; $eh = opendir($subdirname); #We need to make a |
95 |
> table for the thumbnails to appear in... print " \n"; print "\n"; $count |
96 |
> = 1; while (gettype($subfile = readdir($eh)) != boolean) { $ext = |
97 |
> substr($subfile, strlen($subfile) - 3, 3); $ext = strtolower($ext); if |
98 |
> (!is_dir("$dirname/$subdirname/$subfile") && $ext == "jpg") { print |
99 |
> "\n"; $count++; if ($count > 5) { print "\n"; print "\n"; $count = |
100 |
> 1; } } } print " "; print " |
101 |
> \n"; print " |
102 |
> \n"; } function makeList($file) { print " $file\n"; } function |
103 |
> showList() { global $dirarray; global $dirname; print "\n"; print " \n"; |
104 |
> print "\n"; } ?> |
105 |
> \n"; //print "$subfile |
106 |
> \n"; $subfilename = htmlspecialchars($subfile, ENT_QUOTES); $filename = |
107 |
> $dirname."/".$subdirname."/mini/mini-".$subfilename; print "\n"; print |
108 |
> "\"$subfile\"\n"; print "\n"; print " |
109 |
> |
110 |
> It occurs to me that I might have an error in the script itself. I have |
111 |
> posted the entire script here: |
112 |
> |
113 |
> michael@carter ~/public_html/camera $ cat index.php |
114 |
> <? |
115 |
> $title = "My Pictures"; |
116 |
> $bgcolor = "#339966"; |
117 |
> $text = "#FFFF00"; |
118 |
> |
119 |
> print "<html>\n"; |
120 |
> print " <head>\n"; |
121 |
> print " <title>$title</title>\n"; |
122 |
> print " </head>\n"; |
123 |
> print "\n"; |
124 |
> print "<body background='../images/pawborder.gif' bgcolor='$bgcolor' |
125 |
> text='$text'>\n"; |
126 |
> print "\n"; |
127 |
> print "<center>\n"; |
128 |
> print "<table cellspacing='0' cellpadding='0' bgcolor='$bgcolor'>\n"; |
129 |
> print " <tr>\n"; |
130 |
> print " <td align='center'>\n"; |
131 |
> print " <h1>$title</h1>\n"; |
132 |
> print " </td>\n"; |
133 |
> print " </tr>\n"; |
134 |
> print "</table>\n"; |
135 |
> print "<br>\n<br>\n"; |
136 |
> print "</center>\n"; |
137 |
> |
138 |
> |
139 |
> $dirname = "."; |
140 |
> $dh = opendir($dirname); |
141 |
> print "<center>\n"; |
142 |
> while ( gettype($file = readdir($dh)) != boolean) |
143 |
> { |
144 |
> if (is_dir("$dirname/$file") && strlen($file) == 6) |
145 |
> { #We are in a directory |
146 |
> $strMonth = substr($file, 0, 2); |
147 |
> $strDay = substr($file, 2, 2); |
148 |
> $strYear = substr($file, 4, 2); |
149 |
> $file = $strYear.$strMonth.$strDay; |
150 |
> |
151 |
> $dirarray[] = $file; |
152 |
> } |
153 |
> } |
154 |
> closedir($dh); |
155 |
> |
156 |
> $value = $_POST['Set']; |
157 |
> if (!isset($value)) $value="current"; |
158 |
> rsort($dirarray, SORT_STRING); |
159 |
> if ($value == "Current") $value = "current"; |
160 |
> if ($value == "current") include("current.php"); |
161 |
> |
162 |
> if ($value=="All") |
163 |
> { |
164 |
> foreach ($dirarray as $file) |
165 |
> { |
166 |
> $strMonth = substr($file, 2, 2); |
167 |
> $strDay = substr($file, 4, 2); |
168 |
> $strYear = substr($file, 0, 2); |
169 |
> $file = $strMonth.$strDay.$strYear; |
170 |
> |
171 |
> makeTable($dirname, $file); |
172 |
> } |
173 |
> } |
174 |
> if ($value !="current" && $value != "All") makeTable($dirname, $value); |
175 |
> |
176 |
> showList(); |
177 |
> print " </center>\n"; |
178 |
> print " </body>\n"; |
179 |
> print "</html>\n"; |
180 |
> |
181 |
> |
182 |
> function makeTable($dirname, $file) |
183 |
> { |
184 |
> global $text; |
185 |
> global $bgcolor; |
186 |
> #The name of this directory is in mmddyy format. We need to spit |
187 |
> it into its individual parts and print it (mm/dd/yy) |
188 |
> $strMonth = substr($file, 0, 2); |
189 |
> $strDay = substr($file, 2, 2); |
190 |
> $strYear = substr($file, 4); |
191 |
> print "<table cellspacing='0' cellpadding='0' bgcolor='$bgcolor' |
192 |
> border='3'>\n"; |
193 |
> |
194 |
> print " <tr>\n"; |
195 |
> print " <td align='center'>\n"; |
196 |
> |
197 |
> print " <h3>Added |
198 |
> $strMonth"."/".$strDay."/".$strYear."</h3>\n"; |
199 |
> print "</td>\n"; |
200 |
> print "</tr>\n"; |
201 |
> print "</table>\n"; |
202 |
> $subdirname = $file; |
203 |
> $eh = opendir($subdirname); |
204 |
> |
205 |
> #We need to make a table for the thumbnails to appear in... |
206 |
> print " <table cellspacing='0' cellpadding='0'>\n"; |
207 |
> |
208 |
> print "<tr>\n"; |
209 |
> $count = 1; |
210 |
> while (gettype($subfile = readdir($eh)) != boolean) |
211 |
> { |
212 |
> $ext = substr($subfile, strlen($subfile) - 3, 3); |
213 |
> $ext = strtolower($ext); |
214 |
> if (!is_dir("$dirname/$subdirname/$subfile") && $ext == "jpg") |
215 |
> { |
216 |
> print "<td>\n"; |
217 |
> //print "$subfile<br>\n"; |
218 |
> $subfilename = htmlspecialchars($subfile, ENT_QUOTES); |
219 |
> $filename = $dirname."/".$subdirname."/mini/mini-".$subfilename; |
220 |
> print "<a href='".$dirname."/".$subdirname."/".$subfilename."'>\n"; |
221 |
> print "<img src='$filename' width=100 height=100 alt=\"$subfile |
222 |
> \">\n"; |
223 |
> print "</a>\n"; |
224 |
> print "</td>\n"; |
225 |
> $count++; |
226 |
> if ($count > 5) |
227 |
> { |
228 |
> print "</tr>\n"; |
229 |
> print "<tr>\n"; |
230 |
> $count = 1; |
231 |
> } |
232 |
> } |
233 |
> } |
234 |
> print " </tr>"; |
235 |
> print " </table\n"; |
236 |
> print " <br>\n"; |
237 |
> print " <br>\n"; |
238 |
> } |
239 |
> |
240 |
> function makeList($file) |
241 |
> { |
242 |
> print " <option>$file</option>\n"; |
243 |
> } |
244 |
> |
245 |
> function showList() |
246 |
> { |
247 |
> global $dirarray; |
248 |
> global $dirname; |
249 |
> print "<form action='index.php' method='post'>\n"; |
250 |
> print " <select name='Set'>\n"; |
251 |
> print " <option>All</option>\n"; |
252 |
> print " <option selected>Current</option>\n"; |
253 |
> foreach ($dirarray as $file) |
254 |
> { |
255 |
> $strMonth = substr($file, 2, 2); |
256 |
> $strDay = substr($file, 4, 2); |
257 |
> $strYear = substr($file, 0, 2); |
258 |
> $file = $strMonth.$strDay.$strYear; |
259 |
> |
260 |
> makeList($file); |
261 |
> } |
262 |
> print " <br><br><input type='submit' value='Select'>\n"; |
263 |
> print "</form>\n"; |
264 |
> |
265 |
> } |
266 |
> ?> |
267 |
> |
268 |
> Do you see anything here that would cause PHP to output its code instead |
269 |
> of executing it? |
270 |
> |
271 |
I changed the first line of my script from <? to <?php and it seems to |
272 |
execute now. The script no longer works; I guess PHP has gotten |
273 |
stricter since it was when I wrote this script. Now I have to go |
274 |
refresh my php knowledge so I can fix the script... |