Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. oops. need to increment count in final loop. sorry. wrote that up in about 2mins. <?php //finish table. fill in blank cells. while($count % $num_cols != 0){ echo "<td> </td>"; $count++; } echo "</tr></table>";
  2. something like: <?php $count=0; $num_cols = 3; echo "<table>"; while($row = mysql_fetch_array($results)){ if($count == 0 && $count % $num_cols == 0) echo "<tr>"; if($count != 0 && $count % $num_cols == 0) echo "</tr><tr>"; //echo row data in <td><td> $count++; } //finish table. fill in blank cells. while($count % $num_cols != 0){ echo "<td> </td>"; } echo "</tr></table>"; ?>
  3. well there won't be more with "limit 0,9" in there. when i've done tables like this I just keep a count of whatever row im on. mod your count every loop through by the number of columns you want. if it equals zero close your row tag and add a new row tag. when the result set is done. check your count again and fill in any blanks until count mod num_columns equals zero then close the row off. there is also the first case you need to check for when you only a tr tag.
  4. well you likely have an error in your query. change $result = mysql_query ($query, $dbc) or die ('Error querying database.'); to $result = mysql_query ($query, $dbc) or die ("MYSQL ERROR: $query - " . mysql_error()); and see what it says.
  5. cool. ya I was thinking something like that. wasn't sure if there was a better way to do it.
  6. anyone have any ideas or examples for generating unique keys to be used as a license? the codes will be tied to a person's user account. i was just going use a random generated string and check it against the table of license codes. anyone have any better ideas? there wasn't really any good results from google. thx.
  7. your going to need some javascript in there. couple options: use js to reload the form with the onChange state for the select menu then use php to check the value of the menu and show the appropriate hidden form. or use js with the onChange state to show a hidden menu (ie. display: none or display: block) it would be a couple lines of js with jquery.
  8. you want to look into ajax. edit: actually that probably won't work. I'm not sure if you can do that unless you use an iframe maybe.
  9. well if it's a year you probably want no zeros so (15,0)
  10. the part you just changed is where you set the file name.
  11. funny. i just wrote/copied a file for this. $file = "relative path to file"; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="haha_download_my_spam.zip"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); ob_clean(); flush(); header('Location: redirect'); } else { echo "FILE DNE"; } only tested with a zip so far.
  12. ok i set said it right in the first place(couldn't remember if the 3rd bit was read or write). all users have write access to the file (644) but even 777 didn't help. the command line is taking in the whole email. my bounce@ email account is being piped to this script. the bounce class parses the email and figures out what the failed address is and if it's a soft error (mailbox full) or hard error (mailbox doesn't exist). then i update our newsletter flag accordingly. im not sure why i can't write to this file. i pretty much gave up on friday because i wasted too much time on it. the only reason i did this instead of just emailing myself the debug (which works) was because i was expecting about 25k bounces from one of our newsletters. i really think it's related to privs in the different user accounts.
  13. there is also a max post limit the in php.ini too i believe. i think the default is 2 megs.
  14. hmmmm your not using your first row. function delete_declined_files() { global $db; $dp = new TMySQLQuery; $dp->connection = $db; $folder=""; $sql="select folder from photos where published=2"; $dp->open($sql); while($folder=$dp->row["folder"]){ if($folder!="" and file_exists($_SERVER["DOCUMENT_ROOT"].site_root.site_upload_directory."/".$folder)) { $dir = opendir ($_SERVER["DOCUMENT_ROOT"].site_root.site_upload_directory."/".$folder); while ($file = readdir ($dir)) { if($file != "thumb1.jpg") { @unlink($_SERVER["DOCUMENT_ROOT"].site_root.site_upload_directory."/".$folder."/".$file); } } } } } if this doesn't work i would read up on the TMySQLQuery class you are using.
  15. im not sure how that mysql wrapper works but it looks like you could do this: while($folder=$dp->row["folder"]){ //put folder remove code in here }
  16. posting the code would help.
  17. well you only select one row from your result set i think (not exactly sure how your mysql class works) so it will only delete that one folder. you need to loop through your results and perform what you're doing.
  18. ok it seems like it can't save the file for some reason. i tried to see if it was an error on closing the file but nope. the timestamp on the file isn't changing though so it definitely isn't writing out properly. would the mail user have rights to do this inside someone elses user account if the perms are set right? Oh and I meant the file was 622 above. I tried deleting the file and php wasn't able to create a new one so it seems like a permissions thing. Any UNIX people shed some light on this?
  19. well first off get the current month and year. $month = date('n'); $year = date('Y'); Then add this to your month select option: <option label="Jan" value="1" <?php echo ($month==1) ? "selected='selected'" : ""; ?>>Jan</option> 1 will change to 2 and etc etc as you go thru the months. year is the exact same as thing. let me know if you have any questions.
  20. I'm writing a bounce email tracker for newsletters using email piping. I'm trying to write the bounce emails to a log file for reference but for some reason it's not writing to the file. It tells me it's writing to the file but the content isn't there. #!/usr/bin/php <?php //include bounce class require_once("bounce_driver.class.php"); // read in the bounce from stdin $fd = fopen("php://stdin", "r"); //fopen("bounce_test2.txt", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); $bounce_info = Bouncehandler::get_the_facts($email); $bounce_type = $bounce_info[0]['action']; $bounce_email = $bounce_info[0]['recipient']; $timestamp = date('H:i:s M j, Y', time()); $debug_line = "$timestamp - $bounce_email - $bounce_type\n"; if(!$handle = fopen('bounce_log.txt','a')) mail('email','Bounce Debug','could not open file'); $fw = fwrite($handle,$debug_line); if(!$fw) mail('email','Bounce Debug','write error'); fclose($handle); //debug mail('email','Bounce Debug',"num bytes written = $fw\n\n$debug_line\n\n" . print_r($bounce_info,true)); //commented out db code. ?> So I've set up a ton of debug stuff. The fopen and fwrite calls don't send me any email so it doesn't seem like any errors there. The debug email tells me that bytes are being written. Debug Email num bytes written = 70 12:12:15 Jan 29, 2010 - whatwhat@asdflkajsdflaksdfjalsdf.com - failed Array ( [0] => Array ( [recipient] => whatwhat@asdflkajsdflaksdfjalsdf.com [status] => 5.1.2 [action] => failed ) ) But if I look at the file the line isn't there. The file was originally 644 but I changed it to 777 with no differences. Any ideas? Thx.
  21. you could be getting spammed then. someone might be injecting mail headers into your form fields.
  22. you have tried sending the form to yourself so you can verify the from field?
×
×
  • 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.