Author's posts

Make Out Aakash Tablet

The device will be sold to Government of India at $49. The Government of India even distributed 500 free tablets to students from different parts of India who had come to attend the press conference for release of Aakash tablet by HRD minister Kabil Sibal in the capital. The Aakash tablet will be available for students at a subsidized price, which would bring down its value to $35 (Rs. 17,00) making it the cheapest tablet ever.

Permanent link to this article: https://blog.openshell.in/2011/10/make-out-aakash-tablet/

session-start – headers already sent

This happens when you try to start session more than once. [php] The solution for above problem is 1) in php.ini file set session.autostart to 0 session.auto_start = 0 2) Placing a .htaccess file in the root of your web directory with the following value: php_flag session.auto_start 0 3) In your code use this line …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/10/1263/

PHP characters limitation

Characters limitation will helps to display limited number of characters to display. [php] function limit_characters( $str, $n ) { if ( strlen ( $str ) <= $n ) { return $str; } else { return substr ( $str, 0, $n ) . ‘…’; } } [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-characters-limitation/

Resize image in specified height & width while upload

Resizing images in specified height & width while uploading files to the server. [php] /* Create a thumbnail of $srcFile and save it to $destFile. The thumbnail will be $width pixels. */ function createThumbnail($srcFile, $destFile, $new_w, $new_h, $quality = 75) { $thumbnail = ”; if (file_exists($srcFile) && isset($destFile)) { $size = getimagesize($srcFile); $old_x = $size[0]; …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/09/resize-image-in-specified-height-width-while-upload/

PHP Automatic Session Logout

Automatic logout script if users have inactive more than 15 minutes [php] <?php session_start(); $inactive = 900; // Set timeout period in seconds if (isset($_SESSION[‘timeout’])) { $session_life = time() – $_SESSION[‘timeout’]; if ($session_life > $inactive) { session_destroy(); header("Location: logoutpage.php"); } } $_SESSION[‘timeout’] = time(); ?> [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-automatic-session-logout/

PHP MYSQL ORDER BY Multiple Columns

If you want to Order 2 or more columns in SQL Query. When ordering by more than one column, the second column is only used if the values are identical with the onces in the first column. Example [sql] ‘Order by Column ORDER BY COLUMN1, COLUMN2 [/sql] Order 2 or more columns with different orders …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/09/php-mysql-order-by-multiple-columns/

String Function in PHP

nl2br(): The nl2br() function adds the tag if it finds the carriage return (n) in the text. If you text is long and at many places carriage return is present, even then the nl2br() tag will replace all the occurrence of the carriage return with tag. Here is the syntax of the nl2br() tag: [php] …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/string-function-in-php/

String Functions in PHP [heredoc syntax]

The heredoc syntax: In addition of the single quote and double quote syntaxex, PHP provides another way to specify a string called heredoc syntax. This syntax turns out to be a extremely useful for specifiying large chunks of variable-interpolated text, because it spares you from the need to escape internal quotation marks. It is especially …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/string-functions-in-php-heredoc-syntax/

Setting up dual ip address in ubuntu

Hi, here is a simple way to setup dual ip in your ubuntu system if you already have eth0 as 192.168.0.10 then if you want 192.168.1.10 then use the following command to bring up a alias but this is temporary sudo ifconfig eth0:0 192.168.1.11 up To have a permanent dual ip update the /etc/network/interfaces file like the below …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/setting-up-dual-ip-address-in-ubuntu/

Using Dialup modems in ubuntu

hi all, Everyone will be familiar with configuring wired and wireless network in Ubuntu. But still at some point of time we may have the need to use dialup modem in ubuntu. here is a simple way to configure dialup modems in ubuntu. The following command will install gnome-ppp which is a gui based configuration tool for …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/using-dialup-modems-in-ubuntu/