Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by dalecosp

  1. Hmm. Not bad thoughts. A few points: 1. Disabling a form control could cause them to think the page is broken and leave. Better might be to simply have JS check the form fields and return false (plus an appropriate error message) when a field doesn't meet requirements. 2. Username/email check --- good. If you can accomplish this via JS and Ajax, that's industry-standard these days. Failing that, there's nothing *particularly* wrong with doing it only afterwards. You must do it at some point. 3. PHP now has filter_input() functions, so you might not have to write so many regexp checks: <?php if (!filter_input($_POST['email'],FILTER_VALIDATE_EMAIL) { //the email isn't valid my_bad_email_foo(); } 4. Password verification: what do you mean ... enforce a specific policy? That's a good idea. This is both right and wrong. Best practice: do both; Javascript on client for user-friendliness and PHP on server-side because of "user UNfriendliness" ;) One comment on your JS: I'm pretty sure you want the VALUE, not the HTML form object. Try: var validate_name = document.getElementById("username").value;
  2. Not quite sure, but I think that Is a rather newly-available syntax that wasn't supported as long ago as 5.3.0. edit: Boom. Cho0cu3r beat me to it.
  3. It works fine here. Have you done a var_dump at each stage of processing to see if something's funky? <?php /* Uncomment each commented line in turn and see what's up. */ $date1 =date_create("2013-12-07"); //var_dump($date1);exit; $date2 = date("Y-m-d"); $date2 = date_create("$date2"); //var_dump($date2);exit; echo "<br>"; $Gap = date_diff($date1, $date2); //var_dump($Gap);exit; echo $Gap->format("%a days"); Also, what system are you on?
  4. Heh heh, may have to hit up cuz and let him know your idea ;-) ;-)
  5. LOL ... no, not *quite*. Just a programmer. Glad to hear it!
  6. For a quick hack, try changing this: $target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0; to this: $target_page_num = !empty($target_page_num) ? $target_page_num[0] : 0; Not sure it's right, though --- YMMV and all that.
  7. Well, at least, this much is wrong: header("KitchenDatabase.html"); header() requires more than that. Try this: header("Location: KitchenDatabase.html"); (And technically, to match the HTTP Specification, it should be a fully-qualified URL (site.com/name) in the Header().)
  8. Yes. You're welcome. What is the error? You're assuming that something exists that doesn't. $row doesn't have ['id']['quantity'], it only has $row['id']. What's in that ID field? And what are you trying to accomplish ... counting something?
  9. Hmm, yes. So, what, then ... a DATEDIFF() call, maybe?
  10. And the answer: yes. I'd do it that way, fife.
  11. So, mac_gyver, could he use FROM_UNIXTIME() in that query to make it happen without changing his DB schema? WHERE DATE_FORMAT(FROM_UNIXTIME(StaffDOB),'%m%d') BETWEEN DATE_FORMAT(CURDATE(),'%m%d') AND DATE_FORMAT(CURDATE() + INTERVAL 14 DAY,'%m%d');
  12. The problem is that you've recorded the birth-YEAR in the UNIX timestamp. 1984 was 29 years ago, and is (fairly obviously) not between CURDATE and CURDATE+14. I'd go out on a limb and say that maybe a Unix TS (as much as I like to use them) wasn't the best choice for a birthdate here. There might be some magic in SQL that's beyond me that could help, but I'd recommend thinking up an additional table and scripting something in PHP to get some birthday data that you can use more easily.
  13. You'll want to use some valid SQL for this: $select = mysql_query("SELECT "); //this won't work :-( //try this instead $movies_table = "name_of_your_table"; $query = "select no,name,price from $movies_table where price >20 order by price DESC;"; $select = mysql_query($query);
  14. Come on now friend ... it's not THAT hard //lines like these will need changed: echo "<span><a id='page_a_link' href='info5.php?page=$j'>< Prev</a></span>"; //needs phone parameter echo "<span><a href='info5.php?page=$i' id='page_a_link'>$i</a></span>"; //needs phone parameter //to this echo "<span><a id='page_a_link' href='info5.php?page=$j&phone=$phone'>< Prev</a></span>"; //has phone parameter echo "<span><a href='info5.php?page=$i&phone=$phone' id='page_a_link'>$i</a></span>"; //has phone parameter //At the top, because you're only POSTing the first time (and using GET thereafter), you will need something like: if (isset($_POST['phone'])) { $phone = $_POST['phone']; } elseif (isset($_GET['phone']) { $phone = $_GET['phone']; } And you probably should consider some type of validation on the phone variable as well, unless you're certain that it won't be viewed by anyone except people in your own company.
  15. Well, what sort of projects have you done so far? Typically, here's what happens. 1. A set of requirements are created. What should this do? What functions will the software be able to do, what might the interface look like, how will it be supposed to operate (with what, upon what, etc.)? 2. What strategies can be used to implement the functionality, the interface design, and the operations from #1? 3. What will need to be created to implement these strategies? (Usually that's files with code in them ;) ) 4. Either write up #1-3 and submit it for approval, and start coding ... or just start coding 5. Test. Rewrite what's necessary. 6. Test some more. Evaluate if the design goals have been met. 7. Repeat steps 5-7 until you feel you can foist it on the public without damaging your business. 8. Deploy. ... or at least it's SOMETHING like that
  16. Yeah, that's what I use; he didn't say if it was a requirement ... never can tell when people are doing coursework ;)
  17. PHP Parse error: syntax error, unexpected '<script', expecting '<?php' in /usr/home/stradmadhu/original_post on line 1
  18. Try spaces, newlines, etc? Or, perhaps, use something like DOMDocument to read the HTML instead of a regexp.
  19. I'm tending to think the key to this is in the original post ... ... unfortunately, all I've ever done with proxies is cache and deny access to pr0n sites. edit: And Woah! Gotta love English ... "cache site pages and deny access to..."
  20. If you're sure that products *should* be found on a second page, have the script echo the values of $start and $perpage to you just before the query ... it may be that these values are not what you expect. Also, please consider using the [ code ] BB tags for your code
  21. Because you have "width: 700px;" on that element, maybe?
  22. If I recall from the other thread, part of the problem is that it's on shared hosting and you've got little control and almost no tools to work with. Would it be possible to create a server (even a VM ... that might be perfect for the task), and run some of the standard tools on it (I mentioned some of them there). I use Oracle's VirtualBox on my Win7 workstation @work ... works very well for development, and I can run whatever I want in it.
  23. Where is it you're taking your classes, again?
  24. Well, you'll probably want to talk to the other party, then. Do they have docs somewhere? Tech support?
  25. The canonical way to do this is with DOMDocument; however, you should probably check with the bank (or at least search the bank's site) to see if this is even permitted by the bank's Terms of Service. You may have to call or write to them and ask if an API exists. Alternately, there are quite a few sites that can offer this sort of service, I think. For example, Google probably has an API (they certainly have the app online themselves).
×
×
  • 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.