Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You would need to be a lot more specific about what results you did get. Which query is doing this and what are the actual data values in your table that are being matched (you might want to actually return and display the matching rows before you attempt to do a count on them)? Are you sure the data in your table is what you expect? What code was used to produce and insert the Unix Timestamps in the table? Edit: And in looking at your code more closely, the $enddate is the next day so most of the $enddateX calculations are not right. You should actually be using the $startdate + the time values and only use the $enddate where the time is past midnight.
  2. A column can only have a single value at any time. ^^^ Using AND there won't match anything because the value cannot be both 1 and 3 at the same time. You need to use OR to form a union/set of rows that have the values 1 OR 3.
  3. I've got to ask the same thing. Why are you writing code like that. The following is the equivalent code, written out traditionally (edit: LOL, identical suggestion to what DevilsAdvocate posted above) - <?php if($flm == "73d0" || $flm == "9017" || $flm == "c3a2") { $pass = 1; } else { $pass = 2; } if($pass != 1) { echo '<meta http-equiv="refresh" content="0;url=/drew/">'; } else { echo "hello"; } ?> Yes it takes a few more lines up in the file, but it also doesn't contain any syntax errors and you can see that it does not because you can see each line of code without all the clutter of the <?php ?> tags.
  4. If you have access to the access log, you can look for any large groups of requests, pick the most frequently requested file, and attempt to optimize its cpu usage. You can also look at the access log for anything that is being requested that should not be (perhaps someone is probing your site either to break in or to trigger errors to shut your site down.) There are probably 50 different things that your code could be doing that are wasteful of processing time, such as including a file using a URL instead of a file system path, performing the same query more than once on a page, putting queries inside of loops ...
  5. It's somewhat your web host's responsibility to provide you with as much information that they know about the problem, not just to say your site consumed too many resources. You would need to know which pages where being requested and how frequently they were being requested at the time the over-usages occurred (perhaps your site just got popular enough that you need to move it to a plan that provides more resources.) Someone could also have hijacked part of your site and is using it to host their media files or as a phishing site. Have you checked if your files are the only ones present? For any particular page (hopefully the one(s) that are causing the problem), you can look at ways to reduce the amount of processing. We would only be able to help if you posted actual code for a page. You might need to make use of some caching to prevent processing the same information over and over for each page request.
  6. Form (concatenate) the entire <option> ... </option> list in a variable, then echo the variable any place you want it or if your whole <select> ... </select> menu is the same each time, form the whole <select> ... </select> menu in a variable and echo the variable any place you want it.
  7. You would need to post you form processing code for anyone here to determine which of the dozen or so possible reasons it might be outputting your "no file chosen" message.
  8. They are probably crlf \r\n You can use the mysql ORD() function in a SELECT query to display what value the characters are. What method are you using to import the data, because you should probably validate (or trim()) what is being imported. Edit: Also, you can probably use the mysql TRIM() function or smiler in an UPDATE query to remove the characters once you find what they are (you likely have them on the end of actual data if they are the \r\n from a text file.)
  9. What does your query look like and what is the definition of your column? You are either forcing a case-sensitive comparison in your query (unlikely) or due to the definition of your column (data type is a binary character type, the character set, or the collation.)
  10. Each of your form fields will be available in the php code as a $_POST['field_name_here'] People often make a copy of these in regular program variables (saves a little typing if you are going to reference any of them more than once), such as $pass = $_POST['pass']; So, $pass and $ID that your code is apparently expecting from your form would instead be referenced as $_POST['pass'] and $_POST['ID']
  11. include/require and the _once versions are php statements. The file being included/required is read and parsed/tokenized/interpreted at the time the include/require statement is executed.
  12. You must use () in your AND/OR logic to force the order that they are evaluated - "SELECT * FROM games WHERE game = 'test' AND (playername = '$test' OR opponentname = '$test') ORDER BY playdate DESC LIMIT 25" Also, putting or die(...) on the end of a string assgiment does not make any sense, so I did not bother to include that in the query string.
  13. Are your Username's actually stored using md5(), like you code implies they are?
  14. What have you done to troubleshoot what it is doing? What does echoing both $password and $a_password show?
  15. You would need to post the actual code that demonstrates the problem.
  16. No, you don't. It is your mail server that is sending the email to you. The From: address must be a valid mail box at the sending mail server. You would want to put the visitor's entered email address into the Reply-to: address in the header.
  17. I'm not sure what link you are referring to but your 'EmployeeInfo' table name is enclosed in single-quote, making it a string, instead of a table name.
  18. dolrichfortich, people often only post a very small part of their actual code. You don't know what other applications or code he has on his site. Suggesting anything that is a known security risk would be bad advice.
  19. You likely have some other character, such as a space or a \r or \n as part of the data. You should use trim() on each element of the array via the array_map function.
  20. Register_globals were turned off by default in php4.2 in the year 2002 because they allow hackers to set your program variables and session variables by simply visiting your page and putting get parameters that have the same name as your program/session variables on the end of the URL. Too many sites have been taken over. Unconditionally suggesting to turn on register_globals is bad advice. Register_globals are also scheduled to be completely removed in the next major version of php (when/if it ever gets released.)
  21. You could always try it and see what it does do.
  22. You generally DON'T ever need to get the next id in a table. You insert the actual data and then get the actual id that was just assigned because if you have concurrent visitors causing data to be inserted you cannot guarantee the order in which queries will be executed unless you lock the table.
  23. Someone just posted how you could produce a DATE or DATETIME value in your query from the existing values that would allow you to do this all in one query. Since you have not shown your array structure (all you have shown is three columns of data with their heading) no one has bothered to attempt to show you any code to process that array.
  24. Your query needs a WHERE clause so that it only matches the name that was submitted in $_POST["NameSelect"] - Ref: http://w3schools.com/php/php_mysql_where.asp
  25. Does a phpinfo() statement show that those two settings actually have those values, in case the php.ini that you are changing is not the one that php is using?
×
×
  • 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.