Jump to content

denoteone

Members
  • Posts

    383
  • Joined

  • Last visited

    Never

Everything posted by denoteone

  1. Ia m building an array like so $images_new = array(); while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..' && !is_dir($dir.$file)){ $images_new[] = array('name' => $file, 'size' => filesize($dir.$file)); } } Now I want to get the last value of the last 'name' I thought it was something like: $lastname = end($images_new['name']); echo $lastname; the error I am getting is: Warning: end() [function.end]: Passed variable is not an array or object in
  2. had it backwards echo $images_new[0]["name"];
  3. now that I want to echo the first value of name in $images[]; but the following code is giving me this error. Notice: Undefined index: name echo $images_new['name'][0];
  4. I am trying to loop through a directory and assign the file names and file sizes to an array like so. $i = 0; while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..' && !is_dir($dir.$file)){ $images[file[$i] => $file, file_size[$i] => filesize($file) ]; } $i++; } but this part of the code is breaking my page.
  5. the 5 second wait is put in to make sure that there are no files currently uploading to the directory. So when the script is started I get the files and file sizes and put that into array #1 then wait 5 seconds and and get the names and sized again in a new array #2. I then compare the two arrays and if they are not the same that means the file sizes has changed so an upload is happening.
  6. Ok i have the comparing of the array's working. But how can I increment so that the script continues after 5 seconds?
  7. i want to get the names and sizes of files in a specific directory and the save them in and array and then 5 seconds later do it again and compare the two arrays. if they do not match exactly stop the script. This is what i have so far.... If anyone has a better way let me know. $dir = "upload/new/"; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { $images["file". $i => $file, "file_size". $i => filesize($file) ]; } //Somehow wait 5 seconds and then run the while loop again while (($file = readdir($dh)) !== false) { $images_new["file". $i => $file, "file_size". $i => filesize($file) ]; } closedir($dh); //now compare the two If ($images != $images_new){ do this }else{ echo "the arrays are the same"; } Any ideas would be great!
  8. I have check box inputs in an html form that all have the name="content[]" on submit how can I save all of the items checked into a variable that I can echo. so if the boxes below are all check it could echo $content; would show name1name2name3 <input type="checkbox" name="content[]" value="name1">Name 1 <input type="checkbox" name="content[]" value="name2">>Name 2 <input type="checkbox" name="content[]" value="name3">>Name 3
  9. If they are on my site and they fill out a quiz I would like for them to be able to download there answers or just save a copy on there machine. is this possible?
  10. caught one of my own mistakes in the $exec_string variable. define('FFMPEG_LIBRARY', '/usr/bin/ffmpeg '); $exec_string = FFMPEG_LIBRARY.' -i '. $newname .' -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv'; echo $exec_string; exec($exec_string); But still not working.
  11. Trying to convert an avi into a flv using a phpscript and ffmpeg. Below is the most important part of my code but I am not able to convert yet. $newname = myvideo.avi define('FFMPEG_LIBRARY', '/usr/bin/ffmpeg '); $exec_string = FFMPEG_LIBRARY.' -i /var/www/html/site/videos/day/upload/$newname /var/www/html/site/videos/day/upload/outputfile.flv'; exec($exec_string); I have a video portal running so I am sure that I have ffmpeg installed correctly. Any help would be great.
  12. service sendmail status sendmail is stopped. Is there anyway I can specify an external mail server?
  13. I have a test mail function that is echoing to the screen that it was successful. But I am not getting the email. This is a new server set up. but below is my email script and the the settings from my php.ini file. Does it look like I am missing anything? <? // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to="me@localhost"; // Your subject $subject="Test"; // From $header="from: your name <your email>"; // Your message $message="Hello \r\n"; $message.="This is test\r\n"; $message.="Test again "; // send email $sentmail = mail($to,$subject,$message,$header); // if your email succesfully sent if($sentmail){ echo "Email Has Been Sent ."; } else { echo "Cannot Send Email "; } ?> php.ini sendmail_path = /usr/sbin/sendmail -t -i sendmail_from = me@myserver.com
  14. I need to add a whole bunch of variables to one variable and then send that variable in a email. But my page keeps breaking. I have an array for the titles of the product and an array from my my form with price values. $txt = ''.$products2[0] .': '.$_POST[$products2[0]].'<br/> '.$products2[1] .': '.$_POST[$products2[1]].'<br/> '.$products2[2] .': '.$_POST[$products2[2]].'<br/> '.$products2[3] .': '.$_POST[$products2[3]].'<br/> '.$products2[4] .': '.$_POST[$products2[4]].'<br/> '.$products2[5] .': '.$_POST[$products2[5]].'<br/> '.$products2[6] .': '.$_POST[$products2[6]].'<br/> '.$products2[7] .': '.$_POST[$products2[7]].'<br/> '.$products2[8] .': '.$_POST[$products2[8]].'<br/> '.$products2[9] .': '.$_POST[$products2[9]].'<br/> '.$products2[10] .': '.$_POST[$products2[10]].'<br/> '.$products2[11] .': '.$_POST[$products2[11]].'<br/> '.$products2[12] .': '.$_POST[$products2[12]].'<br/> '.$products2[13] .': '.$_POST[$products2[13]].'<br/> '.$products2[14] .': '.$_POST[$products2[14]].'<br/> '.$products2[15] .': '.$_POST[$products2[15]].'<br/> '.$products2[16] .': '.$_POST[$products2[16]].'<br/> '.$products2[17] .': '.$_POST[$products2[17]].'<br/> '.$products2[18] .': '.$_POST[$products2[18]].'<br/> '.$products2[19] .': '.$_POST[$products2[19]].'<br/> '.$products2[20] .': '.$_POST[$products2[20]].'<br/> '.$products2[21] .': '.$_POST[$products2[21]].'<br/> '.$products2[22] .': '.$_POST[$products2[22]].'<br/> '.$products2[23] .': '.$_POST[$products2[23]].'<br/> '.$products2[24] .': '.$_POST[$products2[24]].'<br/> '.$products2[25] .': '.$_POST[$products2[25]].'<br/> '.$products2[26] .': '.$_POST[$products2[26]].'<br/> '.$products2[27] .': '.$_POST[$products2[27]].'<br/> '.$products2[28] .': '.$_POST[$products2[28]].'<br/> '.$products2[29] .': '.$_POST[$products2[29]].'<br/>''; $headers = "From:Product Prices" . "\r\n" . "CC: mrawers@email.com"; mail($to,$subject,$txt,$headers);
  15. I have an array with numbers in it. The numbers correspond to terms: Should I find and replace the numbers with the terms? Or is there a better way of doing this? $group= array("1","2","3"); 1 = Home Team 2 = Away Team 3 = mascot I want to be able to use the array and say something like echo $group[1]; Away Team
  16. I echoed my $sql variable and I am not telling which row to update. Thanks for your guys help. I will post if I am still having issues. UPDATE price2 SET price='5.99' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='6.99' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.69' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.49' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.59' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.69' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.59' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.69' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.79' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.69' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.79' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.89' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.79' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.89' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.99' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.89' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.99' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='2.09' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='1.99' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='2.09' WHERE storeID='201' AND storeType = '1'UPDATE price2 SET price='2.19' WHERE storeID='201' AND storeType = '1'
  17. Here is more info regarding the problem. Array: $products1 = array("mocha_small", "mocha_medium", "mocha_large", "icemocha_small", "icemocha_medium", "icemocha_large", "lat_cap_small", "lat_cap_medium", "lat_cap_large", "icelat_small", "icelat_medium", "icelat_large", "coffee_small", "coffee_medium", "coffee_large", "icecoffee_small", "icecoffee_medium", "icecoffee_large", "hotchoc_small", "hotchoc_medium", "hotchoc_large"); form info: <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <input type="hidden" name="storeid" value="<? echo $store_info; ?>"> <input type="hidden" name="storetype" value="<? echo $type; ?>"> <? for($i=0;$i<21;$i++){ if (($i + 1) % 3 == 0 ) { echo '<div style="float:left;margin-right:20px;"><input type="text" name="'.$products1[$i].'" value="'. $content[$i]['price'].' " size="6"> </div><br/><br/><br/>'; }else{ echo '<div style="float:left;margin-right:20px;"><input type="text" name="'.$products1[$i].'" value="'. $content[$i]['price'].'" size="6"> </div>'; } } ?> <div id="submitbutton"><input type="submit" value="Submit" border="0" name="submit3"></div> </form> the form loops though and shows the value as is from the database and what I am doing is letting the user make changes to the fields and then click submit to update.
  18. I am trying to loop through an array and update a database with a $post variable. I am pretty sure it has something to do with the way i am referencing the post variable... maybe I am missing a quote or I have to many in there any help would be awesome. if(isset($_POST['submit3'])){ for($i=0;$i<23;$i++){ $sql="UPDATE price2 SET price='".$_POST[$products1[$i]]."' WHERE storeID='".$_POST['storeid']."' AND storeType = '".$_POST['storetype']."'"; $result = $db->query($sql); echo "success"; } }
  19. Thanks again Nightslyr. I actually was having this issue yesterday and now that I am coming back to it this morning I am not sure how I didn't notice I was concatenate two echo statements.
  20. when I insert echo '<div>'. echo "test"; .'</div><br/><br/><br/>'; This code breaks my page and I am not getting an error message. below is the whole block of code for ($i = 0; $i < 21; $i++) { if (($i + 1) % 3 == 0 ) { echo '<div>'. echo "test"; .'</div><br/><br/><br/>'; }else{ echo "test2"; } }
  21. thanks for your help Nightslyr. I used if (($i + 1) % 3 == 0 )
  22. the only problem with this is that the first $i will always have a break because it is zero.
  23. Whatever I did I broke the page but I am not getting an error? for($i=0;$i<21;$i++){ echo ''. if ($i % 3 == 0) {.'<div style="margin-bottom:3px;text-align:right;">'.}else{ } $products1[$i].': <input type="text" name="'.$products1[$i].'" value="" size="6">'. if ($i % 3 == 0) {.'</div>'.}else{}.''; }
×
×
  • 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.