preload
Dec 25

Before you install Wordpress, you’ll definitely want to see all the options on the table. You can either go on http://wordpress.com/ and sign up a blog for free over there or you can download the latest version and install it on a server/webhosting. Since this is a tutorial in how-to, you’ll definitely want to download Wordpress and have your own blog on your own domain.

Requirements

  • PHP 4.3 or greater
  • MySQL 4.1.2 or greater
  • Mod Rewrite enabled on a LAMP/WAMP Server
  • FTP enabled server (prompt host/username/password)
  • MySQL database (prompt host/database name/username/password)
  • Dedication to update!

After confirming the requirements, go ahead and download the latest version of Wordpress at http://wordpress.org.

Once you downloaded the zip/tar onto your desktop, go ahead and extract all the files to the desktop.

This next part you will need an FTP client (http://filezilla-project.org/).

  1. Open the FTP Client
  2. On the top bar (quick connect), fill out the host, username, and password
  3. Go to the directory you want wordpress (for mine its the HTTP root NOT the main root)
  4. On your desktop open the wordpress folder and select all the files then drag it into the server windows on the FileZilla (or your own FTP client). The reason you don’t drag the Wordpress folder itself because then the url would be http://yourdomain.com/wordpress instead of http://yourdomain.com
  5. Once all the files have been uploaded, close everything out, open your browser and go to the URL you uploaded wordpress to.

If you have your database information ready, go ahead and click create configuration. Fill out all the database information in its respected spots.

Once you submitted the information and the database has been confirmed, copy down the password it generates (I just copy paste it because you can change it right after). After that click login.

Username: admin
Password: (CTRL + V) if you copied the text.

Once you login, on the top a yellow bar with red text prompts you to change your password. Click yes then change the password (scroll down) to whatever you want.

  • Share/Bookmark
Tagged with:
Nov 16

1) Tracking – In addition with cookies, IP addresses can be useful for tracking individual computers or networks. Take example one of the worlds greatest tracking analysis websites—Google Analytics (aka Urchin). Using IP Based information, Google can track, look up past visits, know what pages you visited, and what pages you came from (using http refer). IPs can give the anonymous visitor a name and collect data on that name.

2) User Interactivity – Display a user online script or even develop an online chatting program based on IP availability. With Session Handling, you could  have people interact with each other by classifying IPs and logged in users that match those IP Addresses. Majority of online games are based using IPs. Though Session Handling could also provide user interactivity alone..

3) Ban Hammer – The three most effective way of banning someone off your website is Email, Username, and IP Address. Email and username are only available if users have the option to register their name. IP Addresses can be recorded without the user knowing. The only backdraw to this is if you ban an IP thats networking 10 computers, all 10 computers will be banned.  That is the only downside when using IP as a ban hammer (though used commonly across the web).

4) Exceptions – Want to make a private viewing site specific towards a network? IP Exception (along with Cookies) are excellent. Give people cookies, record their IP Address, show them a sneak peak of what you’re working on. Great for showing a specific client how much work has been completed (if your a web developer) or if your just showing a small crowd of people a video and not want to program a login script.

  • Share/Bookmark
Tagged with:
Nov 02

Ever wanted to download followers from somebody’s Twitter account in a basic list format? I recently made one that does just that. Its pretty easy to use too (has some jQuery to have a better interface).

Download Twitter Follower PHP Script

Note: This is just a quick version of the script, not really tested in secure environments or anything. Expect the script to break if you don’t type in a real screen name, watch your API call limits, or if you don’t have a valid authentication login.

Instructions

  1. Download, Extract, Upload to Web Server
  2. Edit get.php (username and password)
  3. http://path.to/script
  4. Type in a valid screen name and you’re good to go

