Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $directory = dirname(__FILE__);
- if (glob($directory . '/public/img-*.[jpgb][pnim][gfp]') != false)
- {
- $imgcount = count(glob($directory . '/public/img-*.jpg'));
- $imgcount += count(glob($directory . '/public/img-*.bmp'));
- $imgcount += count(glob($directory . '/public/img-*.png'));
- $imgcount += count(glob($directory . '/public/img-*.gif'));
- }
- else
- {
- $imgcount = 0;
- }
- if ($imgcount > 0)
- {
- //
- // Now we connect to the MySQL server and select the database
- //
- include_once $directory.'/admin/config.inc.php';
- if ($dbc = @mysql_connect ($GB_DB['host'], $GB_DB['user'], $GB_DB['pass']))
- {
- if (!@mysql_select_db ($GB_DB['dbName'], $dbc))
- {
- die ('<p>Could not select the database because: <b>'.mysql_error().'</b></p></div></body></html>');
- }
- }
- else
- {
- die ('<p>Could not connect to MySQL because: <b>'.mysql_error().'</b></p></div></body></html>');
- }
- //
- // End of MySQL database information check
- //
- $our_query = 'SELECT COUNT(p_filename) AS totalpics FROM '.$table_prefix.'_pics';
- $result = mysql_fetch_assoc(mysql_query($our_query, $dbc));
- if($imgcount > $result['totalpics']) {
- echo 'You have ' . ($imgcount - $result['totalpics']) . ' orphaned image files in your public directory.';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement