Bring IE 6 to your Mac OS X

Author: Ben  |  Category: Tech Support, Web Design

There are still a lot of web applications are still only working under IE6.? In addition to that, for web developers who are using OS X, they need to make their website compatible with IE, and especially IE6.

To solve this problem, a lot of people will choose to install xp or vista on their Mac machines with Parallel, so they can use the IE inside the MS Windows.

That is a solution, but isn’t that too much to do when you only want the IE?

Today, I am going to introduce you the new solution to install IE only to your OS X.

First of all, thank you the developer from www.kronenberg.org/ies4osx

Secondly, to install this you will need to install the X11 from your OS X installation DVD.? Finally, download the ies4osx installation file from the link above, and you will find more information on www.kronenberg.org/ies4osx/

Good luck.

Split your complicate php task into multiple steps in a secure way

Author: Ben  |  Category: Web Design

As the demand for web application is increasing, a lot of web applications are getting more complicated.? So it is time to split the task into multiple tasks, so it will greatly increase the usability.

However, with the security in mind, how can we avoid people using javascript or url injection to avoid skipping steps?

Today, I am going to share my experience with you.

The most simple way to keep track of what step the user is on is to use a hidden field locally, such as:

<input type=’hidden’ name=’current_step’ value=’1′/> <!– the user is on step one–>

However, the above method has a big security issue.? User can use javascript to change the hidden feild to other numbers to skip the current step.

Let’s move the keep tracking variable to the server, and don’t use any local hidden field.

So, we can use a session variable to keep track of the steps:

$_SESSION['step'] = 1;

With the above method, the user cannot change the session variable.? However, there is still a problem.? If the user click the back button to go back to the previous steps, and change the previous validated information, and then continue with the current step.

So, what is the best way to achieve the goal securely?

Let’s try to combine both local and server to keep tracking of the steps.

so let’s create a session variable on the server side, such as $_SESSION['step'], and create a hidden field such as <input type=’hidden’ name=’step’ value=’1′/>

Sample code:

$cur_step = 1;

$post_cur_step = ($_POST['cur_step'] == “”)? 1:(int)$_POST['cur_step'];

/*step logic*/
if(!isset($_SESSION['step']) || $post_cur_step < 1) $cur_step = $_SESSION['step'] = 1;
else if($post_cur_step >= $_SESSION['step']) $cur_step = $_SESSION['step'];
else if($post_cur_step < $_SESSION['step']) $cur_step = $_SESSION['step'] = $post_cur_step;

Let’s explain the code above.

First we get the step data from the local form from POST variable.

And then we create the session variable ’step’ and set it to 1 or the first step.

1. In case, the user try to modify the hidden field to skip the step, the logic can force the user going back to the current step.

2. In case, the user clicks the back button to go back to the previous steps, then the logic above can detect it, and set the $_SESSION['step'] to the previous step.

Now we fix the skipping step problems, but how can we have some control of the steps on the server side, such as when there is any errors detected during the session, and have to force the user going back to previous steps.? So, how can we control it?

It is actually easy, we can change the $_SESSION['step'] to point to any previous step number, then the logic will force the user going back to the previous step.

This is just one of the many methods, if you find any problems or have a better solution, please post it here, and share with others.

Make your css reusable

Author: Ben  |  Category: Web Design

A lot of New Web Developers usually rewrite all the CSS when they need to redesign or update the current web template, and that is really not efficient at all.? So, how can we minimize the amount of time that have to be spent on the CSS?? The answer is simple.? Make your css reusable. But how?

Now, we start from the basic CSS elements.

.bold{

font-weight: bold;

}

.underline

{

text-decoration: underline;

}

and so on…

So whenever you want to make your text bold or underline you can do

<span class=’bold’>bold this</span> OR <span class=’underline’>underline this</span>

So far, it is still the basic, and nothing is really exciting right?

Ok, let’s make it a little bit complicate by introducing the multiple class names.

