Hot answers tagged

14

I'm glad you know there isn't going to be a bulletproof way to accomplish this. That means your outlook is at least realistic. Since JavaScript is not an option I would say you're left with: Check the user-agent for the word "bot" in it. That will catch most of them. Compile a list of known bots and filter them based on some kind of unique identifier, ...


12

I'd have separate database for separate clients. A client might demand this for security reasons - i.e. only their site has access to their data. It also means that if a client want to move their data then it's going to be much easier to manage. It also means that if there is a problem with one client's database it doesn't affect all of the others. If you ...


12

Sitemaps can be dynamic just like web pages. Just have a PHP script grab those names from the database and make a loop to echo out the XML for each one. Also, make sure you output the proper content type for your XML. That's it. The code below is a basic script for generating a dynamic XML sitemap. Please not this is only an example intended to point you, ...


11

There are inherit risks and rewards to both system. I worked for a financial firm that supported roughly 40 clients (national banks) on 1 database. We then purchased another company that sold similar software and that had gone with 1 database per client. Finally, the company went bankrupt and we did have to export all user data. Here is what the people I ...


10

Try this: On the phpMyAdmin default page (localhost) click on the "Privileges" link Click on the "Add a new User link" Assign the User a login and password Where it says "Database for User" select "None" Leave all checkboxes in global privileges unchecked Press the "Go" button You should see the new user in the User overview. Global privileges should say ...


10

Google Analytics is pretty much the best around, regardless of server platform. Unless there is a specific reason you need to use server-side analytics rather than a client-side Javascript solution, Google Analytics is the way to go.


10

It's difficult to assess which one is going to be faster without additional details on how your shared hosting is configured. An application that uses MySQL will need to make a connection to a MySQL server. This can be done to a remote/local host over TCP or to the local host via a Unix socket. The latter is likely to be slightly faster, since you won't ...


8

Is the string I'm in your question actually copy-n-pasted from the database via adminer/phpmyadmin/mysqlcli/whatever? Or is it retyped? I suspect that what's stored in your database is not I'm at all, but rather something like I’m with a typographer's apostrophe. Like the other comments have said, you can and should fix the problem by consistently using a ...


8

Probably the biggest thing to check if is you have keys on the fields you are querying on. Having the right keys and fields will make your queries considerably faster. You can determine if your keys are being used by running the query with EXPLAIN in front of it, such as EXPLAIN SELECT * FROM table WHERE id = 2; You can add EXPLAIN on queries in the slow ...


7

One commonly used solution is to make your image URLs look something like this: http://www.example.com/path/to/images/1.jpg?v=123456 Here, /path/to/images/1.jpg is the actual URL path of the image, while ?v=123456 is just a dummy query staring tacked onto the end of the URL. The query string can be anything — a version number, a timestamp, a hash ...


6

Without knowing more about your app or seeing some real code it is hard to give any detailed security advice. That being said here are some things that come to mind after reading your post: 1: Keep your config file with the database connect info and salt key outside the public directory and chmod it to 444 or 644. You can access one directory above your ...


6

Google has no knowledge of the actual file structure of your web app and what is accessible to the public. A news site, for example, will have hundreds of articles to view, but might only have one actual script: article.php. Server-side directives might allow pretty canonical URLs like /category/283423-pretty-name to point to /article.php, and this is what ...


6

There are three fairly simple ways: Use Google Analytics, which will process and handle all the data for you, and present you with detailed statistics for visitors and how they got to your site. This is by far the easiest solution. Use Javascript to do the counting. When the page has loaded, generate an AJAX request to your counting script. Robots and ...


6

You seem to have a good understanding of why you should and shouldn't write your own forum software so I'm going to focus on my opinion instead of hashing out facts you already know. Forums are favorite places for spammers to spam. They're right up there with blogs. Even existing forum software have a hard time keeping up with them. If you roll your own ...


6

Wikipedia probably counts as having a "huge website", even if it's still tiny compared to, say, Google. You can find a description of their server architecture here. Basically, their SQL backend consists of a bunch of clusters, each one consisting of a single MySQL master server whose data is replicated to a bunch of read-only slave servers. Also, images ...


5

You could split the file at the end of each group of SQL statements and then import one after the other.


5

I can tell you that I currently use mysqldump to maintain a backup of my database. I do this because my goal is to keep weekly backups so that in the event someone removes their webpage(s), I can recover it from at most a week ago. The good thing about this is that it is a basic text file so I can import it over to any computer with MySQL, load it up, and ...


5

I would consider using a WordPress plugin called "WordPress Database Backup (WP-DB-Backup)" which is also listed on the Wordpress Database backup guide. This plugin can backup the database on a schedule and email it to you(assuming its a small database). You can also just back it up locally. You can exclude comment spam and revisions to make the DB smaller ...


5

LOOPING There are two methods to loop in PHP: for, and; foreach The PHP for Loop The for loop is used when you know in advance how many times the script should run. Syntax for (init counter; test counter; increment counter) { code to be executed; } Parameters: init counter: Initialize the loop counter value test counter: Evaluated for each loop ...


5

You've just identified why phpMyAdmin should be only accessible through a protected backend like cPanel... or other means. If Google indexes it, you will be providing a Google Dork, the term for inept server admin mistakes. Lock down access to it via your .htaccess file with either a login or by limiting the ip addresses that can see the link with a 403 ...


4

Here are more organized queries against the INFORMATION_SCHEMA Sizes By Storage Engine SELECT IFNULL(B.engine,'Total') "Storage Engine", CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", CONCAT(LPAD(REPLACE( FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ', SUBSTR(' KMGTP',pw+1,1),'B') ...


4

I finally found the easy way to get this information directly from Amazon with a couple of clicks. Log into the RDS management dashboard Click on "DB Instances" Select the instance in which you are interested. Use the "Show Monitoring" button A graph called "Freeable Space" appears showing how large the database is. My database is currently 1.5GB. Click ...


4

Yes it is possible. Once you know the Host, Username and Password for your MySQL account, you can just log in to it as you normally would from as many hosts as you want. I once did it with two different hosts. My website was on one host, and from other host I was running some cron jobs that were running queries on the other site. Although depending on ...


4

Actually when using hosting management software like cPanel, it installs MySQL with default and commonly used configurations: MySQL host = 'localhost' MySQL port = '3306' MySQL User = 'cpanelusername_mysqluser' [1] MySQL password = 'password' [2] MySQL database = 'cpanelusername_database' [3] More explanations about the host address: If ...


4

You just add the same user multiple times under different hosts, like so: You can also just create one wildcard host user.


4

Whichever backup solution you go with, realize that backups are worthless if you don't test them. This means, having a restore strategy, and actually simulating a complete recovery. You don't have to kill your production data to do this, but you need to make 100% sure that you can actually recover what you need to using your backups. Also version control ...


4

http://piwik.org/ is a good option if you're looking for self-hosting.


4

I think that http://www.godaddy.com/hosting/web-hosting.aspx?ci=9009#details is a good source for what Godaddy is currently hosting. However, I am fairly certain that they do not allow for URL Rewrite. I know they didn't 2 months ago. Also, GoDaddy just turned on .NET 4.0 and MVC 2 support. It usually takes them 8+ months after release for them to ...


4

If you know that the file contains consistently-formed CSV (there is no standard, so you'll likely want to test extensively before importing over any production tables) you can skip PHP altogether and use MySQL's LOAD DATA INFILE statement after uploading the data to the server. (If you don't have immediate access to the mysql console on the server, this ...



Only top voted, non community-wiki answers of a minimum length are eligible