game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online

how to check weather session started

how to check weather session started

/**
* Check to see if the session exists, if not, start it
*/
if((!is_array($_SESSION)) xor (!isset($_SESSION['nzshpcrt_cart'])) xor (!$_SESSION)) {
session_start();
}
?>

see the small example to check weather session has been started or not.

thanks
mrphpguru

php Vs perl – why php better than perl

php Vs perl – why php better than perl

PHP is another computer language. In a way, Perl and PHP are competitors in the programming world. Both languages have relatively similar learning curves, work well in the server environment, and have similar overall capabilities.

As you would expect, each language has its pros and cons. Ideally the webmaster would be able to use either language and choose the best one for a given project. However most programmers have a preference for one over the other and will tend to use their favourite.

In recent years PHP has become more popular with new programmers, in particular, web designers learning their first programming language. This may be because PHP is slightly easier to learn from a web design point of view. PHP pages are constructed like HTML pages, with standard HTML markup. PHP code is inserted into the page and executed when the page is requested. Conversely, Perl scripts are run as stand-alone programs and create HTML pages when the script is run.

Another issue is speed and efficiency. PHP is generally considered to be faster than Perl, although this is debatable. In any case there are certainly ways to make Perl perform as fast. PHP supporters often cite speed as a good reason to choose PHP, but in reality it is not normally a concern and any differences are usually academic.

Perl is a very powerful, robust language with more history than PHP. Although the newbie might think that Perl is more complicated than it needs to be for web development, experienced programmers will appreciate the vast array of options available with Perl.

In our opinion….

In regard to web development, we have yet to find a single thing that Perl can’t do, whereas we have found limitations in PHP. We feel that the added power of Perl makes it the better choice. We have not found the efficiency issue to be much of an issue at all – in most cases it’s only academic and won’t actually affect the performance of your website.

In the end, either language will be adequate for most web development requirements.

source: mediacollege.com

thanks

mrphpguru

how to configure wp tag cloud manually





how to configure wp tag cloud manually

Well, here is the concept of the tag cloud:

Usage

<?php wp_tag_cloud( $args ); ?>

Default Usage

<?php $args = array(
‘smallest’  => 8,
‘largest’   => 22,
‘unit’      => ‘pt’,
‘number’    => 45,
‘format’    => ‘flat’,
‘separator’ => ‘\n’,
‘orderby’   => ‘name’,
‘order’     => ‘ASC’,
‘exclude’   => ,
‘include’   => ,
‘link’      => ‘view’,
‘taxonomy’  => ‘post_tag’,
‘echo’      => true ); ?>

By default, the usage shows: Continue reading this entry…

downloading function php





hi friends i found a nice downlaod script i love to use this to amke browser force to download the image file word file xls file and so on..

Chk  this function here

$allowed_ext = array (
// archives
‘zip’ => ‘application/zip’,
// documents
‘pdf’ => ‘application/pdf’,
‘doc’ => ‘application/msword’,
‘xls’ => ‘application/vnd.ms-excel’,
‘ppt’ => ‘application/vnd.ms-powerpoint’,
// executables
‘exe’ => ‘application/octet-stream’,
// images
‘gif’ => ‘image/gif’,
‘png’ => ‘image/png’,
‘jpg’ => ‘image/jpeg’,
‘jpeg’ => ‘image/jpeg’,
// audio
‘mp3′ => ‘audio/mpeg’,
‘wav’ => ‘audio/x-wav’,
// video
‘mpeg’ => ‘video/mpeg’,
‘mpg’ => ‘video/mpeg’,
‘mpe’ => ‘video/mpeg’,
‘mov’ => ‘video/quicktime’,
‘avi’ => ‘video/x-msvideo’
);

see the array used in this function you can modify this array to add and delete the type of file you want ot allow to downlaod.

you can download php function from here

Source:http://www.zubrag.com/scripts/download.php

thanks

weight and price zone rates shipping module oscommerce





hi every body i today i am writing weight and price zone rates shipping module oscommerce.

For orders less than $180, shipping is $10 flat rate within INDIA and $500 only $5 and more than $500 is free.

So for this shopping module i modified the zone rate based shopping module look for price also.

In default zone based shipping module of oscommerce supports only weight.Now with this modification you can use weight and price zone rates shipping module oscommerce.

To do weight and price zone rates shipping module oscommerce follow following step.

1) open Zones.php and in function add new key.MODULE_SHIPPING_ZONES_MODE Like

$keys = array(‘MODULE_SHIPPING_ZONES_STATUS’, ‘MODULE_SHIPPING_ZONES_TAX_CLASS’, ‘MODULE_SHIPPING_ZONES_SORT_ORDER’,'MODULE_SHIPPING_ZONES_MODE’);

2)During Installation of the zone based we need to insert the MODULE_SHIPPING_ZONES_MODE in configuration table with function like