There are limitations to this such as the Twitter API calling limit. You can only follow so many people before the script breaks unless your IP or account is whitelisted. You might think..well okay the API call limit per hour is 150, that means I can search 150 screen names in 1 hour, that’s not bad at all. WRONG. The program can only grab 100 followers per call, so say I wanted to grab an account with 1000 followers, it will take 10 API calls to grab all 1000 followers. If you wanted to grab 10 accounts with 1000 followers…well you can do the math. 15 Accounts per hour with that situation is inefficient. Getting an account whitelisted can help ya overcome that limit.

For a more professional version of this script with more features, contact me and I will give you a quote. It’s good having such a feature on your site, it’ll help you market your business or website better with millions of twitter accounts recorded on your database.

  • Share/Bookmark
Tagged with:
Sep 08

How does a web developer have any use of Twitter? Well one you have the potential of finding people with similar coding styles, two you could gain knowledge on a daily basis by following thousands of people, or three you could market yourself to either obtain a job or find business for your freelance/independent work. Knowing how to use the Twitter API also helps in increasing your work. Take a look at (It’s Always Sunny in Philadelphia)’s website owned by FX.

http://www.fxnetworks.com/shows/originals/sunny/

They completely dominated their site with Twitter. Is it a good thing? Of course it is! Think about it, user feed back increases which means more people are going back to their site for videos, pictures, and exclusive content. Because Twitter is real-time they took the advantage of the example of a real-time stock ticker and transformed it into a real-time Twitter ticker. One of many ways to make Twitter unique.

To the point…Twitter is a business companion and also an advantage for web developers. Knowing how to utilize the Twitter API and also knowing the business advantages of using Twitter for marketing purposes is a enormous plus for your resume and a great way to attract clients (for you web freelancers out there). But remember, if your going into marketing, you need to know all the aspects of social media to really be “hip” in today’s trends. Customers want to relate to something, don’t be Twitter only because there’s a large statistic somewhere stating X amount of people have no idea what the hell Twitter is. Just take advantage of Twitter in most of its many corners.

Future

Everyone that’s computer savvy knows about Twitter now so what does that mean 5, 10, or 15 years down the road. Will there be a company that will buy out Twitter or will Twitter be the centralization of all real-time social data? My blog (http://mattloinfo.com/) already is using Twitter to bridge real-time contacting to my phone. CNN is using the Twitter to communicate with its viewers and at the same time informing the public. Iran recently used Twitter to voice their opinion in a dictatorship nation. So what’s the future of Twitter? In my perspective, its going to turn into what we saw happen with the .com and internet shopping. Stock up on ideas and names because down the road, everyone will know Twitter and it will be a custom to life. Facebook is already the best site to communicate between friends and family. Because Twitter is more public, it will lag in its popularity due to the factor of openness and lack of “pretty features.” Applications already tie Twitpick, Twitter, and other applications but it’s still easier using Facebook. So how will Twitter progress to the younger non tech savvy crowd? Time. Celebrities, news, weather, and friends will make Twitter be a foundation Web 3.0 and a reality for all communicative devices. So again, if you have ideas in how to use this flexible way of communicating, be curious and look into your ideas. One day some team will become millionaires because they invented a method of using Twitter with a non price related variable to attract customers in a positive way that can be dependable. It’s like the lotto for web developers. Gear up with your knowledge of PHP and start inventing already. Tell me your thoughts on Twitter @matt_lo.

P.S. the @ (at) sign is already mainstreaming into the web as a form of meaning (Twitter contact). When we see example@yahoo.com we know its an email, eventually @example would mean its a Twitter account.

  • Share/Bookmark
Tagged with:
Aug 19

For a while I’ve been using PHP’s extension cURL and SimpleXML to obtain API XML info from sites like Twitter and Bizzare Creations. Since the format for RSS feeds and XML are the same, I don’t see why I can’t use the same method so I’ve decided to try it out.

Normally I would make a class and all but for display purposes I’m going to keep it simple. Remember, you need to have cURL and SimpleXML extension enabled in your php.ini

$rss_feed = "http://www.bungie.net/News/NewsRss.ashx"; // halo 3 news eh?
 
$ch = curl_init($rss_feed);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
$data = curl_exec($ch); // put data from rss url into variable
curl_close($ch);

All thats happening on top is simply going to the URL provided and getting the rss feed source code (aka the info).

// handle the xml data parsing
$xml = new SimpleXmlElement($data, LIBXML_NOCDATA);
 
// Do some testing with the data using print_r();
// We gotta see what info we need
 
 
print_r($xml);
 
// it'll show all the data from the RSS feed but we
// only need the news so lets shrink our test
 
print_r($xml->channel);
 
// item is an array so we can put a loop to process it
// NOTE: channel and item are the variables used in the source feed
// Other RSS Feeds may not have all this, though it should be standard
foreach($xml->channel->item) {
 
$item->description; // will show each description for each item
// other options that can be included (by doing tests,
// you can find out what options are available)
// title, link, pubDate, guid, description
 
$item->link; // would give you the url to the news article
$item->title; // title of the article, obviously
 
// AGAIN: variables names may be different, use print_r($xml)
// to initially find out your variables
}

Thats it! The Step Process is as simple as 1, 2, and 3.
1) Get info via cURL
2) Parse info via SimpleXML
3) Select what you need by viewing the whole variable, and pick vars out

