Jump to content

ashton321

Members
  • Posts

    74
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ashton321's Achievements

Member

Member (2/5)

0

Reputation

  1. Would this be done with javascript instead?
  2. Hello, I am working on a multiple image upload script. I have it working but at the moment i need to call the page from a form that posts the number of fields to display. To change this after I need to reload the page. What I would like to do is add a button that adds another input to the bottom of the form without losing anything that has already been entered. Thanks for any help. Here is what I have that deals only with the upload without much validation yet. <?php if($_GET['action'] == 'upload') { while(list($key,$value) = each($_FILES['images']['name'])){ if(!empty($value)) { $filename = $value; $filename=str_replace(" ","_",$filename); $add = "images/house/$filename"; copy($_FILES['images']['tmp_name'][$key], $add); chmod("$add",0777); } } } else { include('inc/config.php'); include('inc/functions.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php printtitle();?></title> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <div id="header"> <?php include('inc/header.php'); ?> </div> <div id="content"> <div id="posts"> <div class="post"> <h2 class="title">Add Images</h2> <div class="meta"> </div> <div class="story"> <form action="addimages.php?action=upload" enctype="multipart/form-data" method="post"> <fieldset> <legend>Upload Images</legend> <?php $max_no_img = $_POST['numberOfImages']; for($i=1; $i<=$max_no_img; $i++){ echo "<div> <label for='name'>Image $i:</label> <input name='images[]' type='input'/> </div>"; } ?> </fieldset> <div class="submit"> <input type="submit" value="SUBMIT" name="submit" id="submit" /> </div> </form> </div> </div> </div> <div id="sidebar"> <?php include('inc/sidebar.php'); ?> </div> </div> <div id="footer"> <?php include('inc/footer.php'); ?> </div> </body> </html> <?php } ?>
  3. Hi, I have to arrays I would like to make the values of the first become the keys of the new array and the values of the second become the values of the new. I have Array ( [0] => 9 ) Array ( [0] => 15 ) I would like Array( [9] => 15 Or is it possible to loop through two arrays in a foreach at the same time so like both index 0 can be accessed?
  4. Implemented it today, and it worked like a charm! Thanks for all the help
  5. Oh thank you very much! I didnt notice that it scrolled! sorry about that
  6. Ok, I understand that(should have looked for the filetime function), now how would i apply that to my foreach loop that displays the result? I know if it were SQL you would date ORDER by date_modified DESC but i am assuming its not that simple for a foreach loop. I am just beginning to use foreach loops in my coding so im not exactly sure what to do. here is how i display the result currently <?php $firstfile = @ltrim($files[0]["path"], "../webdev/"); $firstfile = '../'.$firstfile; echo '<a href="../scripts/phpThumb.php?src='.$firstfile.'&h=400&w=400" rel="lightbox-'.$galname.'" ><img src="../scripts/phpThumb.php?src='.$firstfile.'&h=200&w=200"</a>'; foreach ($files as $pic) { foreach ($pic as $path) { if ($path != $files[0]["path"]) { $path = @ltrim($path, "../webdev/"); $path = '../'.$path; echo '<a href="../scripts/phpThumb.php?src='.$path.'&h=400&w=400" rel="lightbox-'.$galname.'" ></a>'; } else {} } } ?>
  7. Would i be better off just adding the file names to a database when uploaded? or can it be done with glob?
  8. Hi, I have an array of file names to be used in another script created using glob() is there anyway to order the list by the date modified on the server? <?php $query = mysql_query("SELECT * FROM galleries"); $result = mysql_fetch_array($query); $galname = $result['galname']; $files = array(); foreach(glob("../webdev/images/galleries/$galname/*") as $file) { if(!is_dir($file)) { $files[] = array("path" => $file); } } // echo $files[0]["name"]; $firstfile = @ltrim($files[0]["path"], "../webdev/"); $firstfile = '../'.$firstfile; echo '<a href="../scripts/phpThumb.php?src='.$firstfile.'&h=400&w=400" rel="lightbox-'.$galname.'" ><img src="../scripts/phpThumb.php?src='.$firstfile.'&h=200&w=200"</a>'; foreach ($files as $pic) { foreach ($pic as $path) { if ($path != $files[0]["path"]) { $path = @ltrim($path, "../webdev/"); $path = '../'.$path; echo '<a href="../scripts/phpThumb.php?src='.$path.'&h=400&w=400" rel="lightbox-'.$galname.'" ></a>'; } else {} } } ?>
  9. Not sure about SMF, but i know phpBB has a backup/export feature, i would assume that SMF would too.
  10. When i did it i did if($daynight = 'PM') { $hour = $hour + 12; } then stored it in the database that way it would be out of 24 hrs so you could then use a MYSQL TIME or DATETIME field
  11. try making it $_SERVER['REMOTE_ADDR'] and $_SERVER['PHP_SELF'] instead of $REMOTE_ADDR and $PHP_SELF
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.