Archive for September 28th, 2009

Send email with file attach­ments using PHP

September 28th, 2009
	function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
	    $file = $path.$filename;
	    $file_size = filesize($file);
	    $handle = fopen($file, "r");
	    $content = fread($handle, $file_size);
	    fclose($handle);
	    $content = chunk_split(base64_encode($content));
	    $uid = md5(uniqid(time()));
	    $name = basename($file);
	    $header = "From: ".$from_name." <".$from_mail.">\r\n";
	    $header .= "Reply-To: ".$replyto."\r\n";
	    $header .= "MIME-Version: 1.0\r\n";
	    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
	    $header .= "This is a multi-part message in MIME format.\r\n";
	    $header .= "--".$uid."\r\n";
	    $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
	    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
	    $header .= $message."\r\n\r\n";
	    $header .= "--".$uid."\r\n";
	    $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
	    $header .= "Content-Transfer-Encoding: base64\r\n";
	    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
	    $header .= $content."\r\n\r\n";
	    $header .= "--".$uid."--";
	  	mail($mailto, $subject, "", $header);
	}

Funny Apple store video, I fell in love at the Apple Store

September 28th, 2009

The real prob­lem with MLM and net­work marketing

September 28th, 2009

It always sur­prises me the diverse opin­ions of MLM and net­work mar­ket­ing. Some are very involved with it and treat it very seri­ously; it has even attracted celebri­ties authors like Robert Kiyosaki and Robert Allen who pro­mote it. How­ever, there is still a major­ity of the pop­u­la­tion that would con­sider you to be a char­la­tan ped­al­ing snake oil after know­ing that you are involved with MLM or net­work marketing.

Why is there a prob­lem with MLM and Net­work Marketing?

Is it that the struc­ture takes the form of a pyra­mid? That is just a tiered incen­tives and a lot of large com­pa­nies use tiered incen­tives for their sales force. The entry sales per­son gets a per­cent­age of what he or she sells and then that per­sons man­ager or boss gets addi­tional incen­tives based on the per­for­mance of the sales peo­ple they are respon­si­ble for. Could it be because there is typ­i­cally a cost of entry to become a mem­ber of an MLM or net­work mar­ket­ing group? The, ‘pay to play’ par­a­digm doesn’t apply to just MLM or net­work mar­ket­ing, it’s the stan­dard fran­chis­ing model that count­less fran­chise busi­nesses use. Do you think that the local instal­la­tion of your favorite burger chain was a gift to the owner by the burger chain’s cor­po­rate office? No, the owner of the burger chain bought into the fran­chise, he or she ‘paid to play’.  MLM and net­work­ing mar­ket­ing are really no dif­fer­ent in that respect.

There are prob­a­bly as many ille­gal net­work mar­ket­ing or MLM scams out there as there are blades of grass; where the money gen­er­ated is from sell­ing other peo­ple the busi­ness oppor­tu­nity, to sell the busi­ness oppor­tu­nity and no real mer­chan­dise or prod­uct is sold. Those sys­tems are no more dif­fer­ent than the famous, “mail a dol­lar to eight peo­ple on the list” scam. There are how­ever, many busi­nesses that have suc­cess­fully estab­lished them­selves as a net­work mar­ket­ing or MLM com­pany and have sold tan­gi­ble prod­ucts to con­sumers (that are just cus­tomers and not resellers of the busi­ness oppor­tu­nity) all over the global; com­pa­nies like Amway, Excel and Meleleuca to name a few. To hold these com­pa­nies with the like­ness of an obvi­ous scam is a bit unrealistic.

Are a cou­ple of well-known pyra­mid schemes enough to ‘poi­son the apple’ and give all net­work mar­keters a bad name?

I think that the real prob­lem with the busi­ness of net­work mar­ket­ing and MLM isn’t the busi­ness itself, after all it is just sim­ply a busi­ness model; the real prob­lem lies with some of the indi­vid­u­als that it attracts. The busi­ness itself is ideal for many rea­sons such as a low start-up costs, low over­head and the poten­tial to make a lot of money.

Unfor­tu­nately, the strengths of net­work mar­ket­ing and MLM are also it’s weak­nesses. Since net­work mar­ket­ing is eas­ily adopted, it can be and is adopted by those who may not nec­es­sar­ily be qual­i­fied to own their own busi­ness (which is what true MLM or net­work mar­ket­ing is, busi­ness own­er­ship). Net­work mar­ket­ing and MLM will inevitably attract (in addi­tion to qual­i­fied indi­vid­u­als) peo­ple who; haven’t done well in their cur­rent busi­ness or pro­fes­sion, have no expe­ri­ence with busi­ness own­er­ship and most impor­tantly have an unre­al­is­tic expec­ta­tion of the work effort involved in rela­tion to the income achieved by the work effort.

There isn’t any­thing  nec­es­sar­ily wrong with those char­ac­ter­is­tics; even some of the most suc­cess­ful net­work mar­keters entered into the indus­try with some of those very same char­ac­ter­is­tics. I’m only say­ing that is describes the lion’s share of net­work mar­keters and that very few of them (if any) do some­thing about it. Many peo­ple in the busi­ness will end up over-selling their oppor­tu­nity, come across as des­per­ate, dis­cuss their oppor­tu­nity in social sit­u­a­tions when it isn’t appro­pri­ate or even worse; know­ingly describe their oppor­tu­nity inac­cu­rately. The lat­ter of which is largely respon­si­ble for the neg­a­tive dis­dain that most peo­ple have when think­ing about MLM and net­work marketing.

How do we fix this?

The solu­tion lies in per­cep­tion. We have to fun­da­men­tally change the way we view net­work mar­ket­ing and MLM by rec­og­niz­ing it for what it is. Net­work mar­ket­ing and MLM are a busi­ness oppor­tu­ni­ties and the prac­ti­tion­ers of are very much, inde­pen­dent busi­ness own­ers. Some fledg­ling mar­keters aren’t pre­pared to be respon­si­ble  for the com­plete suc­cess or fail­ure of an endeavor but that is what busi­ness own­er­ship is all about. By tak­ing net­work mar­ket­ing and MLM more seri­ous and treat­ing it more like a tra­di­tional busi­ness those on the out­side look­ing in will start to adopt the idea of net­work mar­ket­ing and MLM more readily.

The Code­Tree rec­om­mends iCon­tact for mar­ket­ing list management

Cre­ate a zip file from folder con­tents using PHP

September 28th, 2009
class createDirZip extends createZip {

	function get_files_from_folder($directory, $put_into) {

		if ($handle = opendir($directory)) {

			while (false !== ($file = readdir($handle))) {

				if (is_file($directory.$file)) {

					$fileContents = file_get_contents($directory.$file);

					$this->addFile($fileContents, $put_into.$file);

				} 

				elseif ($file != '.' and $file != '..' and is_dir($directory.$file)) {

					$this->addDirectory($put_into.$file.'/');

					$this->get_files_from_folder($directory.$file.'/', $put_into.$file.'/');

				}

			}

		}

		closedir($handle);

	}

}

//USAGE
$createZip = new createDirZip;
$createZip->addDirectory('themes/');
$createZip->get_files_from_folder('blog/wp-content/themes/', 'themes/');

$fileName = 'tmp/archive.zip';
$fd = fopen ($fileName, 'wb');
$out = fwrite ($fd, $createZip->getZippedfile());
fclose ($fd);

$createZip->forceDownload($fileName);
@unlink($fileName);