When the loop was occurring, you notice that I didn’t start the url using $xml. That’s because the [ITEM] tag was already converted into a SimpleXML format (all the variables were) so using $item->description is definitely valid. $xml->channel->item[0]->description will get the same result if you want to see a different perspective in whats going on.

If you want to play around with the data, instead of echoing the variables, just have other variables equal them for organization.

Full working source below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$ch = curl_init('http://www.bungie.net/News/NewsRss.ashx');
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
 
$data = curl_exec($ch);
curl_close($ch);
 
$xml = new SimpleXmlElement($data, LIBXML_NOCDATA);
 
foreach($xml->channel->item as $item) {
	foreach($item as $key=>$details) {
		// XML is all the way down to
		// the core array, no need
		// to do $xml->... or 
		// $item->...
		// the loop did the work for us
		echo '<strong>'.ucwords($key).
		':</strong> '.$details.'<br />';
	}
	echo '<br /><br />';
}
?>
  • Share/Bookmark
Tagged with:
Aug 05

Micro-blogging is now one of the most popular things to do on the phone, personal computer, and now on Xbox gaming console. With only a 140 characters to type, its plenty of room to type an “update status” but not enough to type an essay, which means this makes twitter an easy read. But is that all twitter can really do? Why is Twitter so important if it’s only about updating a person’s status? Facebook has videos, photos, applications, and the status feature…why Twitter?

As Twitter is becoming a custom to society, so is there API. TweetDeck, Tweetie, and DestroyTwitter are all applications and make “tweeting” a more pleasurable experience. Quickly go on a phone and send out a tweet or hop on the laptop to send out a quick status update on DestoryTwitter, without going directly to twitter.com. This is all so popular because of the convenience of twitter. Sure Facebook has an iPhone application, a mobile version of their website, and an extensive API but the interface just has so many options. Any person going on any of these extensions, will be spending about a minute looking at stuff and writing a status update. Twitter is simple, type, press post and it’s there. Read a tweet here and there; catch up on the people following… Twitter is not ever going to bring down Facebook because that website is mainly to connect a whole lives to the world verses Twitter is to connect real-time situations to the world. The nature of Twitter is “NOW”, the nature of Facebook is “What’s Up?”

The popularity of Twitter is so great, more and more developers are clinging to their API to connect it with their own business. A company might purposely leak some of their new product info so they use Twitter to fulfill that motive. An airline company might want to attract first time customers by offering extremely low “instant” tickets to help bridge a long term relationship with the customer. These are ideas that people are using on Twitter. For me though, I’m taking Twitter for a ride like no other.

