Developing Dynamic Website with PHP&MySQL - 4 - Registration and Login
This system is a must have for a website nowadays. Without it, you do not have a way to attract people back to your site.
The logic is very simple: you create a database table to store user registration data such as username, password, urserid, email as well as other information as required.
Database table SQL for member:
CREATE TABLE `member` (
`userid` int(10) NOT NULL auto_increment,
`email` varchar(100) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(50) NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
Run this code in phpMyAdmin, you will get a table to store user information. When users are presented with the login box, they type in the username and password, php code will compare the input values with the stored one, if all are matched, then a cookie or session will be created for the member and they become logged in.
The simple php process to log in is following:
1. create a page called: “login_form.php”. It will present
<?php
<form action=’login_process.php’ method=’post’>
<input type=’text’ name=’username’ />
<input type=’text’ name=’password’ />
<input type=’submit’ value=’Log in’ />
</form>
?>
2. create another page called: “login_process.php. It will accept values from the first page and process them.
<?php
$_session_satrt();
if($_POST[’username’] && $_POST[’password’]){
//############################
//here you will create a database connection for making sql query
//############################
$mysql_server=”database_server_url”;
$user_name = “username”;
$password = “password”;
$database=”database_name”;
$db = mysql_connect(”$mysql_server”,”$user_name”,”$password”);
@mysql_select_db($database, $db) or die(”<i>Unable to connect to database</i>”);
//to make database query to see if the two values are match
$sql = “SELECT * FROM member WHERE username=’$_POST[username]‘ AND password=’$_POST[password]‘ “;
$result = mysql_query($sql) or die(mysql_error());
//to count the number of returned records, usually one
$count = mysql_num_rows($result);
if($count > 0){
//login here
//for example, create a session value here
$_SESSION[’user’] = $_POST[’username’];
} else{
//present error message here or redirect the user back to the previous page
}
}
?>
- Next post I will introduce how to upload images as well as other types of files in PHP
Developing Dynamic Website with PHP&MySQL - 3 - Homepage Design
Someone may ask, why do you talk about homepage, why not talk about how to write PHP code. As I said before, the purpose of this series of posts are not entirely for PHP coding. You can find many good tutorials online talking about how to write a specific module such as member registration and login system. My main idea is to present how I get all the ideas together for my website.
So why homepage? That’s because the homepage is the first page your visitors most likely to see when they visit your site. The layout and colour scheme will be used across the entire site. So after you have planned out what modules you would like to have for your site, found a good domain name and a good hosting service, you should decide what you want for homepage.
Usually for a homepage, you will need a logo, navigation bar, main areas of the content and a footer. The design of logo, navigation bar and footer will be used across the site to unify the interface. For the main content area, it depends on the property of the site. If it is a news site, you will put headline. For my site, I put the recent posed articles’ links on the homepage as well as the newly uploaded 3d models and textures. I also put a search box for products as a side bar so users will have a handy location to find my products. For search engine optimization purpose(I will talk about it in details later on), you want to pay some attention to the homepage design. I prefer to put more contents for the search engine to index my page. Google’s spider will come often to index your site if you put new contents on the homepage often. I usually update my site 3 times per week.
1. Logo design:
2. Navigation bar :
3. Side Search Box:
4. New Products Section:
5. Latest Tutorials Update:
6. Footer:
The reason these elements are on the homepage is because they provide information to visitors and tell them what’s new on my site. They will know what is happening the minute open up your site in their browser. And I believe this type of first impression is very important. It tells the visitors that you do care about them.
Just have a look my homepage , you will understand what I was talking about.
-next post I will talk about how to design a member registration and login system.
Developing Dynamic Website with PHP&MySQL - 3 - Web Programming, Web Hosting Service, Domain Name registration
The reason that I chose PHP&MySQL to create my webiste is because they are free and also as powerful as other tools such as .NET.
The server will be Linux server with Apache server software installed. The Linux server is much cheaper than the Windows one and it has many third party tools for you to use, such as: FFMpeg for audio/video conversion directly on your server; ImageMagick for powerful image manipulation.
Next thing is webhosting choice. You have two choices in this case. One is go for a so-called virtual hosting in which you share the same server with other ones. Or you can rent or buy a dedicated server. The first one is much cheaper than the second one. And the first one has less techinical works for you because there are system adminstrators managing it for you 24 hours a day. The later choice will require more techinical attention from you.
For me, as a fresh starter, I chose the first one because the cose is low and I really do not have much time to solve technical issues on my own. I would rather spend time on building the website and promote it and start make money as soon as I could.
Here is a list of webhosting company I have came accross before:
1. IXWebhosting.com:

2. Hostmonster.com:
There are many other hosting companies out there, but these two so far are what my friends and I have used before. I found they have very good service in terms of providing in time technical support as well as the general hosting qualities such as server reliability.
The final thing of this post:domain registration.
You will definitely need a good domain name to start a website. Good names are just like people’s names. If a person has a easy to understand and meaningful name, then people will remember him/her. They also can recall this person more easily. For your site, before you start coding and designing your pages, you need to decide a name for it and found a good domain name.
Good domain names are not that easy to find nowadays because a lot of them have been registered already. Following are my ideas to find a good one:
1. Good names should be short and simple. You want people to remember your site right?
2. Try to use meaningful names not weired ones.
3. Use .com if you can because normally people remember your domain with .com. People do remember .org, .net, and etc., but .com is by far the easiest.
- the next post will discuss my ideas to design the first homepage
Developing Dynamic Website with PHP&MySQL - 2 - Planning
Good plan means half of the works done!
I know what I wanted for my website (http://en.9jcg.com). Following is the notes I made for my site:
1. It is a trading platform for 3d models, textures and reference photos.
2. All products are download-able , therefore the buyers should be able to make payment online.
3. Sellers will upload their CG assets to my site and trade them. Therefore a user profile and product management interface is required.
4. It is also a place people can find good learning materials. That way, people will stick with the website.
5. A backend management system is required in order to update contents frequently.
6. Pepole should be able to leave comments for tutorials to encourage discussions.
From the notes above, I found out what I will need to develop for:
1. Upload and download system with integration of Payment system (in my case: Paypal)
2. Backend content management system for managing onsite content.
3. Help files about how to use the website.
-The next post will discuss how to find the tools to create website
Developing Dynamic Website with PHP&MySQL - 1 - Intro
(Screenshot of 9jcg.com)
Since I am a PHP web developer and passionate on doing my job everyday, it will be silly not to include this category in my personal blog.
My idea for this series of posts is to write about how I developed my 3d model and computer graphic tutorials website (http://www.9jcg.com). It will not be a step by step tutorial but will cover the ideas of putting together this kind of database driven website. Hopefully you will get the full picture of how to get your own website set up like mine.
I will use PHP&MySQL server side technology with LAMP platform (Linux+Apache+MySQL+PHP) to demonstrate the process. As you can see, the methods I showed you by no means the best ways of doing them. They were simply the ways I have done my works. There are always better ways to do these things and I would really like to hear from you for your ideas and methods if you could provide feedbacks.
I will try my best to write one post each day to explain the process, from start to finish. But if my works need too much of my attentions, please be patient for further posts.
-The next post will give you a complete picture of how to plan a Database Driven Website.
Top 10 Free Software Applications as Replacements of Commercial Ones
Anyone wants to use software for free. But commercial applications such as Microsoft Office will cost quite a bit pocket money in order to use it without breaking laws. In order to make your home computer useful, you will need to buy a lot of applications. I am here to introduce you to 10 applications, which will not cost anything, at the same time, your computer will be as powerful if you bought those commercial equivalents.
1. Open Office (Replacement of Microsoft Office):
OpenOffice.org is a multiplatform and multilingual office suite and an open-source project. Compatible with all other major office suites, the product is free to download, use, and distribute. It is currently version: 2.3.1. The version 2.4 will be released in March 2008.
Screenshot:
2. GIMP (Replacement of Adobe Photoshop):
GIMP is an acronym for GNU Image Manipulation Program. It is a freely distributed program for such tasks as photo retouching, image composition and image authoring.
It has many capabilities. It can be used as a simple paint program, an expert quality photo retouching program, an online batch processing system, a mass production image renderer, an image format converter, etc.
GIMP is expandable and extensible. It is designed to be augmented with plug-ins and extensions to do just about anything. The advanced scripting interface allows everything from the simplest task to the most complex image manipulation procedures to be easily scripted.
GIMP is written and developed under X11 on UNIX platforms. But basically the same code also runs on MS Windows and Mac OS X.
Screenshot:
3. LAMP for Web Server: Linux + Apache + MySQL +PHP (Replacement of Windows + IIS + SQL Server + ASP)
Web is now everywhere. If you want to have your own web server, LAMP is definitely the first choice. Not only it is free, it is also more secure and faster than Windows platforms. Best of all, they are all open-source technologies. You got the whole world of developers to help you.
Screenshot:
Here is a pre-configured LAMP installer, very easy and you can pretty much config a web server in 10 minutes.
AppServ 2.5.9
This package includes:
* Apache 2.2.4
* PHP 5.2.3
* MySQL 5.0.45
* phpMyAdmin-2.10.2
4. FTP Client: FileZilla (Replacement: FlashFXP, CuteFTP)
FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of useful features and an intuitive interface.
Among others, the features of FileZilla include the following:
* Easy to use
* Supports FTP, FTP over SSL/TLS (FTPS) and SSH File Transfer Protocol (SFTP)
* Cross-platform. Runs on Windows, Linux, *BSD, OSX and more
* Available in many languages
* Supports resume and transfer of large files >4GB
* Powerful Site Manager and transfer queue
* Drag & drop support
* Configurable Speed limits
* Filename filters
* Network configuration wizard
Scrrenshot:
5. Antivirus Software: Avira AntiVir PersonalEdition Classic
(Replacement: Norton Antivirus, McAfee)
From official website:
“More than 30 million users worldwide trust in the reliable protection of Avira AntiVir. And this is no coincidence at all: Avira has gained several awards.
The product combines first-class detection rates and ease of use with a top performance that protects your computer safely and hardly burdens older PCs. For information on Avira’s professional solutions for business, please visit www.avira.com.”
Best of all, it is FREE!
Screenshot:
Download Avira AntiVir PersonalEdition Classic here
6. Photo Management and Editing: Picasa (Replacement of ACDSee)
Picasa is from Google. You can use it to manage all your photos. It has some common editing tools as well.
Screenshot:
7. Web Authoring Application: Nvu (pronounced N-view) (Replacement of Fontpage and Dreamweaver)
Same as Firefox Browser, this app is also from our wonderful Mozilla Family.
A complete Web Authoring System for Linux desktop users as well as Microsoft Windows and Macintosh users to rival programs like FrontPage and Dreamweaver. Nvu (which stands for “new view”) makes managing a web site a snap. Now anyone can create web pages and manage a website with no technical expertise or knowledge of HTML.
Screenshot:
8. File Compressing: 7-Zip (Replacement of WinRAR)
Open source file compression tool.
Screenshot:
9. Software Develop Platform: Eclipse (Replacement of Microsoft Visual Studio/Borland JBuilder)
Eclipse is an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle. A large and vibrant ecosystem of major technology vendors, innovative start-ups, universities, research institutions and individuals extend, complement and support the Eclipse platform.
Screenshot:
10. Text Editor: Notepad++ (Replacement of EditPlus, emEditor)
Notepad++ is a free generic source code editor and Notepad replacement, which supports several programming languages, running under the MS Windows environment.
Screenshot:
Article Ideas From: http://www.williamlong.info/
Who is John Chow and How he made $27,000+ a month from Blogging
I was suspicious about it first time saw John Chow’s website. But when I checked the Alexa status:
http://www.alexa.com/data/details/traffic_details/johnchow.com
I believed him. It’s not easy at all to get such high traffic rank.
Here is my other website’s traffic rank: (http://en.9jcg.com)
http://www.alexa.com/data/details/traffic_details/9jcg.com
It took me 1 year to get what it is now.
I downloaded his book: “Make Money Online with John Chow Dot Com”. I found some very good advices on how to get your site popular. I hope through his book, I will be able to make my site more popular than ever.
Below is the PDF E-Book from John Chow:
New Apple MacBook Air
“MacBook Air is ultrathin, ultraportable, and ultra unlike anything else. But you don’t lose inches and pounds overnight. It’s the result of rethinking conventions. Of multiple wireless innovations. And of breakthrough design. With MacBook Air, mobile computing suddenly has a new standard.”
-Introduction from Apple website
So finally the biggest inventor in PC - Apple, created a laptop which is finally can be called a “lap”-”top” because it is light and thin enough.
Good news for buyers, BUT Bad news for laptop makers. Buyers will have a brand new option to choose from. (although the pocket will hurt.) Bad news for laptop makers because they need to do a pretty big catch up. Buyers will start looking for laptops with the new standard - Light weight, thin as well as powerful laptops. Bye bye to those bulky so called “laptops”. If you are not thin and light weight and powerful enough, you are out.
Do we really need it?
It depends.
If you are looking for a laptop to carry around wherever you like, this will be the choice.
Why Showing the Venues for 2008 Beijing Olympic Game
Although I am not a sports fan, but as a Chinese, I am very excited about the 2008 Game in Bejing. It was the first time China holds this international game and it is certainly a biggest event for 2008.
The purpose of posting all the competition venues on this blog is to show you what the venue looks like for which sports. I am also working on Google Map API and trying to get each location a mark on the map. So if you are going to Beijing, you will be able to know roughly where the venue is.
Anyway, I am doign this to show my support to the game and the people who are working very hard on it!
Stay tuned…
Qinhuangdao Olympic Sports Center Stadium
Venue: Qinhuangdao Olympic Sports Center Stadium
Location: Qinhuangdao, Hebei Province
Competition: Football Preliminary
Category: New Competition Venue (construction completed)
Qinhuangdao
Located in Hebei Province of northern China, Qinhuangdao is a beautiful coastal city known for its nice and ice-free port, the Great Wall at Shanhaiguan Pass and the summer resort in Beidaihe. With a population of 2.7 million, Qinhuangdao lies between mountains and the sea, and enjoys a pleasant climate without cold winters or hot summers. The yearly temperatures average at 10.5 degrees Celsius.
Qinhuangdao Olympic Sports Center
The Qinhuangdao Olympic Sports Center Stadium will serve as one of the Football venues during the 2008 Beijing Olympic Games. The stadium lies inside the Qinhuangdao Olympic Sports Center on the Hebei Avenue.
The construction was started in May 2002 and completed on July 30, 2004. Covering 168,000 square meters, the Olympic-standard stadium has a seating capacity of 33,572, 0.2% of which is reserved for the disabled persons.
« Previous Page — Next Page »

















