(file) Return to album-rescan.php CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / photo / sspadmin

 1 rizwank 1.1 <?php
 2             require "./inc/head.php";
 3             ?>
 4             <?php include "./inc/doctype.php"; ?>
 5             <head>
 6             <?php include "./inc/charset.php"; ?>
 7             <title>SSP Admin :: Add an Album</title>
 8             <?php include "./inc/head_elem.php"; ?>
 9             </head>
10             
11             <body>
12             	<div id="container">
13             		
14             		<?php include "./inc/h1.php"; ?>
15             		
16             		<?php
17             			if ($_GET['go'])
18             			{
19             				$aid = $_GET['aid'];
20             				$q = "SELECT path FROM $atbl WHERE id = $aid";
21             				$r = mysql_query($q);
22 rizwank 1.1 				$row = mysql_fetch_array($r);
23             				
24             				$d = $row['path'];
25             				
26             				$album_photos_dir = 'albums/'.$d.'/lg';
27             				$dh  = @opendir($album_photos_dir);
28             				while (false !== ($filename = readdir($dh))) {
29             					if ( eregi("jpg",$filename) || eregi("swf", $filename) || eregi("flv", $filename)) {
30             						$album_photos[] = $filename;
31             					}
32             				}
33             				$i = 0;
34             				for($j = 0; $j < sizeof($album_photos); $j++) {
35             					$n = $album_photos[$j];
36             					$q = "SELECT id FROM $itbl WHERE aid = $aid AND src = '$n'";
37             					$r = mysql_query($q);
38             					
39             					if (mysql_num_rows($r) == 0)
40             					{
41             						mysql_query("INSERT INTO $itbl (id, aid, src) VALUES (NULL, $aid, '$n')") or die("Error".mysql_error());
42             						echo '<p>New File '.$n,' Found...</p>';
43 rizwank 1.1 						$i+=1;
44             						flush();
45             					}
46             				}
47             				echo '<h2>Rescan Album Folder for New Images</h2>';
48             				if ($i == 0)
49             					echo '<p>Scan Complete. No New Files Found.</p>';
50             				else if ($i == 1)
51             					echo '<p>Scan Complete. '.$i.' New File Found and Added.</p>';
52             				else
53             					echo '<p>Scan Complete. '.$i.' New Files Found and Added.</p>';
54             				
55             				echo '<p><a href="album-rescan.php?aid='.$aid.'&go=true">Scan Again</a></p>';
56             			}
57             			else
58             			{
59             			?>
60             			<h2>Rescan Album Folder for New Images</h2>
61             			<p>This process checks for newly added images to your album directory and adds them to the album.</p>
62             			<p><a href="album-rescan.php?aid=<?php echo $aid; ?>&go=true">Rescan Now</a></p>
63             			
64 rizwank 1.1 			<?php } ?>
65             	</div>
66             	
67             </body>
68             </html>

Rizwan Kassim
Powered by
ViewCVS 0.9.2