Over the past 3 months, I have been conjuring ideas in how a massively used system can be used to communicate with other aspects of the Internet, like websites, video games, and news. Thinking to myself, all these are easily accessible at the comfort at my own home, why would I go through the trouble of doing such a thing? The answer is simply mobility. We’re in the world of “NOW”, impatient and thirsty of knowledge in the shortest amount of time. That’s how America is today. Kids all have mobile phones to communicate instead of calling from their home, a 15 minute delay on an airplane causes a mass crowd of “sighing”, and computers tend to be unnecessarily reset if it takes longer than 25 seconds to watch a YouTube video. These setbacks in life are not major, but they do become annoying when we should be in a life of demand with all this technology around us. It’s time to really take advantage of mobility applications and take it to it’s full extent. I plan on making several projects linking the aspect of mobility, to all corners of the web (without Safari).

Using Apache’s Cron Job and the concept of garbage collecting, I can create a website that obtains data and returns a result based on that data. For example using a browserless phone, I want to find out the weather tomorrow morning without going on weather.com because I’m on the train; I type in –FindWeather Tomorrow, within a minute I can receive a reply in how the weather will be the next day. Just enough time in between to check my tweets, text messages, and mail on my phone. Another concept is seeing who’s online in Facebook without going on Facebook. Like I stated before, going on Facebook directly will usually direct your full attention to there even if there’s nobody online. If I don’t want to waste my time loading for Facebook, I can just tweet my way in there to see who is online so if no one is online I won’t have to go onto Facebook. The situation there might seem trivial but its reality to most. If we can check up things without going through a “process”, the hassle of touching/clicking, or the interuption of “friend media”, gathering information from different corners all at the same time can be optimized. This is why I’m trying out this idea, to use Twitter to gather info all in a “any-format” display. These are just some of the ideas I’ll be testing in the upcoming months. I’ll keep a widget on my blog to show the progress of my new ideas.

  • Share/Bookmark
Tagged with:
Jul 28

A large portion of people who want websites for their business, home recreation, or for their soccer team don’t want to consume time putting up a website because they have lives of their own. So they download Wordpress, Joolma, Drupal, or Oxite and upload it to their server and bing bang boom instant website (a common relation to ramen noodles). Its fast, its easy, and requires no effort (or knowledge) whats so ever. But is that the true way to start a website?

It depends.
Initiative and purpose are the two main factors for  initial website development.

I have a blog with simple to complex features but I need a content posting system that is only meant to be viewed for paid customers that have paid for previous products from my e-commerce site. Wordpress vs Custom Site.

My ecommerse site needs to be linked with my credit card processing company but I also need information from my private server to be pulled to the clients. Magento vs Custom Site.

I need a customize management site but I also need my site to have capabilities of processing surveys and quizes. Drupal vs Custom Site.

Sometimes people take the easy and painless route because its the best option that fits their needs but others take the “bottom up” route so all the credentials are met properly. When first starting a website, don’t immediately think “okay I need to make this file, and find that file…” when the resource is already out there for you to use. But also don’t beat around the bush and trying to make a half ass job by finding “plugins” that require to do a very specific job like pulling info off a private server every 10 minutes.

Of course most of these open source systems, ready-out-of-the-box applications are very versatile to people’s needs, sometimes it’s easier creating a custom site because there’s no learning curve (like Drupal has) and the sky is the limit.

Part 2 will be the process in starting up a custom made website .

  • Share/Bookmark
Tagged with:
Jul 11

In PHP, $_GET is commonly used to retrieve values passed through the URL. The purpose is simply to pass variables when other means are not the option. For example, some sites use the $_GET method to output specific pages. We’re going to take a look in how Google uses $_GET in it’s search engine.

http://www.google.com/#hl=en&q=example&aq=f&oq=&aqi=g10&fp=Xmf0jJ9P_V0

