Restart Windows via Remote Desktop

Ever try to restart a machine via remote desktop? I just ran into it for the first time tonight. I generally deal with linux servers and don’t ever RDP into them. Tonight, I needed to reboot a windows server. No “shutdown” exists on the Start menu. Even on the task manager, there’s no shutdown option.

It’s an easy bypass though.

Instead of CTRL+ALT+DEL like usual, use

CTRL+ALT+END

From here, you will be able to shut down or graceful reboot the system.

Posted in Server Administration | Tagged , , | 2 Comments

Intro to CURL with PHP

CURL is a command-line style function to send data via a URL. WikiPedia has a more detailed article on what it is and does.

Preface – your php installation on your server must be CURL-enabled. You can download the CURL package for free. This article assumes your server is ready to go.

While CURL is not an alternative to AJAX, it can be used in similar situations where you need to send data out somewhere without the user having to go there. In it’s most basic operation, you have some data to send out to a script.

We need a a simple function to handle our data, a page to process said data, and a source page where the function is called from.

The call page is simple. Something as simple as:

<?php
print sendCURL($var1, $var2, $var3)
?>

where $var1 -3 are predefined, or even hard-coded strings will suffice for basic testing. This php block sets us up to print the output of our function:


function sendCURL($var1, $var2, $var3, $referrer="") {
  $mycurl = curl_init("http://domain.com/curl_processor_page.php");
  
  $fields = array(
    "var1" => $var1,
    "var2" => $var2,
    "var3" => $var3
  );

  $curlagent = array(
    "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
  );

  curl_setopt($mycurl, CURLOPT_POST, 1);
  curl_setopt($mycurl, CURLOPT_HEADER, 0);
  curl_setopt($mycurl, CURLOPT_NOBODY, 0);
  curl_setopt($mycurl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
  curl_setopt($mycurl, CURLOPT_REFERER, $referer);
  curl_setopt($mycurl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($mycurl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($mycurl, CURLOPT_HTTPHEADER, $curlagent);
  curl_setopt($mycurl, CURLOPT_POSTFIELDS, $fields);

  $response = curl_exec($mycurl);
  curl_close ($mycurl);
  
  return $response;
}

This function is your basic CURL request. Setting the variables into an array to pass, and setting headers and Options within CURL on how to process it. The only real change you will need to make to this function are your variables in the array and your URL that you wish to send it to.

The curl_processor_page.php is no different than any other php page that can handle incoming $_REQUEST parameters. Those var’s need to be set up in the function that the page is looking for, perhaps a username, password, and a realname.

What that script does is entirely up to you. I won’t post an example, because I don’t want anyone to think that you can only do one method with this function set.

You could have the response be ANYTHING that gets returned from the processor page. A remote login, a simple welcome screen, or even creating accounts (how do you think those auto MySpace friend adder bots work?!)

A useful tool when playing with CURL is the LiveHTTP Headers plugin for FireFox. This plugin let’s you see what’s getting sent via HTTP AS it happens. It’s a real-time watchdog and is very useful for debugging CURL requests to see where it’s bombing.

Happy CURLing :)

Posted in Programming | Tagged | 1 Comment

Invision Power vs. vBulletin re-visited

It’s been a year and a half since I first left my impressions on the two systems. My original post received a lot of negative responses from both communities. I was called an IPB fanboy at vBulletin.org, and I was called a vB lover at IPB’s customer forums. I guess you can’t win :shrug:

Things change.

Over the past year, I have migrated all of my forums over to vBulletin. I’m out of the loop on what’s new at IPB, but a quick browse of their forums tells me nothing new or exciting has happened or been released since I stopped running their software. A couple bug fixes and minor .x release changes. vB has since released their 3.6 series, their project tools, and their blog system. Still pretty much the same system, vB has been pretty minor in terms of new things to the main forum package.

Free softwares are kicking ass. PHPBB3 came out a few months ago in completely table-less CSS driven variety. SMF is also becoming more popular for small sites.

I’m still not happy.

I want features and code quality from a merge of 3 or 4 softwares. None offer me everything I want, but all have a part of what I want.
I want vB’s plugins and products with IPB’s support team and phpbb’s template engine. Is it too much to ask? :D

There’s been a couple threads at vB.com over the past week or so about customers complaining about the lack of communication and upcoming releases. A big gripe has been the template engine and the antiquated table mash up. The response from staff has been minimal at best, and the ones that have replied have simply stated “it’s something we’re considering” in not so many words.

Considering?

It drives me nuts.

Back on topic, if vB doesn’t do something soon, I might make the move to phpBB. It sounds completely backwards to do so. Most people go from open source to enterprise…. not vice versa.

My rankings are starting to drop some in the SE’s due to my bloated C2C ratio from the forsaken nested tables, and useless inline presentation layer. My average page is roughly 120 KB, before images. 20KB would be easy to accomplish with a better template engine.

Perhaps in a future post, I will compare vB with phpBB3.

I still can’t believe I’m thinking about this…

Posted in Forum Administration | Tagged , , | 7 Comments

Google AdSense to Release new Feature – Manage Ads

Google is releasing a new program shortly that lets you manage your ad units all from within the AdSense portal. It will be rolled out in phases, most likely starting with their top producers and trickling down like most of their new features.

What does this mean for publishers? It let’s you paste one ad code on your page never for you to touch it again. via their portal, you’ll be able to change the colors, borders, etc without changing the code block on your site.

For more information, read Google’s help topic

Posted in Monetization | Tagged , , | Leave a comment

How to View Apache error logs

If you’re new to running your own server, sometimes just finding things is the hardest thing to do. I spent a good 15 min trying to find mine, so here’s some info to help you.

Your system may vary. All my postings are from CentOS 5, running php 5.2.x, mysql 5.0.2x, and apache 2.2.x

You may need root-level access to see some of these as well.

I use pico. Some people like VI, some like VIM, some like NANO. I use pico. It’s just a text viewer.

View apache error_log

pico /usr/local/apache/logs/error_log

Send the text file to your website to make it viewable

cp /usr/local/apache/logs/error_log  /home/SITEPATH/public_html

You can then view it in http://site.com/error_log. Firefox will open it up with out a download prompt.

Posted in Server Administration | Tagged , , | 2 Comments

Avoid the Mail Blackhole

I started running out of space on my /home volume recently, so i started looking around for random files and old crap i could delete to buy myself some more time before hardware upgrades.

The log files were an obvious first stop. I still had a ton of space i needed to find where it was being used. My file system showed only a couple gigs and my database was only a couple more, yet I was approaching on 20GB of used space. Where was the rest of it?

Turns out, it was all spam and bounces from registration emails, etc from my forums.

cPanel sets up the default catch-all to go to the accountname@domain.com. ie, if you named your site mysite01, cPanel defaults itself to forward all un- pop3′ed addresses to this account.

IMAP is the only way to get into it (easily), so i opened up Horde and nearly spit my beverage on my monitor. One account had 145,000 odd emails in there, and 4 others had over 50,000 emails in there. My not so popular domains still had a couple thousand in them from just years of collecting viagra and stock quote spams.

I easily recovered 10% of my /home volume just by deleting spam and bounce emails.

The easy way to fix this is to go into WHM’s Tweak Settings at the top, and change the default on New Accounts to :fail: instead of :blackhole:. Unfortunately, this is NOT retro-active, so you will need to go into each of your accounts sub-cpanels and change the catch-all in there from :blackhole: (or “forward to” if you have the new cPanel template) and set it to :fail: (if you have the new template, select the radio button that says “discard with error at SMTP…”).

Lesson Learned. the Blackhole is a bad thing, and the default forwarder is even worse.

10% is a lot of space, especially when you consider most emails are in the 2-3Kb range.

So, if you’re running out of space, and you’re a novice dedicated server admin like myself, check your mail settings. You might be surprised too.

Posted in Server Administration | Tagged , , , , | Leave a comment

Yahoo Releases YSlow

YSlow is an add-on for the popular FireBug add-on for the popular browser, FireFox. Confused? :D

It has neat tools to help you to improve your site’s load times, and rates you accordingly. I scored an F on my blog. haha

Check it out: YSlow

Posted in Programming | 1 Comment

Getting a Global Array to work in a Function

I recently spent a lot of time debugging this code i was working on for what I thought would be a simple onchange event.

The Issue:
I have sizes and colors, but not all sizes are available in all colors, so onchange of the color select box, i need to load the correct size options select box.

Between a lot of back-end manipulation, I was able to create my front-end JS arrays of colors with the sizes that are available. I ran into the issue that my passed in variable to the function was becoming the array, instead of calling the array.

For example, If I passed in “BLK” for Black, I was getting:


array[0] =>B
array[1] =>L
array[2] =>K
array[N] => undefined

where the Nth options looped through undefined until my for loop for the options of my color box’s length had been reached.

The Solution:
After scratching my head for hours and trying 232132 things, It turns out all I needed to do was to use the eval() function to evaluate my variable first, instead of treating it like a literal string.

Here’s the completed working source:



function popsizes(colorcode) {

var BLK= ["2XL","3XL","4XL","5XL","LG","MD","SM","XL","XS"];
var WH= ["LG","MD"];
// etc, many more color arrays

elem = document.getElementById("selcolor");
sizelist = eval(colorcode);

for (i=0; i<elem .options.length; i++) {
  document.getElementById("selsize").options[i] = new Option(sizelist[i]);
}
}

That script is powered by the onchange event from the form:


<tr>
  <td>
    <select "id="selcolor" name="color" onchange="popsizes(this.options[this.selectedIndex].value);">
      <option value="WH">White</option>
      <option value="BLK">Black</option>
      <option value=""> Many more colors, etc .... </option>
    </select>
  </td>
  <td>
    <select "id="selsize" name="size">
      <option value="">Select Color First</option>
    </select>
  </td>
</tr>

Posted in Programming | Tagged , , | Leave a comment

It’s My Birthday, and I’ll post if I want to :)

It seems like only yesterday that I was sitting in my parents house on a Win3.1 box with 8 MB of ram that cost 5 grand, on AOL v1.0 playing Minesweeper. The reality of it, is that was merely 10 years ago. Computers have changed so much in these past years, and looking back at myself, I too have changed.

While I’d like to think that I’ve become cheaper to own, easier to operate, and can do more things, I think I’d just be kidding myself. At least on the first two.

It’s fun to check your mail on your birthday. Of course, all my friends didn’t send me anything, but every forum I’ve ever registered at did. Half of them, I didn’t even realize I had an account on. I must’ve gotten 30-40 emails from random sites that I don’t even remember registering at.

Perhaps this is a marketing lesson. Send birthday emails out to everyone who hasn’t logged in in over 6 months 4 times a year. Sure, you’ll get the “hey, its not my birthday” responses, but it will remind them that they have an account there, and maybe re-spark an interest that died or slipped the mind.

Anyway, time to party (yeah right, Its 3am on my b-day morning, and i’m working :( ).
27… damn. I’m old :(

-B

Posted in Off-Topic | 3 Comments

The Fall of CPC Advertising, Part Deux: Yahoo buys Right Media

earlier this month, Google announced its purchase of DoubleClick. Today, the news is out that Yahoo has bought Right Media. The fall of CPC advertising is coming soon. :(

Posted in Monetization | 1 Comment