Spam protection
In wp-comments-post.php at the top:
Add to .htaccess:
From time to time I want to transfer a site from one host to another. I am not saying this is the best way, but it works for me. Some FTP/SCP clients allow you to drag and drop from window to window, but I haven't had success with that method. Assuming I have SSH and SCP, heres what I do:
- tar the public_html dir. ex: go to the public_html dir and type tar -cvf website.tar ./
- ssh to the new host and go to the target path
- scp root@<host>:<path to file, incl. filename> ./ ex: scp This email address is being protected from spambots. You need JavaScript enabled to view it. :/home/site/public_html/website.tar ./ (it will prompt for password)
- Untar. ex: tar -xvf website.tar
- Fix group and ownership. Ex: chown -R owner.group ./
- Next, you got to transfer databases.
- For this, I simply export from one side, then import at the other. Fix configs and connection strings if necessary.
For large databases:
- mysqldump databasename -u username -pPassword | gzip >databasename.sql.gz
- from new host, scp root@<host>:<path to file, incl. filename> ./ (will be prompted for password)
- gzip -d databasename.sql.gz
- login to mysql - mysql -u username -p
- use <databasename>;
- source <name of .sql file>;
- test.
I frequently come across issues where my website is not allowed to make a change to a file, or write to a file. The issue basically comes down to file permissions. Normally, the files will have user:user and group:user permissions. Apache will normally be running as something else, in many cases, "nobody".
Enter suPHP. suPHP is a tool for executing PHP scripts with the permissions of their owners. This fixes everything! Well, not quite. Now, if you happened to give a file or folder 777 permissions, you're screwed. But, then again, you shouldn't be doing that anyways. Remember, 755 for directories, and 644 for files!
Just wanted to write this down to remember. Using JavaScript to detect or pass in a form the keywords used on google to enter a site.
- wait 25ms or so after the page loads in order to give the filesystem time to write the cookie. (setTimeout)
- read and parse the _utmz cookie * __utmz tracks where a visitor came from (search engine, search keyword, link)
- set a hidden variable if passing along in a form, or do your magic with the data.