tep_db_query(“insert into ” . TABLE_CONFIGURATION . ” (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values (‘Table Method’, ‘MODULE_SHIPPING_ZONES_MODE’, ‘weight’, ‘The shipping cost is based on the order total or the total weight of the items ordered.’, ’6′, ’0′, ‘tep_cfg_select_option(array(\’weight\’, \’price\’), ‘, now())”);

SO every thing is ready with installation for weight and price zone rates shipping module oscommerce

no at front end to display.

$shipping_cost = ($shipping * $shipping_num_boxes) + constant(‘MODULE_SHIPPING_ZONES_HANDLING_’ . $dest_zone);

So the above line need to put in if an else clause

like

if(MODULE_SHIPPING_ZONES_MODE == ‘price’)
{
$order_total = $cart->show_total();
$table_cost = split(“[:,]” , MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2)
{
if ($order_total <= $table_cost[$i])
{
$shipping = $table_cost[$i+1];
break;
}
}
$shipping_cost = $shipping;
}
else
{
$shipping_cost = ($shipping * $shipping_num_boxes) + constant(‘MODULE_SHIPPING_ZONES_HANDLING_’ . $dest_zone);
}
if need any help and implementaion please write to me @
mrphpguru@gmail.com
i do for only $25.
Thanks
mrphpguru

how to chk ip in a ip range using php



Okay, so I put all my IP ranges in the database and wrote a function which takes an IP as input and checks the database to see if the IP is in the listed ranges. It returns TRUE if the IP is not in any of the ranges. The table where I put the ranges looks like:

Code:

+-----+-----------------+-----------------+
| ID  | StartIP         | EndIP           |
+-----+-----------------+-----------------+
|   1 | 123.123.123.123 | 123.123.200.200 |
|   2 | 124.129.0.123   | 124.129.200.200 |
|   3 | 231.160.124.1   | 231.255.255.255 |
+-----+-----------------+-----------------+
The PHP function which I wrote to do the lookup/check is:
PHP Code:
function check_ip($IP)  {  $IP = ip2long($IP);  $result = mysql_query("SELECT * FROM IPRangeTable");  while($row = mysql_fetch_array($result))  {  $StartIP = ip2long($row['StartIP']);  $EndIP   = ip2long($row['EndIP']);  if ($IP >= $StartIP && $IP <= $EndIP)  {  return FALSE;  break;  }  }  return TRUE;  }
thanks


how to list all post of a category wordpress plugings

Hi every body mrphpguru here agian.

I am written this artical to list all post of a category wordpress plugings.

Now please open the archive page of the theam.

now just select the are where you want to display all the list of the post of a category.

<div id=”post_ran”>
<div>
<h2>List of post under </h2>
</div>
<div></div>
<?php
// Declare some helper vars
$previous_year = $year = 0;
$previous_month = $month = 0;
$ul_open = false;
// Get the posts
$myposts = get_posts(‘numberposts=10&orderby=post_date&order=DESC’);
?>
<?php foreach($myposts as $post) : ?>
<?php
// Setup the post variables
setup_postdata($post);
$year = mysql2date(‘Y’, $post->post_date);
$month = mysql2date(‘n’, $post->post_date);
$day = mysql2date(‘j’, $post->post_date);
?>
<?php if($year != $previous_year || $month != $previous_month) : ?>
<div>
<div><?php the_time(‘M’); ?></div>
<div><?php the_time(‘d’); ?></div>
</div>
<?php endif; ?>
<?php $previous_year = $year; $previous_month = $month; ?>
<div>
<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>
<div>
Posted by <?php the_author() ?> under <?php the_category(‘, ‘) ?> <?php edit_post_link(‘Edit’, ‘| ‘, ”); ?>
</div>
</div>
<div></div>
<?php endforeach; ?>
</ul>
</div>

<div id=”post_ran”> <div> <h2>List of post under </h2> </div> <div></div> <?php  // Declare some helper vars $previous_year = $year = 0; $previous_month = $month = 0; $ul_open = false;   // Get the posts $myposts = get_posts(‘numberposts=10&orderby=post_date&order=DESC’);   ?>   <?php foreach($myposts as $post) : ?>   <?php   // Setup the post variables setup_postdata($post);   $year = mysql2date(‘Y’, $post->post_date); $month = mysql2date(‘n’, $post->post_date); $day = mysql2date(‘j’, $post->post_date);   ?>   <?php if($year != $previous_year || $month != $previous_month) : ?>     <div> <div><?php the_time(‘M’); ?></div> <div><?php the_time(‘d’); ?></div> </div>       <?php endif; ?>   <?php $previous_year = $year; $previous_month = $month; ?>   <div> <h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <div>Posted by <?php the_author() ?> under <?php the_category(‘, ‘) ?> <?php edit_post_link(‘Edit’, ‘| ‘, ”); ?> </div> </div> <div></div> <?php endforeach; ?> </ul> </div>

in the above code you can controll the number of post by changing  numberposts=10

$myposts = get_posts(‘numberposts=10&orderby=post_date&order=DESC’);

numberposts=10 means it will display 10 post title

-1 will display all..

thanks

mrphpguru

–>ZOAEX-Ribbon http://bit….





–>ZOAEX-Ribbon http://bit.ly/cHbWAJ

php function to formate mysql date

php tutorial

hi today i am writting simple php function to formate the date from mysql data

<?

//first formate defining
define(‘DATE_FORMAT’, ‘d/m/Y’);  // this is used for date()

//now writing the function to formate the date

function tep_date_short_mdy($raw_date)

{

$date=strtotime($raw_date);

$daylam=date(DATE_FORMAT, $date);

// 05/16/2000

$daylam1=explode(‘/’,$daylam);

$day1=$daylam1[1];

$month1=$daylam1[0];

$year1=$daylam1[2];

$dayfinal=$month1.’/’.$day1.’/’.$year1;

return $dayfinal;

}

?>

isn’t it is simple one to formate the date which is getting from mysql database.

thanks

mrphpguru

display total number of comments and category in wordpress blog

Hi i am wrting post to display number of comments and number of categories in wordpress blog it is very simple

<?php
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);

$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %3$s <a href="%4$s" title="Comments">comments</a>, 
?>
Thanks
mrphpguru