Now, suppose you want to make your text bold and underline.

Usually you would do

.bold_and_underline

{

text-decoration: underline;

font-weight: bold;

}

then finally apply it to the html tag like this <span class=’bold_and_underline’>bold, underline</span>.

If you are going to mix and match different css properties to the html element, you will end up with write a lot of css properties, and a lot of them just keep repeating.

By using multiple class name, now you can make your life a little bit easier.

You can do this:

<span class=’bold underline’>bold and underline</span>

If you want to apply more properties to the HTML Tag, you can always mix and match of your basic css properties by using the multiple class names.

And I would recommend you to make your class names more meaningful, so you can remember it when you apply it to your html tags.

However, this is not the end yet, and we can even go further with the classes.

A lot of web template will have a lot of <div> containers with css properties, such as, float: left, margin: 0, padding: 0;

Now, let’s set this up in css.

.container

{

margin: 0;

padding: 0;

float: left;

}

and assume we have two div tags, such as

<div class=’container big_box’></div>

<div class=’container small_box’></div>

And now, let’s see the properties of the big box and small box,

.big_box

{

width: 300px;

height: 400px;

}

.small_box

{

width: 100px;

height: 100px;

}

Now, you can see that it save you from writing the margin, padding, float properties repeatedly.

Without the multiple “class names”, you will have to do this:

.big_box

{

width: 300px;

height: 400px;

margin: 0;

padding: 0;

float: left;

}

.small_box

{

width: 100px;

height: 100px;

margin: 0;

padding: 0;

float: left;

}

Finally, the multiple “class names” is compatible with IE6,7, firefox, opera, another other major browsers, so you can feel safe to use it for your projects.

Good luck.

Tips on input text field initial value

Author: Rockia  |  Category: Web Design

The theories and practical skills nowadays in web designing is quite different from what I started with 10 years ago. Today I am going to talk about sometime that’s surprisingly not being changed much. Let’s look at a picture below:

Familiar, right? Yes, we can still see a lot of this style login form around this infinite triple-w world. I won’t say it’s a bad thing, but since the space on your page is very limited and valuable (unless you don’t have contents to put on. :D ). How about we want to save some space? However we can’t just delete the “username” and “password” label in front or else you will lose your users the other day when you wake up.

So what’s the alternate option? Well, let’s play some CSS and basic mouse action.

We can see an example before we get started. Let’s look at Apple’s MobileMe website.

It’s a good idea that show the users what those text fields are using the text fields themselves. The following code here are showing that if there is nothing input by the user in the text field, it will have a gray initial value, that’s, “Gray Text” in my example. Once the user click in the text field and ready to type in their own value, the “Gray Text” will disappear and replaced by what the user type in. However, if the user suddenly decide to move out before the type in anything and click somewhere else on the website, the text field will be given back the value “Gray Text”.

