Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. No, SaaS is not dedicated to you, it's a service that you and possibly many other customers are paying to use. Since it's a service your license to it is typically different than the license you get when you buy software. Otherwise, there is no real difference between Cloud and SaaS.
  2. Believe it or not, you can cast all those values to int and you'll get the starting number: $string1 = "3-tech"; echo (int)$string1;
  3. Back in the bad old days, you could turn register_globals on, and if it was on, when a form was posted php would take every form variable (the $_POST['somevar'] and make a variable named $somevar. This became a source of a lot of exploits since people who figured out what a script was doing could use it to inject variables into scripts by manipulating the HTTP header section. This is why the feature is deprecated. It appears this script makes that assumption. The way php makes POSTed form values available is in the $_POST superglobal array. As for the rest of your comments, yes you interpreted my response correctly.
  4. It's good to have a method that gets a single row -- it's just not good to use that method to get every row in a result set, when you already have that result set. That is simply redundant not to mention, terribly inefficient.
  5. Ok, you stuck it in the right place. The problem is that this script appears to assume that the server is using an ancient/deprecated feature known as register_globals. The individual variables from the form are in the $_POST array as they are supposed to be, but nothing in the code every assigns those values to the individual variable names used later in the script. Basically what you really need to do is edit the script so that it does this: $b_first = $_POST['b_first']; You need one of these assignments for every variable that was referenced. Against my better judgement I will provide you this workaround that in essence recreates register_globals for the form data. foreach ($_POST as $key => $value) { if (!isset($$key)) { $$key = $value; } } Theoretically replacing the vardump/die with that block of code will make it work, but you could also just declare each variable, which would be more secure. I'd also recommend using htmlentities on these values to negate the effect of people trying to inject XSS code through your form.
  6. Those are queries that will return a result set. In a php script or phpMyAdmin you wouldn't include the semicolon.
  7. Long thin tables are a mysql specialty. Btree+ indexing guarantees that access to the last entered row will be lightning fast, and readers do not block writers. Compare this to your file based approach and as the file grows in size reading it will become slower and slower. SQLite is light, which is to say that it has no server. This means that every process that does a sqllite connection needs to allocate memory for anything sql lite is going to do. I would not use sql lite, however this does remind me that there are name/value pair db's like berkley db that are extremely fast. So you could supplement this by having a key of "lastline" and just read that and only write to your log file when the value read does not match the 'lastline' key. This is basically the same thing you would do with memcached or apc, but it might be easier for you to use a small berkley db. Mongodb could be a great solution, but you would need to install the mongodb server and that seems like overkilll for this problem.
  8. Yes it looks like an issue with your db class, which is not something you provided. You pass this in, but it is not clear what it is exactly, but in your original routine, you did a query, then went into a fetch loop, and tried inside that fetch loop to do a second query using the same db object. One would clobber the other. It really doesn't make any sense in your code, as to why in your getAlll you would query against the same table for every row, when your outer query has already queried every row. I don't understand why you aren't just doing this in your getAll(). $this->_friends = array(); while($data = $db->fetch_array()) { $this->_friends[$data['id']] = $data; } return $this->_friends;
  9. The commands: show processlist; or show full processlist;
  10. MySQL is optimized for inserts. There aren't too many scenarios where this isn't going to be better done with a database based on your description. You could also look at a nosql db like mongodb.
  11. At the top of the email script, add this code: var_dump($_POST); die(); Report back with the results.
  12. He already stated he's appending messages to the file.
  13. I don't see anything in your code that sets the variables from the $_POST superglobal array. When you state that the "variables are populated by user input fine" what exactly does that mean?
  14. A file is not a database. The most efficient way of doing this is to use fget to read through the file to the last line and compare that each time. There are numerous caching addons available that might allow you to optimize this if it proves to be a major bottleneck. You might want to look into memcached and apc. People use databases because they can efficiently seek to individual rows and have provisions for multi-user access.
  15. There is no reason for you to be doing this in php code. Apache has a module (mod_deflate) that handles gzipping things on the fly. There are probably scores of howtos and docs on this, but here's a decent one: http://www.justinbritten.com/work/2008/12/apache-gzip-configuration/ You do not want to gzip images -- they already have compression in them.
  16. MySQL has an extremely fast and lightweight connection process. Since PHP has "page scope" and a typical php script runs very quickly, there is really no reason to worry about closing mysql connections, as the connection resource will be garbage collected when the script completes.
  17. That is going to be one neat trick, considering that the Mac does not support Access. There is a commercial ODBC driver that advertises "read only" access to access db's. http://www.actualtech.com/product_access.php
  18. What is important is not which is faster, but what are the requirements for menus. Is it a requirement that a user should be able to go into an admin system and add/change/delete menus? If so, then you are better off storing them in a database. You can then cache the results in a variety of ways. Changing the menu would need to invalidate the cache. Even without caching, if your database server had plenty of memory and your database contents could be kept in the database cache, it would always be extremely fast. However, if you rarely change the menu, or the menu will be changed only by developers, then you are better off with a code based menu.
  19. Software as a product - It's a product that you buy. You have to provide the hardware to run it, and install and configure it. Software as a service - You pay for a service that provides you access to the software as if you were using it, but without you having to install, maintain or host the software Cloud Software - In general, "The Cloud" is a service that you access via the internet. It is similar to SaaS in that the hardware it runs on is not owned or maintained by you. You access it via the internet. There's no real distinction between SaaS and "Cloud Software", although often "Cloud" services refer specifically to storage. For example, there are many cloud services that store files and allow you to access them from various devices.
  20. Opening 1 file vs opening 10 files... of course opening 10 files is going to be slower. However in most cases the difference in the amount of time taken is going to be so miniscule it is not worth consideration. Typically people are using multiple files for organizational purposes or the application of DRY. In other words, there is a good reason for keeping things in multiple files rather than sticking them in one big file. PHP also will not load an include file if the include is not reached at run time of the script, so if you have conditional includes, there is no concern in terms of performance. Finally, most people use an opcode cache like APC in production, which is going to cache scripts in shared memory.
  21. Check a phpinfo() and insure that the memory setting matches what you have set. If you have an 800mb file, you're going to need more than 800mb because overhead and any other variables require memory as well. As for 800mb, that is 800 * 1024 * 1024 to get the actual byte number, which is what you see in these errors.
  22. gizmola

    NOW()

    What mysql data type is timestamp?
  23. Your query is invalid. You can't have SELECT * COUNT. Since the id is equivalent to the item_name why are you grouping on item_name and not item_id? Not that it matters, but item_id is going to be keyed and indexed from the look of it. Did you try: SELECT count(*) as amt, item_name FROM ......
  24. You can use the OR flag RewriteCond %{REQUEST_URI} ^/www.mysite.com/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/(.*)/page([0-9]*)$ ##This is the special page
  25. Without your markup, the css is of limited value. I can tell you just glancing at a few of your inline-block styles, that width: 100% isn't going to work.
×
×
  • 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.