Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. That's a good example, thanks I'm too lazy to write one .. Here's how I view sessions - As long as you call session_start(), then everything you put in $_SESSION will still be there next time your script runs. This won't be true if the user deliberately clears the session on his end, or if they wait too long and the session is garbage collected by php, but that's the general idea of how they work. You just treat $_SESSION as a spot to store things that you want to persist.
  2. I would start by echoing your queries, just to check they are what you expect. If they look ok, then display each of the result sets from each query like this: echo "<pre>"; var_dump($res); echo "</pre>"; That will format it nicely in html
  3. I'm no mysql expert, but should it be `o`.`oID` rather than `o.oID`? And same for the other columns.
  4. I'm not sure you can join like that. Putting values in a "string array" makes things difficult in SQL, as SQL is just not designed like that. Take a look at SQL anti-patterns, the section about "Storing multivalued attributes in strings" As for how to deal with it, you can either alter your database structure as explained in that document above, or you can do the join in php (which means as you had it before). Your specific error though is that the column oID does not exist in the "o" table (which is house_owned).
  5. Try making some simple scripts with sessions first, to get an idea of how they work. Going straight into a bigger task like this gives you more mistakes to make, making it harder to learn. Eg, start with a script which remembers the contents of a single text field and puts them back in every time. Then use the same principle for the larger script.
  6. Can you modify your code to do this: $upgrades_sql = "SELECT upNAME,upPRICE,upWILL,upCATEGORY,upPTYPE FROM `house_upgrades` WHERE `upID` NOT IN(".$errno_upID.") AND `upTYPE` = 1"; echo "== $upgrades_sql<br>"; $fetch_upgrades = mysql_query($upgrades_sql) or die(mysql_error()); The idea is just to show the query you are running. If it's not clear how to fix the problem after seeing the query, post the output here for us to look at. You can do the same for the other queries too.
  7. What should the output be? And is the last post set for the final row of data from the first query?
  8. Is it generally better to use GROUP BY in mysql unless you really want to use DISTINCT? That's the rule for postgres. Because DISTINCT always sorts the rows, but GROUP BY can use a hash table (which is not part of the SQL spec, it's just the implementation).
  9. As I understand, you should only get multiple ql_id there if you also have multiple emails for each ql_id. Is that the case? You can also use GROUP BY as an alternative for DISTINCT.
  10. Let me repost that before I look at it: SELECT DISTINCT `m`.`ql_id`,`r`.`email` FROM `ql_master`.`ql_main` AS `m`, `cpcoaching`.`reminder_emails` AS `r`, `ql_master`.`ql_personal_data` AS `p`, `ql_master`.`[color=red]ql_reo[/color]` AS `reo` WHERE `r`.`client_id` = `m`.`ql_id` AND `r`.`client_id` = `p`.`ql_id` AND `reo`.`ql_id` = `m`.`ql_id` AND `reo`.`reo` = '1' AND `m`.`site_access` = '1' ORDER BY `r`.`client_id` ASC
  11. If you use strtotime() I think you could do it. Eg $timestamp = strtotime("2009-01-01 +1 week");
  12. PHP structures are not hugely memory efficient. You can use memory_get_usage() to measure the usage at various points and see how it grows during the parsing. When I'm dealing with enourmous data sets, I often pack things into strings. I regularly get savings of 80-90% of memory used when packing an array of associative arrays into an array of strings (each string can be reconstituted into an associative array when required).
  13. You shouldn't use an auto_increment id for question numbers if you want to rearrange them. Instead you can add another column for question id (in addition to the auto increment column). The purpose of auto_increment columns are for when you want a unique identifier for each item, and you don't care what that identifier is.
  14. What about strings greater than 32 bytes? Does only the first block decrypt correctly, and all subsequent blocks are garbage?
  15. Oops, what I meant to say was: mysql_fetch_array() will give you the column names. That'll teach me to preview before posting Anyway, just replace mysql_fetch_row() with mysql_fetch_array() and you'll be set.
  16. The list of php.ini directives explains which are in minutes, seconds, etc. Click on the directive to get an explanation of how it works. If you want to clear out old sessions earlier, you can reduce gc_maxlifetime. That affects how long php waits before clearing those files on the server. And yes, session data is stored on the server. But the session cookie which identifies the client is stored on the client.
  17. Well that's odd.. how does it work if they encrypt differently? Is it due to different padding methods?
  18. But not why it causes the problem. If you establish why (by moving the ob_start() around), you can fix it. In theory, ob_start() should fix the problem if done early enough. Since it's being called but isn't fixing the problem, it must not be run early enough.
  19. That's because they're conspiring with the NSA, so they can use their AES backdoor to spy on you! Back to the topic, can you show the rest of your code? CBC needs you to chain decryption of each block in sequence, otherwise only the first block will come out right. Edit: Here's a graphical representation of CBC
  20. Like this: print_r ($fname); print ' ';print_r($lname); print ','; By using the "." on $fname, you're actually converting it from an array into the string "Array". PHP's auto conversion can be nice, but sometimes it's a real pain. Regarding your initial problem, you should use an array. If you're not sure how to, it's time to learn They make life so much easier. Basically the array allows you to store all the data in a form where you can access any item of any row easily. Then you can have as many while loops as you want, all going over the same array. If you have very large data sets an array may not be appropriate though, if there's enough that you'll run out of memory.
  21. Congratulations It's always nice when a program finally works.
  22. It looks like login.php includes header.php which immediately includes config.php, which calls ob_start() after including paths.php. That leaves 2 options 1. Either login.php or config.php or header.php has a blank line at the top, or some kind of hidden character before the php tag 2. paths.php does produce output Try moving the ob_start() above the include of paths.php. If that doesn't work, move it to the top of login.php. If THAT doesn't work, then something is at the top of login.php.
  23. There's no ideal solution. Most sites which seriously need to block abusers use IP address (like dnsstuff, rapidshare), BUT they also provide an option to create an account which lets them bypass the IP address blocking. Some of those require you to pay for an account, which simplifies things somewhat. If the accounts are free, you need to be more careful about automated account generation. dnsstuff has free accounts but having an account doesn't bypass IP blocking. Rapidshare does bypass, but accounts are paid. Wikipedia allows accounts to bypass IP blocking, but they also have moderators who can block accounts.
×
×
  • 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.