1 rizwank 1.1 <?php
2 require "./inc/head.php";
3
4 $d = $_REQUEST['aDir'];
5 $aName = $_REQUEST['aName'];
6 $path = $d;
7
8 mysql_query("INSERT INTO $atbl (id, name, path) VALUES (NULL, '$aName', '$path')") or die("Error".mysql_error());
9
10 $aid = mysql_insert_id();
11
12 $album_photos_dir = 'albums/'.$d.'/lg';
13 $dh = @opendir($album_photos_dir) or die('<p>Folder <strong>'.$d.'</strong> does not exist, <a href="add-album.php">go back</a> and try again</p>');
14 while (false !== ($filename = readdir($dh))) {
15 if ( eregi("jpg",$filename) || eregi("swf", $filename) || eregi("flv", $filename)) {
16 $album_photos[] = $filename;
17 }
18 }
19 $i = 0;
20 for($j = 0; $j < sizeof($album_photos); $j++) {
21 $n = $album_photos[$j];
22 rizwank 1.1 mysql_query("INSERT INTO $itbl (id, aid, src) VALUES (NULL, $aid, '$n')") or die("Error".mysql_error());
23 $i+=1;
24 }
25
26 header("Location: edit-album.php?aid=$aid&m=2");
27 ?>
|