<html>
<head>
<style type=”text/css”>
.gray_font {color:#666;}
.black_font {color:#000;}
</style>
</head>
<body>
<input type=”text” class=”gray_font” value=”Gray Text” onclick=”if(this.value==’Gray Text’){this.value=”;this.className=’black_font’}” onblur=”if(this.value==”){this.value=’Gray Text’;this.className=’gray_font’}” />
</body>
</html>

What do you think? This is just an simple example. Use your creativity, you can probably use an image as your background.

Photoshop Tutorial — Silk

Author: Rockia  |  Category: Web Design

I am here to share some tips on photoshop today, to be specific, I will share how to make a silk ribbon like shape that is used a lot in website design.

1. Create a blank document. I created a 500 px by 500 px one, but it doesn’t really matter.

2. Use Pen Tool to create two paths. Then you need to create a new layer then use these two paths to have a stroke. Like this:

3. Deselect the path and select the layer where your stroke is. Then choose “Edit” in the tool bar and choose “Define Brush Preset”.

4. Name your brush preset and remember it since we are going to need it soon.

5. Delete the layer you have your stoke on. Create a layer and fill with black. (This is just personal preference. :D )

Click the Brush tool box on the right panel.

Set your brush setting similar to what I did above. (I hope you will get similar outputs. :D ).

Finally, you can use your brush to play around, here is what I get.

If you have any good suggestions, please let me know and I can update this tutorial based on feedbacks.

Photoshop tutorial by Rockia @ SimpleClix.net

The Last Step of Installing Joomla

Author: LeBokov  |  Category: Tech Support, Web Design

Joomla is one of the most popular content management systems (CMS) today. It is fully featured with a lot of plugins and enhancements. Its setup is so easy with just a few clicks. Because of its popularity, its getting quite a bit of attention from hackers. If your Joomla site is getting hacked, fixed, and getting hacked again the next day, then you may have forgotten the last step of installing Joomla.

Htaccess.txt

When you upload the Joomla files to your web server, there should be a htaccess.txt file included in the root directory. If you open up this file in a text editor, you should see that it contains some rewrite rules to block out some common exploits. However, leaving the file as htaccess.txt won’t put it in effect. To put it in effect, you should rename the file to “.htaccess” without the quotes. Note that there is a period at the beginning of the filename. This indicates that the file is a hidden file. You should also make sure that the file is read only.

After you have completed the last step of the Joomla installation, your website should be more secure and less likely to be a target to the hackers.

Reduce HTTP request

Author: Rockia  |  Category: Web Design

I made a review on my coding style today and I found that I made a big mistake.

I always made a folder called “JS” and “CSS” when I first start scatching a website from blank. And I will put all different .js and .css files insides. For example, if I have 3 pages called “aboutus.php”, “main.php” and “jobs.php” in my website, I will put at least 3 different CSS files into the CSS folder; well, they will be mostly called “aboutus.css”, “main.css” and “jobs.css”. For certain of time, I found this very useful, like when I need to change the style of some elemetns under “main.css”, I can just look under the “main.css” and I don’t have to scroll the whole “css.css”.And ALL of these are stored in the files call “top.php” that will be contained in each pages.

However, I found this is a big problem today. IT INCREASE THE TIMES OF HTTP REQUEST!!!

OK, I guess no one will have the “style” in each different elements nowadays when we are going to write out the whole site. Most people, I will say 99.99%, will have the .css files as external links outside of the page. And example will be:

<link rel="stylesheet" href="css/index.css" media="screen"/>

Actually, when the browser loads this website, and it “sees” this line, it will make a request to the server for this “css/index.css” file. Here the first time. Like I said, if I have 3 different files, the browser will actually make 3 request to the server. This might not sound too bad. However, if I have another 3 .js files there. Then for each page, it will at lease send 6 requests to the server for all these external files before the page <body> tag was load; yes, that means, before you see anything on your screen, the server has 7+ requests already. Plus, there will be some more requests for the images and all different other medias (I will talk about those later on.)

Let’s say, if you only have 1 picture and 2 divs in your page, then your browser will make at lease 10 requests, and 6 of them were made before your page was displayed. And I have 3 pages, if the person is interested in my site and he/she wants to read all of these, then there will be 18 requests before pages’ content was loaded.

If we merge all these .css files into one, and all the .js files into one .js. We can save 2/3 of the requests in this case before the page content is loaded.

100% Pure CSS menu

Author: Rockia  |  Category: Web Design

http://www.opencube.com/index.asp

Can’t believe such a professional menu can be created by just several simple clicks.

It’s a commercial software, but hey, it’s great. You can go ahead to take a try using the online interface first.

Also they have tons of web effects as well. Check it out, and you don’t want to miss it.

Web 2.0 Tool Kit

Author: Rockia  |  Category: Web Design

http://www.dezinerfolio.com/2007/04/22/the-web-designers-tool-kit/

Check this out, a great page that has lots of useful sites on it.