Tässä on koodi:
/************************************************************************************************** SHOW FROM */ if(isset($_GET['showfrom'])) { $susername = $_GET['showfrom']; $imgs = &getfiles("./$img_path/", $susername); $imgsc = count($imgs); if($imgsc == "0") { print " <br> <table width='50%' align='center'> <tr> <th>No Images Found</th> </tr> <tr> <td align='center'><br>This user has not submitted any images.<br><br></td> </tr> </table> "; exit; } print " <br> <table width='100%'> <tr> <th colspan='4'>$susername's images</th> </tr> "; $tr = 0; $tc = 0; for($x = 0; $x < $imgsc; $x++) { $fname = "./$img_path/".$imgs[$x]; $picp = "./$thumb_path/th_".$imgs[$x]; $picsz = number_format(filesize("./$img_path/".$imgs[$x])); $picd = &get_image_date("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $picdesc = &get_image_desc("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $pichits = &get_image_hits("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $pic_nfo = getimagesize("./$img_path/".$imgs[$x]); $th_nfo = getimagesize("./$thumb_path/th_".$imgs[$x]); $pic_width = $pic_nfo[0] + 20; $pic_height = $pic_nfo[1] + 2; print " <tr> <td valign='top' width='50%' align='center'> <table align='center' width='100%'> "; if(session_is_registered("g_password") && $_SESSION["g_username"] == $susername) { print" <tr> <td rowspan='7' align='center' width='$th_nfo[0]' class='td_thumb'><a href='$php_self?show=$fname&user=$susername'><img src='$picp'></a><br><font style='font-size: 10px'><a href='$phpself?remove=$imgs[$x]&u=$susername&s=0'>remove</a></font></td> </tr> "; } else { print " <tr> <td rowspan='7' align='center' width='$th_nfo[0]' class='td_thumb'><a href='$php_self?show=$fname&user=$susername'><img src='$picp'></a></td> </tr> "; } print " <tr> <td width='1%'>Name</td><td>$imgs[$x]</td> </tr> <tr> <td>Size</td><td>$picsz</td> </tr> <tr> <td>Resolution</td><td>$pic_nfo[0]x$pic_nfo[1]</td> </tr> <tr> <td>Submitted</td><td>$picd</td> </tr> "; if(session_is_registered("g_password") && $_SESSION["g_username"] == $susername) { print" <tr> <td valign='top'>Description<br><font style='font-size: 10px'><a href='$php_self?editd=$imgs[$x]&u=$susername&od=$picdesc'>edit</a></font></td><td>$picdesc</td> </tr> "; } else { print" <tr> <td valign='top'>Description</td><td>$picdesc</td> </tr> "; } print " <tr> <td>Hits</td><td>$pichits</td> </tr> </table> </td> "; $x++; if($x < $imgsc) { $fname = "./$img_path/".$imgs[$x]; $picp = "./$thumb_path/th_".$imgs[$x]; $picsz = number_format(filesize("./$img_path/".$imgs[$x])); $picd = &get_image_date("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $picdesc = &get_image_desc("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $pichits = &get_image_hits("./$nfo_path/".$susername."/".$imgs[$x].".txt"); $pic_nfo = getimagesize("./$img_path/".$imgs[$x]); $th_nfo = getimagesize("./$thumb_path/th_".$imgs[$x]); $pic_width = $pic_nfo[0] + 20; $pic_height = $pic_nfo[1] + 2; print " <td valign='top' width='50%' align='center'> <table align='center' width='100%'> "; if(session_is_registered("g_password") && $_SESSION["g_username"] == $susername) { print" <tr> <td rowspan='7' align='center' width='$th_nfo[0]' class='td_thumb'><a href='$php_self?show=$fname&user=$susername'><img src='$picp'></a><br><font style='font-size: 10px'><a href='$phpself?remove=$imgs[$x]&u=$susername&s=0'>remove</a></font></td> </tr> "; } else { print " <tr> <td rowspan='7' align='center' width='$th_nfo[0]' class='td_thumb'><a href='$php_self?show=$fname&user=$susername'><img src='$picp'></a></td> </tr> "; } print " <tr> <td width='1%'>Name</td><td>$imgs[$x]</td> </tr> <tr> <td>Size</td><td>$picsz</td> </tr> <tr> <td>Resolution</td><td>$pic_nfo[0]x$pic_nfo[1]</td> </tr> <tr> <td>Submitted</td><td>$picd</td> </tr> "; if(session_is_registered("g_password") && $_SESSION["g_username"] == $susername) { print" <tr> <td valign='top'>Description<br><font style='font-size: 10px'><a href='$php_self?editd=$imgs[$x]&u=$susername'>edit</a></td><td>$picdesc</td> </tr> "; } else { print" <tr> <td valign='top'>Description</td><td>$picdesc</td> </tr> "; } print " <tr> <td>Hits</td><td>$pichits</td> </tr> </table> </td> </tr> <tr><th colspan='2'> </th></tr> "; } } print "</table>"; exit; } else $null = &listusers($nfo_path); /**************************************************************************************************/
Ja ongelma on seuraavanlainen, eli kun käyttäjää tällä nimellä ei jostain syystä löydy, niin tulee ilmoitus:
Warning: getimagesize(): Read error! in /home/www/jonsal4.100webspace.net/index.php on line 1060
Warning: getimagesize(./_th/th_): failed to open stream: No such file or directory in /home/www/jonsal4.100webspace.net/index.php on line 1061
Tässä ei ole koko tiedoston lähdekoodia, mutta se kohta, johon virheilmoitus kuuluu. Eli pitäisi saada sillä lailla, että kun käyttäjää ei löydy, niin tulee ilmoitus siitä eikä noita varoituksia.
if file_exists("tiedosto.txt") { // tiedosto on olemassa } else { // tiedostoa ei ole olemassa }
mihin kohtaa tuo pitäisi laittaa. ja tiedoto tunnistaa käyttäjän kansiosta ei tiedostosta
Aihe on jo aika vanha, joten et voi enää vastata siihen.