Jump to content

jo.nova

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by jo.nova

  1. Well, first of all, I'm not an expert, so some more specific error checking advice would be appreciated. How would I use mysql_error() if I'm building queries and feeding them to a database object, instead of talking directly to the database?
  2. Hi, Can anyone find something wrong with this statement? //store the current section id $secNum = $secResult[$i]->id; //check value echo "Section: " . $secNum . "<br /><br />"; //set query $sql = "SELECT * FROM #__categories WHERE section = $secNum GROUP BY id ORDER BY ordering"; //get results $database->setQuery($sql) or die ('Could not set category query'); $catResult = $database->loadObjectList() or die ('Could not load category object list'); It fails every time. Here's the output: The statement runs fine when run through phpMyAdmin, except I have tweak the table prefixes because of the DB object abstraction. Any ideas?
  3. I highly recommend Joomla. It's very extendable, plus there's some extensions already available for what you want to do. Joomla is all that I use for websites because it rocks. Good luck!
  4. I'm working on modding a Joomla component. I'm not quite sure, but I'm unable to set a query: // get all the categories that are bound to a content item $sql = "SELECT #__categories.* FROM #__categories INNER JOIN #__content ON #__content.catid = #__categories.id AND #__categories.published = 1 AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' ) AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' ) GROUP BY #__categories.id ORDER BY #__content.ordering "; $database->setQuery($sql); $result = $database->loadObjectList(); for($i = 0; $i < count($result); $i++) { //get current section id $secID = $result[$i]->section; echo "Current section ID is: " . $secID . "<br />"; //query: select all category items that have the current section id $sql = "SELECT #__categories.* FROM #__categories WHERE #__categories.section = '$secID' AND #__categories.published = 1 AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' ) AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' ) GROUP BY #__categories.id ORDER BY #__categories.ordering" or die ("Could not assign query"); $database->setQuery($sql) or die ('Could not set query: '. $sql); $catResult = $database->loadObjectList() or die ('Could not load object list'); ... The script makes it to this line, then dies: $database->setQuery($sql) or die ('Could not set query: '. $sql); Can I not use $database->setQuery within the for-loop? Can't code within the loop reference variables that are in a scope above it? - Joe
  5. How would I write a function to check if someone is a certain age?  They will be filling in a date of birth field, which I can check against today's date.  But how do I implement it?
  6. Whoa...that's crazy.  How's it work?  ;)  Thanks, I'll play with it! - Joe
  7. I'm using the free DHTML date-chooser calendar from DHTMLgoodies.com.  I'm using it so that customers can simply pick a date from one interface instead of using three drop-down boxes. The dates chosen from the calendar represent the date/time that a customer would like to pick up their project. So, to give us some time, I set the default due date to be three days from the current date: [code] <?php $dateyear = date(Y); $datemonth = date(m); $dateday = date(d) + 3; ?>[/code] But, if it were the 31st of August 2006, the above code would just set the due date to be the 34th of August 2006, which obviously is no good. So, I wrote the following to compensate for this: [code] <?php if (($datemonth == 01) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 02) & (($dateyear % 4) == 0)){ if ($dateday > 29) {$datemonth++; $dateday = $dateday - 29;} } else if (($datemonth == 02) & (($dateyear % 4) !== 0)) { if ($dateday > 28) {$datemonth++; $dateday = $dateday - 28;} } if (($datemonth == 03) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 04) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 05) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 06) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 07) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 08) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 09) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 10) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 11) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 12) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31; $dateyear++;} ?> [/code] BUT, I'm still getting the same results: the date increases to a number that is beyond the number of days in a month. For exampe, I just ran the code and  the due date came up as August 33rd, 2006. Where am I going wrong? - Joe
  8. Corona, you're the dopest!  I didn't know that!  I'll try it, thanks!
  9. I know that when using Adobe Designer, I am able to set the PDF form to send XML to a server.  So, theoretically, you should be able to write a PHP script that catches that XML and does something with it. I'm not sure where to find any guides, though! Sorry! - Joe
  10. I've created a multi-page form that I want to have store information until the last page where it will then be entered in a DB. The first page is a <form> that calls the second page upon submittal.  The second page is a PHP script that validates the data then displays a java file-upload applet.  The java applet calls it's own PHP script (which I've modified for my needs).  This second page can successfully echo test variables from the $_SESSION array.  After uploading files, the user clicks a "Next" button, which is actually a submit button that loads the third and final page. The third page will contain a confirmation number and will do three other things:  1) enter all variables into the DB, 2) email the user and the administrator, and 3) destroy the session. At this point, I am unable to echo any $_SESSION variables on the third page, but I AM able to echo them on the second page. Do I have to do something special for the third page to acknowledge the session?  What am I missing here? - Joe
  11. Sure, I can edit any of the PHP. But I can't edit the applet, obviously, because its a JAR application file. So, no it's not a matter of not being able to edit the PHP scripts.  I'm just asking "what's the best angle for this problem"?
  12. I started a thread about this yesterday, but it looks like its gone! I'll be more clear this time. I'm trying to implement a form that gathers customer information and allows them to send me files.  Right now, the script takes the form's $_POST variables, puts them in a MySQL database, emails me with the customer information and attaches their file to the email, and also emails the customer a confirmation email of their order. I've run into two problems:  1) The php.ini on my host has the max_upload setting set to 8MB and 2) even if I bumped up the max_upload setting, I would still have to worry about browser time-outs for large files. So, I've found an open-source applet that allows uploading to my webserver.  I've tied this applet into my form, and it works great, but now I've got other problems.  The applet uses a php script to name the file and move it from a temporary location to its permanent location.  This script is called as a parameter of the applet.  The problem is that the script uses the flush() function; so after it's done, the variable that contains the file's name is blown away. I need to be able to capture the file name and send it in the emails. Or even better, when the form is submitted, create a folder named the same as the unique order number, then move the files into that folder. Any ideas?
  13. Hmmm...That didn't work. Here's what I got as a response: Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/o/c/rocknroll124/html/site/sendfile/test1.php:9) in /home/content/r/o/c/rocknroll124/html/site/sendfile/test1.php on line 16 I read in the manual: "Note:  Since PHP 4.4.2 and PHP 5.1.2 this function prevents more than one header to be sent at once as a protection against header injection attacks." Is there another way?
  14. So, I have some variables in a PHP script that I would like to carry over to a different page when it loads. How do I do it?  With global variables? How would I use them?
  15. ::Chuckles::  :D Shogun, I looked at every one of those yesterday!  They're cool, but not what I'm looking for.  Thanks, though! pixy,  I'd love to do it in Flash.....except I am completely bewildered by action scripts at this point. Isn't everbody?  ;D Wish I DID know flash, though.  Maybe someday I'll dig in.
  16. I found a sweet article on this topic at: http://www.gen-x-design.com/archives/ajax-activity-indicators-make-them-global-and-unobtrusive/1/ Seems to be just what I'm looking for. Now I've gotta figure the damn thing out!
  17. Yeah, I kinda figured that.  Any suggestions?
  18. From what I've read, I've gathered that doing a progress bar purely with PHP is pretty much impossible. I'd like my form (which is used for submitting print-jobs to our print-shop's workflow) to display an interim message or image between the time that the Submit button is hit and the time that the confirmation message is displayed.  Since some large files take a while to upload, right now the customer just sees the form they filled out while their file uploads, with no indication that anything is happening. Is it possible to do something like: While (form data is uploading) {display message}; ??? Any ideas?
  19. akitchin, thanks everything you said worked out great! Koobi, thanks man, got it working in the meantime.  Here's how I implemented it: [code=php:0] //put filename in a variable before checking file extension $filetypecheck = ($_FILES['FileName']['name']); //put file's extension in a variable $extension = strrchr($filetypecheck, '.'); //make an array of allowed extensions $allowext = array(".zip",".sit",".tif",".jpg",".pdf",".eps",".gif",".psd"); // check to see if a file was entered and if that file is a valid type if ((!$_FILES['FileName']['name']) || (!in_array($extension, $allowext))) // if not, add that error to our array $errors[] = '- Your file to be printed (in one of the acceptable formats)'; [/code] We're a printshop, so we're probably not gonna get anything like .gz files from customers since almost the entire industry is using Macs. Thanks guys!  I hope to get as proficient at this so that I can help others someday as well!
  20. Gotcha.  Yeah, you're right about the logic; I just uploaded it and got erros no matter what the file type is.  Thanks for the advice!
  21. So would this work?: [code=php:0]//put filename in a variable before checking file extension $filetypecheck = ($_FILES['FileName']['name']); //put file's extension in a variable $extension = strrchr($filetypecheck, '.'); // check to see if a file was entered and if that file is a valid type if ((!$_FILES['FileName']['name']) || ($extension !== "zip" || "sit" || "jpg" || "pdf" || "tif" || "gif" || "eps" || "psd")) // if not, add that error to our array $errors[] = '- Your file to be printed (in one of the acceptable formats)';[/code] Or does it have to be like this?: [code=php:0]//put filename in a variable before checking file extension $filetypecheck = ($_FILES['FileName']['name']); //put file's extension in a variable $extension = strrchr($filetypecheck, '.'); // check to see if a file was entered and if that file is a valid type if ((!$_FILES['FileName']['name']) || ($extension !== "zip") || ($extension !== "sit") || ($extension !== "jpg") || ($extension !== "pdf") || ($extension !== "tif") || ($extension !== "gif") || ($extension !== "eps") || ($extension !== "psd")) // if not, add that error to our array $errors[] = '- Your file to be printed (in one of the acceptable formats)';[/code] I'm new, so bear with me!
  22. Sweet.  Good info, Koobi!  This board is so damn helpful.
  23. WOW! Thanks, guys.  I go to lunch, and return to find an entire disseratation on my topic.  Much appreciated!  I'm lovin' PHP; way better than my boring-ass C++ class. Thanks! Now, here's the next part I just realized: How do I make the match case insenstive?  (Just in case someone happens to have their file extension in caps)
  24. I'm trying to isolate the file extension of  uploaded files so that I can check them for validity.  For example, say I want to only accept ".zip" files: Let's say the value of $_FILES['somefile']['name'] is "afile.zip"; I want to put just the extension in a variable and check it against a predefined set of strings.  I can setup the string filtering, but I don't know how to tell PHP to look at just the last three characters in a file name. Any help?
×
×
  • 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.