Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. The manual page on control structures contains a section on every kind of loop. -Dan
  2. Googling for your error messages produces a few potential fixes
  3. How are you performing logins without using the session? When I visit a page on your site, how does that page know I'm logged in?
  4. Did you write any of this login code yourself? What was suggested is relatively simple: 1) Add a user_type column to your database 2) Upon successful login, after you check their password but before you redirect, set some session variables for their user type 3) Redirect to a different place based on user type.
  5. We will not do your homework for you, and repeated attempts to get us to help you circumvent your own education (which you or your parents are paying an obscene amount of money for) will likely result in a ban. We'd be happy to give you pointers, like Pikachu did, but show us that you've put forth at least a token effort first.
  6. If the original query worked, then the original query didn't have single quotes around your table name.
  7. I didn't know you could stack lookarounds like that. slick. This is the proper solution
  8. You can use preg_match for that: if ( preg_match('/([a-z].*[A-Z])|([A-Z].*[a-z])/', $yourInput ) ) -Dan
  9. $fetchUsers = mysql_query("SELECT * FROM 'users' WHERE tsName LIKE $cTicker%;", $con2); There's no quotes around your LIKE term and your tablename needs to be enclosed in `backticks` not 'single quotes'. Always echo the error and never assume you know what the problem is. It's probably using the right db, your query is malformed.
  10. If anyone, ever, anywhere in the world ever things "I know! I'll trick google!" they will almost instantly fail. Just keep that in mind for the future.
  11. Also note that the file extension is absolutely meaningless. I could name all my files something.poop and just process .poop as php, and everything will work exactly the same. File extensions are a convenience for the user and an instruction for the OS, not something that determines what the file actually IS.
  12. Um...what? What do you mean?
  13. You didn't reply to my message, which shows you exactly why you need to enforce a certain format from the users.
  14. Also, as a consultant, part of your job is to tell a client when they're purposely making their system less secure and less functional. My passwords always contain non alphanum characters. Do you know why? Because that's what you're supposed to do. Making your passwords less secure is a bad idea, and you should at least mention that.
  15. Agreed, debug this on your own. YOU find where "TBA" is coming from, and then figure out why you get TBA instead of what you'd expect. "TBA" shows up everywhere in your code, it's not like you named it properly so the output is "Username unknown" and we could easily find it.
  16. $date = "10-12-11"; //assume this to be the user input What date is that? Is that October 12, 2011? Is it December 10, 2011? Is it December 11, 2010? All three of those dates are valid interpretations of that string. That's your problem: Your user input is ambiguous. You need to attempt to use explode() and mktime() to make a valid timestamp out of these dates, then you can use date() to format it however you like. -Dan
  17. You could also google for this topic, since self-referencing trees in MySQL is covered both by the mysql manual itself and by at least three articles written by the mysql dev team.
  18. Is there a reason you're taking XML (a data storage/transmission format) and turning it into a serialized string (NOT a data storage format)?
  19. $x = "<?php echo $button_cart; ?>" You can't do that, you can't put PHP tags inside a PHP variable. The <?php tag tells the server "this document is to be parsed with the PHP interpreter." If you put it inside a PHP variable you'll just...break it. define("X"); You can't do that either, this line serves absolutely no purpose. <?php if ($product_info['quantity'] <= 0) { echo $button_cart; } else { echo "PRE-ORDER"; } ?> Of course, you'll have to actually define a pre-order button instead of the bare string "pre-order"
  20. The manual says that's what happens when you try to serialize simpleXML objects. Since SimpleXML objects are meant to represent structured data, why not just...save the XML?
  21. If age is working against you, take the proper precautions now to make your code readable. A young guy might not check to see if there's a towel on the rack before he gets in the shower, because he's confident that he can walk down the hall without slipping and falling. I bet you check for a towel (or you will now). Similarly, you should take a little extra care to make sure your braces are explicitly lined up, your variable names all exist in the same format, and your SQL queries are all well formatted. By spending one minute lining up your braces you save ten minutes of debugging.
  22. Please don't bump your thread after only 20 minutes, it's against the rules and makes people (like me) stop reading and refuse to help
  23. When I did phonetic search suggestions I stored my word list along with its metaphone representation, then just did a SELECT word FROM words WHERE LEVENSHTEIN( metaphone, '$mySearchTerm') <= 2; With a properly configured (and fast) database box, it will work pretty well. Especially with very large word sets to compare against.
  24. That's why you send a verification email. Combine filter_var with a single "click to confirm your email address" link and you're done. I've worked at social networks (with 20,000,000 equally stupid users) as well as big SaaS payment processors (with dozens of genius users) and all of them worked the same way: Accept any valid email address, then email them a confirmation. If you're not emailing them a confirmation, all the carefully crafted regex in the world won't stop them from typing dna@gmail.com instead of dan@gmail.com. That's certainly good for you, and I'm not saying email addresses to IPs are very common, but maybe one day someone will fail to sign up for your service because of his email address. I've seen it happen on custom-written solutions, and I just don't understand why filter_var plus a validation link isn't acceptable to people. It's the only way to accept all valid emails and still make sure the email they entered is one that belongs to them.
  25. I agree wholeheartedly with THAT. maniac+dan@gmail.com is the same address as maniac+diff@gmail.com. Same person, same inbox, same address. Doing a duplicate check against that wouldn't be difficult, though I agree it's a bit of an annoying string manipulation question.
×
×
  • 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.