Browsing articles from "March, 2008"

Most Easy way to keep safe ur DB configuration file!

Mar 25, 2008   //   by nuhil   //   MySQL, PHP  //  6 Comments

Suppose you have the file in your server named config.php where you’ve wrote the necessary functions for DataBase connection. Any Body can get information by accessing it directly from a browser. Here is a way to prevent this…

<?php
if (!defined(‘prover’))
{
die(“File not found”);
}
// MySQL Settings
$db_host = ‘localhost’;
$db_user = ‘root’;
$db_database = ‘registration’;
// Connect to the database
mysql_connect ($db_host, $db_user) or die (‘Could not connect to the database.’);
mysql_select_db ($db_database) or die (‘Could not select database.’);
print “Hallo”;
?>

The function defined checks whether a constant exists. The variable prover is not defined in the PHP script, so, if you try to access config.php  directly,  you’ll see  “File not found” right on top, preventing people from looking at your code and discovering what your login/password are, if any. In this case, mysql_connect lacks a password. That’s because there isn’t one in the local server.

Form Validation! Instant Alert on page!

Mar 21, 2008   //   by nuhil   //   JS  //  2 Comments

Using Java Script you can check a form. The errors will be shown in a small window. But using JavaScript library, you can do it more smartly and effectively.
The basic method is to attach to the form’s onsubmit event, read out all the form elements’ classes and perform validation if required. If a field fails validation, reveal field validation advice and prevent the form from submitting.
Include the javascript libraries:

<script src=”prototype.js” mce_src=”prototype.js” type=”text/javascript”></script>
<script src=”validation.js” mce_src=”validation.js” type=”text/javascript”></script>

You write elements like this:
<input class=”required validate-number” id=”field1″ name=”field1″ />
You then activate validation by passing the form or form’s id attribute like this:
<script type=”text/javascript”>
     new Validation(‘form-id’); // OR new Validation(document.forms[0]);
</script>
See the Example:

Read more >>

Independence of Movement!Drag Anywhere!

Mar 20, 2008   //   by nuhil   //   CSS, JS  //  3 Comments

You have already seen how the widgets of a page can be moved any where of that page. This is a simple use of JavaScript. One of my honorable senior Apu vai came to RUET to attend the 3rd convocation and told me to use the best of JavaScript. He directed me to create this….

 drag.jpg
You can drag this kind of widgets any where of a web page. You can also save that setting for further viewing using Ajax. Download the example from my Shared Box of the right side of the page. The zip is named Drag.zip
*** It works fine in IE.

I've Started Action Script!

Mar 17, 2008   //   by nuhil   //   Action Script, HTML  //  No Comments

Finally i’ve begun action script with flash. I’ve not seen any difficulty with button scripting and movie clip scripting Even now. But i’m sure there are some untolerateable factors which are coming toward me. But i’ll try my best to get a clear concept on it. Thnx to Mehedy (My friend) to help me by giving a book of it. 

My first project contains one scene with a Instruction to click on one button between two. By clicking on one of them, take it to other scene using Action Script. The Script show one label of scene two and become halted.

Simple Action Script of my two Button is below:

For Pink button:
on (release) {
 gotoAndStop(“Scene 2 Choice”,”pink”); //goes to label named pink of scene 2 and stop

}
For Green button:
on (release) {
 gotoAndStop(“Scene 2 Choice”,”green”);  //goes to label named green of scene 2 and stop

}

Have you ever seen such a beautiful thing?!

Mar 16, 2008   //   by nuhil   //   HTML, JQuery, JS  //  2 Comments

Do you want to make your site look like Facebook? Then the fact is JQuery! jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. It was released January 2006 at BarCamp NYC by John Resig.One of my best friends Rana told me to study this and i’ve got it.

See the example below:

You can use this kind of window for login or inserting data.

untitled1.jpg

Or you can show a remote Page through this. Read more >>

Pages:123»