
| Tutorials Main Latest Tutorials Popular Tutorials Top Rated Tutorials |
| Login to See your Favorite Tutorials |
| Description: Simple php function to validate links | |
| Version: 1.0 | |
| Added on: 22 July 2007 | |
| Author: floppy | |
| Difficulty Level: Very Easy | |
| Views: 1183 | |
| Rating: 10.0 (1 Vote) | |
Note I used the phpnuke adodb $db standard variable here. If your using another protocol just modify the necessary.
| Code: |
| function validate() {
global $prefix, $db, $module_name, $admin; //BE SURE TO SET YOUR PATH $path = "myfiles/"; echo '<table width="100%">'; $sql = "SELECT * FROM ".$prefix."_files order by fid"; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)){ $fid = intval($row['fid']); $title = $row['title']; $filename = $row['filename']; echo '<tr>'; echo '<td width="50%">'.$fid.' '.$title.'</td>'; if(file_exists($path.$filename)){ echo '<td width="50%"><font color="green">'.$filename.' is Good</font></td>'; }else{ echo '<td width="50%"><font color="red">'.$filename.' is Broken</font></td>'; } echo '</tr>'; } echo '</table>'; } |