I’m going to bring down part of this URL since I have no clue (or intention) what the other stuff is. Initially the get method works by having a variable equaling to the value you want it. Starts off with a question mark, then variables equals value, and if there is more than one value to declare an ampersand is put at the end of each value. Now this sample URL from Google.com is telling that the language is in English, the search query is example, and fp=XmF0jJ9P_V0 (what ever that means). I know that en means English because of general knowledge I have in setting language types. This is used so if somebody in U.S. is looking at Google in a Korean language (hl=kr), Google will know that somebody in the U.S. (based on IP address) is viewing the page in Korean. Q means query and it always equals to what the user wants to search. Try it out by going to google.com and typing out different search queries in the URL and notice the results change to what you typed in q.

Now that you know sorta how it’s set up in the URL, lets see how we can use that data in the URL.

$language = $_GET['hl'];
$search_query = $_GET['q'];

Simple as that! If you wanted to have a site where people viewed people’s profile by ID, you could utilize the $_GET method and do…

// if url = example.com/profile.php?id=5
 
// select from MySql Database
$q = mysql_query("SELECT * FROM `profiles`
WHERE `userId` = '".$_GET['id']."' LIMIT 0,1");
 
// check if id exists
if(mysql_num_rows($q) == 1) {
     // profile output
} else {
     // big fail 404
}

STOP

If it didn’t catch your attention, it is very possible to hack the entire site you own with that simple statement (MySql Injection). How? Since we can control the ID variable directly from the URL…

profile.php?id='; DELETE FROM `profiles` WHERE `id` > '

which then goes into…

 $q = mysql_query("SELECT * FROM `profiles`
 WHERE `userId` = '';
 DELETE FROM `profiles`
 WHERE `id` > '0' LIMIT 0,1");

Looks like an intruder just messed up your site. Fail. Ways to make sure stuff like this doesn’t happen is quite simple.

$q = mysql_query("SELECT * FROM `profiles` 
WHERE `userId` = '".clean($_GET['id'])."' LIMIT 0,1");

The clean(); function would return with an altered string going through html_entites, some str_replaces, and other methods to make sure everything is processed correctly (especially no quotes, double or single). You could also declare a variable equaling to the $_GET with the clean parenthesis around it (A future post is going to be on clean();).

Happy Coding!

  • Share/Bookmark
Tagged with:
Jul 09

It has been a while since I typed something up, I’ve been really busy with work and such (more busy than when I was in school…) so I’ve decided today that I’ll talk about functions and a small concept about them.

For the past 10 months I have been so object-oriented that I’ve forgot my old methods of using functions normally. $foo->bar(); vs foobar();Obviously a class is much more sophisticated and organized ever since I’ve started OOP, I’ve just inherit other classes that use the function I need or have a class full of miscellaneous functions. That is truly unnecessary…

None the less, back to the basics!

function foo() {
     // code goes here...
 
     // example....
     echo 'bar';
}
 
// process function
foo(); // prints out "bar"

Once you initiate the function, any coding within the function will start, like a one way switch. One of the many purposes of a function is simply to perform a particular task over and over without complication in the location it needs to be repeated.

Remember you could also pass variables and use the return statement to further utilize the functions. For a more detailed definition of a function (and more ways in how to use it) go to http://www.w3schools.com/PHP/php_functions.asp

  • Share/Bookmark
Tagged with:
Jun 08

This is pretty simple and its really easy to use. If your designing forms and want to process the php script on a different page separate from the HTML one, the header() function can make that happen.

<?php
$url = "http://google.com/"; // url
header("location: ".$url); // in the header, typing in "location: " as string
exit(); // make sure no other code is executed after redirection
?>

Pretty simple, header is used for many different situations such as designating the type of file the viewer is suppose to be viewing. For example if the header content type is set to a ZIP file, the browser will immediately download the file. More examples at http://us3.php.net/manual/en/function.header.php

  • Share/Bookmark
Tagged with: