Recent Updates Page 2 Toggle Comment Threads | Keyboard Shortcuts

  • saif 7:54 pm on December 28, 2010 Permalink | Reply
    Tags: 2011, wishlist   

    A Turning Year 2010 and Wishlist for 2011 

    just ending 2010 and going to start 2011! I’m wondering how time passed away! 2010 was really a turning year for me and also 2009. Have some plan and idea for 2011.

    Remembering 2010:

    • Joined bGlobal, got some awesome colleagues as well as friend, realized a great working environment.
    • Learned Cakephp, Zend Framework, EE.
    • Bought my Laptop (ACER ASPIRE 4745).
    • Worked on some tremendous website and web application.
    • Reviewed a jquery animation book by Packt Pub.
    • Became 27 years old 🙂

    Wishlist for 2011:

    • To be the Cakephp NINJA
    • Do something advance with CI.
    • will learn Magento and Zen cart soon
    • To be a TRUE BLOGGER and WordPress geek (have plan to create some WP Plugin)
    • Jquery! Wanna rid of this!
    • Wish to have a  MACBOOK/MACBOOK PRO and also a iPHONE.
    • Will buy a Acoustic Guitar soon (even once upon a time i had a dream of a BAND 🙂 )
    • To be a ZCE (it was also in 2009 wish list :))
    • To be more faster.

    Finally, well wishes for everyone, for every friendz, colleagues. Pray for me!
    Have a nice year!

    Advertisements
     
  • saif 7:39 pm on February 16, 2010 Permalink | Reply
    Tags: CodeIgniter, PHP Security   

    Simple PHP Security in CodeIgniter 

    As web is now the part of our life and we can’t think our daily works without www. For both users and developers, security is a key question. I would like to share some simple security points in this post, which are common.

    • Cross Site Scripting(or XSS) is one of the most common application-layer web attacks. XSS commonly targets scripts embedded in a page which are executed on the client-side (in the user’s web browser) rather than on the server-side. An example of XSS may be as from user input. Suppose you put <textarea> on your site to get user input. But malicious user give input like this :<script type="text/javascript">
      window.locaton('http://example.com');
      </script>

      or it may be a unwanted alert message in javascript, which is not expected.So you definitely want to prevent this type of attack. I’m going to show the solution here in CodeIgniter. CodeIgniter has its built in input class.The example is below:

      $data= $this->input->post('UserInput');
      $data_xss = $this->input->xss_clean($data);

      At first, you get user input by post method and now just pass that value to the function. if you print the final value, you will see the javascript code will be replaced by others like [removed].Now you can pass the value to database query or do anything with that value.

    • Use htmlentities( ) for user input . It will convert all applicable characters to HTML entities like below.

      $str = “A ‘quote’ is <b>bold</b>”;
      // Outputs: A ‘quote’ is &lt;b&gt;bold&lt;/b&gt;
      echo htmlentities($str);

    Some useful links for best practices and security:

    Cheers and practice with best approach. 🙂

     
  • saif 10:52 am on February 3, 2010 Permalink | Reply
    Tags: html, PHP, php in html   

    Execute PHP code within a html/htm file 

    When a web page is call, the server checks two thongs, whether it is a html/htm file or a php/asp(etc) file. The key point is file extension or file type.If it is a normal .html/.htm file, server sends it direct to the browser. And if it is a php/asp(etc), server than execute the appropriate code before sending it to the browser.

    Come to the point: Now you need to add some php code within your existing html file,then what is the process?
    There are two ways, what i ever know and want to share with you,
    1.Rename the html file to php file (the easiest way),
    2.Using .htaccess file to allow php within html file.

    if you follow the first one, it’s easy. but you may have incoming links or search engine ranking or if u change the file type, you need to change many code within your application.so in this situation, come to the second solution. 😉

    The way is:
    You need to add some command in your .htaccess file like below:
    For html file :
    AddType application/x-httpd-php .html

    Or for .htm
    AddType application/x-httpd-php .htm

    If you only plan on including the PHP on one page, it is better to setup this way:
    <Files myhome.html> AddType application/x-httpd-php .html </Files>

    Example:
    Now you can put php script like below in your html file :

    <p id='php_cont'><?php echo "hi all"; ?></p>

    N.B. Always be careful about your .htaccess file. if you have already one, just add the above command to the file, don’t replace all. and for beginner, the .htaccess file will be in your root folder, where your application or project exists (i.e. http://localhost/myapp)

    That’s all. For very beginners it may be helpful and i think this is a common question for them that  ‘How to use php in html file?’. cheers 😉

     
  • saif 8:49 am on January 12, 2010 Permalink | Reply
    Tags: drop down list url, onChange go url   

    Go to a URL/link from drop down list/menu in html+javascript 

    In many web application, we see some kind of drop down list to go to a URL only by clicking on the list item, no need to click on any button. For the users, this is a nice experience that they don’t have to click on submit button.
    I have described here in details the tutorial especially for beginners. Let we have a form like below:


    <form method="post" action="http://www.example.com/submit.php">
    <input type="submit" name="submit_button" value="Go">
    <select name="url_list" >
    <option value="http://www.example.com/index.html">list 1</option>
    <option value="http://www.example.com/about.html">list 2</option>
    </select>
    </form>

    we can improve the form performance by combining it with a simple javascript and it has below advantages:

    1.It makes your page more efficient, because if JavaScript is enabled, the web browser can jump to the destination webpage itself without having to run the script. Also it is nicer for users because they do not need to select the “go” button.

    2.The form will also continue to work with web browsers that do not have JavaScript available.

    Now, the following example displays a drop down list with a js function. Include the js in your <head></head> of the file :


    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin gotosite
    function gotosite()
    {
    var URL = document.gotoform.url_list.options[document.gotoform.url_list.selectedIndex].value; window.location.href = URL;
    }
    // End gotosite -->
    </script>

    and now try the form like this :


    <form name="gotoform" method="post" action="http://www.example.com/submit.php">
    <noscript>
    <!-- use noscript to only show this if no javascript is available -->
    <input type="submit" name="submit_button" value="Go">
    </noscript>
    <select name="url_list" size="1" onChange="gotosite()">
    <-- Value of first option is default, usually current page -->
    <option value="http://www.example.com/submit.php"> Select a Site...</option>
    <option value="http://www.example.com/index.html">list 1</option>
    <option value="http://www.example.com/about.html">list 2</option>
    </select>
    </form>

    we call ‘gotosite()’  function on ‘onChange’ of <select>, and this will help to jump to the url for each list.
    Hope this will help the beginners for more reliable user experience.

     
    • Craige 11:21 pm on April 29, 2012 Permalink | Reply

      this is very helpful! Thanks much..as a beginner in JS, it really helped me a lot 😀 thanks Sir 😀

    • Yodi 1:27 am on August 30, 2012 Permalink | Reply

      I tried this code on my blog and it works. But how can I make the length/size of the menu fixed?
      The above code follows the length of the list name. Please help!

      • saif 7:20 am on August 31, 2012 Permalink | Reply

        Hi, Yodi.
        i think u tried it with a dropdown menu, if u want to bind/fix a menu’s width or length, u can use css for it. it can be a inline css or from a css class like this :
        style=”width: 150px;”

        if u need further help, feel free to knock me 🙂

    • PompanoBeachPlumber 6:39 pm on October 17, 2012 Permalink | Reply

      Good stuff, thank you for this. As a contractor this really helps keep me fresh…. Thanks Again…

    • coupons 2012 9:54 pm on October 17, 2012 Permalink | Reply

      Please let me know if you’re looking for a article author for your site. You have some really good articles and I feel I would be a good asset. If you ever want to take some of the load off, I’d love to write some
      articles for your blog in exchange for a link back to mine.

      Please blast me an email if interested. Many thanks!

    • http://iepla.net/forums/index.php?action=profile&u=311 8:39 am on December 23, 2012 Permalink | Reply

      I love it when people get together and share ideas.
      Great site, keep it up!

    • tao of badass login info 12:53 pm on May 1, 2013 Permalink | Reply

      I’ve been surfing online more than 4 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

    • ปฏิทิน ไทย 2556 8:21 pm on May 15, 2013 Permalink | Reply

      I think this is one of the most significant info for me.
      And i am glad reading your article. But wanna remark
      on some general things, The site style is wonderful, the articles is really nice : D.

      Good job, cheers

    • gold bullion 9:55 am on June 9, 2013 Permalink | Reply

      Wow, this post is nice, my sister is analyzing these
      things, thus I am going to convey her.

  • saif 6:28 pm on December 20, 2009 Permalink | Reply
    Tags: insert string with quote, mysql   

    insert string with single quote(‘) or double quote(“) in mysql 

    In developing web application, we write insert query for inserting data into database. Hence i use mysql query and PHP functions for inserting string with single quote(‘) or double quote.

    let we know two useful PHP function :

    1.  addslashes — Quote string with slashes. Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).

    <?php
    $str
    = "Is your name O'reilly?";
    // Outputs: Is your name O\'reilly?
    echo addslashes($str);
    ?>

    2. stripslashes —  Un-quote string quoted with addslashes(). Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).

    <?php
    $str
    = "Is your name O\'reilly?";

    // Outputs: Is your name O’reilly?
    echo stripslashes($str);
    ?>

    Now come to the point…..if we insert string into database with single or double quote like this :
    <?php
    $str = “Is your name O’reilly?”;
    $query = “INSERT INTO tbl (description) VALUES ( ‘$str’)”;
    ?>
    This will occur error.

    but if we use addslashes($str) function like below and then insert into database, then no error will be occurred.
    <?php
    $str = “Is your name O’reilly?”;
    $desc_str = addslashes($str);
    $query = “INSERT INTO tbl (description) VALUES ( ‘$desc_str’)”;
    ?>

    similarly we can use stripslashes($str) to print that table field value like this :
    <?php
    echo stripslashes($str);
    ?>

    cheers 🙂

     
  • saif 6:04 pm on December 17, 2009 Permalink | Reply
    Tags: important prayer for muslims   

    আমাদের জীবনের জন্য দরকারী দোআ সমূহ 

    বাবা-মা এর প্রতি :

    বাবা-মা এর প্রতি

    যানবাহনে আরোহনের দোআ :

    যানবাহনে আরোহনের দোআ

    যানবাহনে আরোহনের দোআ

    জাহান্নাম থেকে মুক্তি পাবার দোআ :

    জাহান্নাম থেকে মুক্তি পাবার দোআ

    জাহান্নাম থেকে মুক্তি পাবার দোআ

    ঘর থেকে বের হবার দোআ :

    ঘর থেকে বের হবার দোআ

    ঘর থেকে বের হবার দোআ

    খাওয়া শুরু করার দোআ :

    খাওয়া শুরু করার দোআ

    ঘুমাতে যাবার আগে দোআ :

    ঘুমাতে যাবার আগে দোআ

     
    • Kazi Mohammad Ekram 9:13 am on February 10, 2010 Permalink | Reply

      Nice Start buddy. Thanks for sharing such doas. It’s really helpful and useful in our daily life. Wish you all the best.

  • saif 11:15 am on December 13, 2009 Permalink | Reply
    Tags: user IP   

    Get users IP by Getenv() PHP Function 

    Definition: Getenv () is used to get the value of an environmental variable. It is written as Getenv (varname) .

    Below are some examples of environmental variables you can use. If you are interested, you can see a full list by running phpinfo ().

    Also Known As: Get Environment Variable

    Examples:

    Get users IP by getenv() function. This is useful, when you want to know the users IP of your site during registration. By this you can know about users that, from where they are signing up or related information.

    You can also track users during login that, every time users are logging in and you know from which area or IP they are access your site. So see the simple use of this function:

    <?php
    //Gets the IP address
    $ip = getenv(“REMOTE_ADDR”) ;
    Echo “Your IP is ” . $ip;
    ?>

    <?php
    //Gets the document root
    $root = getenv(“DOCUMENT_ROOT”) ;
    Echo $root;
    ?>

    <?php
    //Gets the server admin’s email
    $ad = getenv(“SERVER_ADMIN”) ;
    Echo $ad;
    ?>

    Happy’s coding 🙂

    Definition: Getenv () is used to get the value of an environmental variable. It is written as Getenv (varname) ;

     
  • saif 9:13 am on December 12, 2009 Permalink | Reply
    Tags: Dynamic row color, Javascript   

    Alter Dynamic Table Row Background Colors Using JavaScript 

    Many web applications that present tabular data use alternating background colors of table rows to increase the readability of that data. This could be more attractive and nice looking for visitors.

    I wanted the table to be dynamic. We can use PHP for doing this, but hence I’m showing it in JavaScript.

    Getting Started

    Let’s start with an ordinary html table. Whether the table contains head/foot elements doesn’t matter in this case:

    <table id="theTable">
    <tr><td>0 - some txt</td></tr>
    <tr><td>1 - some txt</td></tr>
    <tr><td>2 - some txt</td></tr>
    <tr><td>3 - some txt</td></tr>
    <tr><td>4 - some txt</td></tr>
    </table>

    we use a style element through which we have defined two classes for background colors:

    <style>
    .odd{background-color: white;}
    .even{background-color: gray;}
    </style>

    The style is flexible: it could just as well define something else, such as that every second row should display in italics. The complete function looks like this:

    function alternate(id){
    if(document.getElementsByTagName){
    var table = document.getElementById(id);
    var rows = table.getElementsByTagName("tr");
    for(i = 0; i < rows.length; i++){
    //manipulate rows
    if(i % 2 == 0){
    rows[i].className = "even";
    }else{
    rows[i].className = "odd";
    }
    }
    }
    }

    The above function should be called from the onload event of the body tag:

    <html>

    <body onload="alternate('thetable')">
    <table id="thetable">
    <tr><td>…</td></tr>
    </table>

    The result could look something like this:

    row color img

    row color example

    Hope this may help the beginners who are developing web applications. 🙂

    Happy’s coding.

    Many web applications that present tabular data use alternating background colors of table rows to increase the readability of that data. This could be more attractive and nice looking for visitors.

    I wanted the table to be dynamic. We can use PHP for doing this, but hence I’m showing it in JavaScript.

    Getting Started
    Let’s start with an ordinary html table. Whether the table contains head/foot elements doesn’t matter in this case:

    <table id="theTable">
    <tr><td>0 - some txt</td></tr>
    <tr><td>1 - some txt</td></tr>
    <tr><td>2 - some txt</td></tr>
    <tr><td>3 - some txt</td></tr>
    <tr><td>4 - some txt</td></tr>
    </table>

    we use a style element through which we have defined two classes for background colors:

    <style>
    .odd{background-color: white;}
    .even{background-color: gray;}
    </style>

    The style is flexible: it could just as well define something else, such as that every second row should display in italics. The complete function looks like this:

    function alternate(id){
    if(document.getElementsByTagName){
    var table = document.getElementById(id);
    var rows = table.getElementsByTagName("tr");
    for(i = 0; i < rows.length; i++){
    //manipulate rows
    if(i % 2 == 0){
    rows[i].className = "even";
    }else{
    rows[i].className = "odd";
    }
    }
    }
    }

    The above function should be called from the onload event of the body tag:

    <html>

    <body onload="alternate('thetable')">
    <table id="thetable">
    <tr><td>…</td></tr>
    </table>

    The result could look something like this:
    1457_rowcolor1

    Hope this will may help the beginners who are developing web applications. J

    Happy’s coding.

     
    • Mahbub 10:38 am on February 8, 2010 Permalink | Reply

      I remember when i used to do this way 6-7 years back. Now with jQuery this is a piece of Cake.

      It’ll look like

      $(“#thetable tr:even”).addClass(“even”);
      $(“#thetable tr:odd”).addClass(“odd”);

      • saif 12:09 pm on February 8, 2010 Permalink | Reply

        @mahbub bhai, thanx for sharing. I just wrote it in js way and for beginners, Yours one is also useful and pretty. 😉

  • saif 5:42 pm on December 10, 2009 Permalink | Reply
    Tags:   

    Set favicon in different browser 

    we have seen most of the site has favicon which describe the additional information about the site , Addition in the scene it could be logo,company Profile, company production,web site application, and so many .

    now how can u do this ?
    its very simple to do , just u need to add some line’s of code and be ready with small icon image, u can also add animated image in fevicon

    add this part in between <head> </head> Section. Please try to use relative icon type like  type=”image/ico” for .ico image.

    <link rel=”shortcut icon” type=”image/ico”  href=”images/favicon.ico”>

    now some time this code will not work on most of the Browser like IE old version
    in this case u can add this line

    <link rel=”shortcut icon” href=”images/favicon.ico” type=”image/vnd.microsoft.icon” *gt;

    we can use this also for IE:

    <!--[if IE]>
        <link href="images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
    <![endif]-->

    Finally ConvertICO can help to convert png image to ico image.

    Hope this will help the beginners who just started their journey in web development.

    Happy’s coding 🙂

     
  • saif 5:20 pm on December 10, 2009 Permalink | Reply  

    PHP == Progress Happiness Prosperity 

    I discovered a new meanings of PHP. In general, we know PHP stands for ‘Hypertext Pre processor’. but i think PHP stands for ‘Progress Happiness Prosperity’ for PHP developer guys who love PHP, who work in PHP, stay with PHP.

    It may like a funny abbreviation, but i think it’s a alternate meanings of PHP. Bcoz i love PHP.

    Happy’s coding!!

    🙂

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
%d bloggers like this: