Popular Posts

There was an error in this gadget

Oct 29, 2011

Rotate Txt using css


<style>
#rotate {
width:20px;
height:auto;
float:left;
font-size:11px;
font-family:Verdana;
-webkit-transform: rotate(-90deg);
-moz-transform:rotate(-90deg);
filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
</style>

 <th width="22%"><div id="rotate"><?php echo $rec_event->event_name; ?></div></th>

Input Only decimal number in php(javascript)


<%--
    Document   : decimlOnly
    Created on : Dec 21, 2009, 4:29:43 PM
    Author     : user02
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
           <script>
               function intOnly(i) {
                var t = i.value;
                if(t.length>0) {
                    t = t.replace(/[^\d\.]+/g, '');
                }
                var s = t.split('.');
                if(s.length>1) {
                    s[1] = s[0] ;//+ '.' + s[1];
                    s.shift(s);
                }
                i.value = s.join('');
            }

            function decimalOnly(i) {
                var t = i.value;
                if(t.length>0) {
                    t = t.replace(/[^\d\.]+/g, '');
                }
                var s = t.split('.');
                if(s.length>1) {
                    s[1] = s[0]+ '.' + s[1];
                    s.shift(s);
                }
                i.value = s.join('');
            }

        </script>
    </head>
    <body>
     test  <input type="text" onchange="decimalOnly(this);" onkeyup="decimalOnly(this);" onkeypress="decimalOnly(this);">
    </body>
</html>

Input Only decimal number in php(javascript)


<%--
    Document   : decimlOnly
    Created on : Dec 21, 2009, 4:29:43 PM
    Author     : user02
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
           <script>
               function intOnly(i) {
                var t = i.value;
                if(t.length>0) {
                    t = t.replace(/[^\d\.]+/g, '');
                }
                var s = t.split('.');
                if(s.length>1) {
                    s[1] = s[0] ;//+ '.' + s[1];
                    s.shift(s);
                }
                i.value = s.join('');
            }

            function decimalOnly(i) {
                var t = i.value;
                if(t.length>0) {
                    t = t.replace(/[^\d\.]+/g, '');
                }
                var s = t.split('.');
                if(s.length>1) {
                    s[1] = s[0]+ '.' + s[1];
                    s.shift(s);
                }
                i.value = s.join('');
            }

        </script>
    </head>
    <body>
     test  <input type="text" onchange="decimalOnly(this);" onkeyup="decimalOnly(this);" onkeypress="decimalOnly(this);">
    </body>
</html>

Oct 19, 2011

Dynamic Menu In PHP With Access Level

Make tables:


CREATE TABLE IF NOT EXISTS `sys_menu` (
  `id` int(3) NOT NULL AUTO_INCREMENT,
  `name` varchar(40) COLLATE latin1_general_ci NOT NULL,
  `name_alias` varchar(50) COLLATE latin1_general_ci NOT NULL,
  `descrip` text COLLATE latin1_general_ci,
  `links` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `target` varchar(20) COLLATE latin1_general_ci NOT NULL,
  `folder_name` varchar(50) COLLATE latin1_general_ci NOT NULL,
  `modules` varchar(50) COLLATE latin1_general_ci NOT NULL,
  `dependency` int(1) NOT NULL,
  `dependency_to` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `access_mode` int(2) NOT NULL,
  `access_type` varchar(25) COLLATE latin1_general_ci NOT NULL,
  `admin_sort` int(3) NOT NULL,
  `_sort` int(3) NOT NULL,
  `_show` int(1) NOT NULL,
  `_group` varchar(20) COLLATE latin1_general_ci NOT NULL,
  `_date_time` datetime NOT NULL,
  `_subid` int(3) NOT NULL,
  `_referto` int(3) NOT NULL,
  `_group_level` int(3) NOT NULL,
  `_mainid` int(3) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=152 ;

INSERT INTO `sys_menu` (`id`, `name`, `name_alias`, `descrip`, `links`, `target`, `folder_name`, `modules`, `dependency`, `dependency_to`, `access_mode`, `access_type`, `admin_sort`, `_sort`, `_show`, `_group`, `_date_time`, `_subid`, `_referto`, `_group_level`, `_mainid`) VALUES
(1, 'Configuration', '', NULL, '#', '', '', '', 0, '', 0, '', 0, 1, 1, 'main', '0000-00-00 00:00:00', 0, 0, 0, 0),
(2, 'Company Add/ View', '', NULL, '../gc/company_list.php?mode=', '', '', '', 0, '', 0, '', 0, 1, 1, 'sub', '0000-00-00 00:00:00', 138, 0, 0, 0)

CREATE TABLE IF NOT EXISTS `user_level` (
  `levelid` int(11) NOT NULL AUTO_INCREMENT,
  `level` varchar(150) COLLATE latin1_general_ci NOT NULL,
  `levelgroupid` int(2) NOT NULL,
  `processing_type` int(2) NOT NULL,
  `menugroup` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `menuid` varchar(250) COLLATE latin1_general_ci NOT NULL,
  `approval` int(1) NOT NULL,
  PRIMARY KEY (`levelid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=106 ;

INSERT INTO `user_level` (`levelid`, `level`, `levelgroupid`, `processing_type`, `menugroup`, `menuid`, `approval`) VALUES
(1, 'General User GC', 1, 0, '7,8,9,95', '0', 0),
(2, 'Advance User GC', 1, 0, '1,7,8,9,95', '5', 0),
(103, 'General User WT', 3, 0, '', '', 0),
(104, 'Advance User WT', 3, 0, '', '', 0),
(100, 'Administrator', 100, 100, '1,7,8,9,95,101,116,122', '2,3,4,5,6,93,94,97,100,102,103,104106,107,108,109,110,111,112,113,114,117,118,119,120,121,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140, 142, 147,148, 149, 150, 151', 0),
(101, 'General User PT', 2, 0, '101', '106,107,108,109,110', 0),
(102, 'Advance User PT', 2, 0, '1,7,101', '102,103,104,106,107,108,109,110,111,112,113,114', 0);

PHP CODE:


function getMenu() {
$target = "";
 $user = getUser();
 $emp_row = find("select ul.menugroup, ul.menuid, ul.level from user u 
 left join user_level ul on ul.levelid=u.userlevel where u.username='$user'
 ");
$menugroup  =  $emp_row->menugroup;
$menuid  =  $emp_row->menuid;
$level  =  $emp_row->level;
echo "<ul>";
    $q = mysql_query("Select id, name, links, dependency, dependency_to, target from sys_menu where _group like '%main%' and _show = 1 and id in($menugroup) order by _sort") or trigger_error(mysql_error(), E_USER_ERROR);
    //$q = mysql_query("Select id, name, links, dependency, dependency_to, target from sys_menu where _group like '%main%' and _show = 1 order by _sort") or trigger_error(mysql_error(), E_USER_ERROR);
while ($d = mysql_fetch_object($q)) {
if ($d->dependency !=1) {
if ($d->target !="") {
$target = "target = $d->target";
}
 
$links = "$d->links";
echo "<li><a href='$links' $target>$d->name</a>";
            
$q_sub = mysql_query("Select id, name, links, target from sys_menu where _subid = $d->id and _show = 1 and id in($menuid) order by _sort") or trigger_error(mysql_error(), E_USER_ERROR);
//$q_sub = mysql_query("Select id, name, links, target from sys_menu where _subid = $d->id and _show = 1 order by _sort") or trigger_error(mysql_error(), E_USER_ERROR);
         
if (mysql_num_rows($q_sub) !=0 ) {
echo "<ul>";
while ($d_sub = mysql_fetch_object($q_sub)){
$links = "$d_sub->links";
echo "<li><a href='$links'>&#187; $d_sub->name</a>";
//-------------sub_sub menu begain here--------------
$q_sub_sub = mysql_query("Select id, name, links, target from sys_menu where _subid = $d_sub->id and _show = 1 and id in($menuid) order by _sort") or trigger_error(mysql_error(), E_USER_ERROR);
if (mysql_num_rows($q_sub_sub) !=0)
{
echo "<ul>";
while($d_sub_sub = mysql_fetch_object($q_sub_sub))
{
$links = "$d_sub_sub->links";
echo "<li><a href='$links'>&#187; $d_sub_sub->name</a></li>";
}
echo "</ul>";
} else {
echo "</li>";
}
//end-------------------------------
}
echo "</ul>";
          } else {
              echo "</li>";
        }

} else {
         
$links = "$d->links";
echo "<li><a href='$links'/>$d->name</a>
                    <ul>";
            $qq = mysql_query("Select id, category_name from $d->dependency_to where _group like '%main%' order by _sort ") or trigger_error(mysql_error(), E_USER_ERROR);
            while($dd = mysql_fetch_object($qq)) {
$links = "$d->links";
                echo "<li>Please generate</li>";
            }
            echo "</ul>
                </li>";
            }
       }
  echo "<li><a href='../common/modules.php?logout=true' onClick='return log_out()'>Sign out</a></li>";
echo "</ul>";
}

<div class="grid_16">
<div id="myslidemenu" class="jqueryslidemenu">
<?php getMenu(); // call the getMenu() Function  ?>
</div>
</div>

Oct 16, 2011

Search in PHP

Create a file activities_report.php

<form action="activities_report.php" method=POST>
<table border="0" width="100%">
<tr>

</tr>
</form>


<?php
require_once 'search_functions.php';
$cond = build_activities_filter_conditions(&$_POST);

$selectSQL = "SELECT
`activities`.`activities_id`,
`activities`.`suit_no`  as suit_no,
`activities`.`activities_date`,
`activities`.`details`,
`activities`.`next_activities_date`,
`activities`.`action_details`,
`activities_type`.`activities_type`,
`ulis_info`.`ulis_name` as ulis_name,
`activities`.`activity_type`,
`activities`.`next_activities_type`
FROM
`activities`
Inner Join `activities_type` ON `activities`.`activity_type` = `activities_type`.`activities_type_id`
Inner Join `ulis_info` ON `activities`.`ulis_info_id` = `ulis_info`.`ulis_info_id`
WHERE $cond
";

$rec = query($selectSQL);
$sl=0;


Then Create another file named it search_functions.php

function build_activities_filter_conditions($var,$alis_name=''){
    $ret = ' 1 ';
    extract($var);
    $ret .= ($from_date!="") ? " AND ".$alis_name."activities_date>='$from_date'" : "";
    $ret .= ($to_date!="") ? " AND ".$alis_name."activities_date<='$to_date'" : "";
    $ret .= ($ulis_no!="") ? " AND ".$alis_name."ulis_name LIKE '$ulis_no%'" : "";
    $ret .= ($suit_no!="") ? " AND ".$alis_name."suit_no='".$suit_no."'" : "";
    $ret .= ($activites_type!="") ? " AND ".$alis_name."activity_type='$activites_type'" : "";
        
    return $ret;
}


Upload files in PHP


You can easily Upload files in php.

$path_parts3 = pathinfo($_FILES['payment_document']['name']);
 mkdir("../documents/payment/payment_document/$pa_id");
 move_uploaded_file($_FILES['payment_document']['tmp_name'],
   "../documents/payment/payment_document/$pa_id/".$_FILES['payment_document']['name']);
 $payment_document = $_FILES['payment_document']['name'];

<form name="lbpfrm" action="" method="post" enctype="multipart/form-data">
<input type="file" name="payment_document" />
</form>

Upload multiple file

//echo sizeof($FILES['ulis_branch_info_doc'])." OOO ";
 for($i=0;$i<count($_FILES['ulis_branch_info_doc']['name']);$i++) {
     if($_FILES['ulis_branch_info_doc']['name'][$i]!='') {
   
 $path_parts = pathinfo($_FILES['ulis_branch_info_doc']['name'][$i]);
 mkdir("../documents/ulis/branch_info/$ulis_id");
 move_uploaded_file($_FILES['ulis_branch_info_doc']['tmp_name'][$i],
         "../documents/ulis/branch_info/$ulis_id/".$i.$_FILES['ulis_branch_info_doc']['name'][$i]);

      }
 }

Oct 12, 2011

Show multiple labels in combobox in php


function comboFurn($id)
{
   // echo "Testid - $id" ;
 

  // Searching for Levels of Categories
$checkParent = mysql_query("Select page_parent_id as parentid from psgfurn_pages where id = '$id' ") or die(mysql_error());
$dataParent = mysql_fetch_object($checkParent);

if ($dataParent->parentid !=0)
{
alert("1 yes");
$checkParent1 = mysql_query("Select page_parent_id as parentid from psgfurn_pages where id = '$dataParent->parentid' ") or die(mysql_error());
$dataParent1 = mysql_fetch_object($checkParent1);

if ($dataParent1->parentid !=0)
{
alert("2 yes");
$checkParent2 = mysql_query("Select page_parent_id as parentid from psgfurn_pages where id = '$dataParent1->parentid' ") or die(mysql_error());
$dataParent2 = mysql_fetch_object($checkParent2);

if ($dataParent2->parentid !=0)
{
alert("3 yes");
$mainCategory = "";
$parentCategory = "";
} else {
$mainCategory = $dataParent1->parentid;
$parentCategory = $dataParent->parentid;
}

} else {
$parentCategory = $id;
$mainCategory = $dataParent->parentid;
}

} else {
$parentCategory = "";
$mainCategory = $id;
}


// End Category




//alert("Main Category - $mainCategory /n Parent Category - $parentCategory");

/*   $only_main = $only_main;
   $layer = $layer;



if(!empty($only_main)){
$aq = "AND id = $only_main";
}
*/
// For Main Category
    $q = mysql_query("Select id, page_name from psgfurn_pages where _group ='main'") or die(mysql_error());

    while($d = mysql_fetch_object($q))
    {
$selected = "";
$categoryMessage = "";
$value = $d->id;

/* if($chk_main_layer == 1){

}else{

  }*/
($d->id == $mainCategory)  ?  $selected = "selected" : $selected = "";
if ($d->id == $id)
{
$categoryMessage = " (Dont Select)";
$value = $only_main;
}

echo "<option value='$value' $selected>$d->page_name $categoryMessage</option>";


// For 2nd Level Category
$q2 = mysql_query("Select id, page_name from psgfurn_pages where parentid = '$d->id' and _group = 'sub' ") or die(mysql_error());
if (mysql_num_rows($q) !=0)
{
while($d2 = mysql_fetch_object($q2))
{
$selected = "";
$categoryMessage = "";
$value = $d2->id;

($d2->id == $parentCategory)  ?  $selected = "selected" : $selected = "";


if ($d2->id == $id)
{
$categoryMessage = " (Already Selected)";
$value = $d2->id;
}

echo "<option value='$value' $selected>&nbsp;&nbsp;&nbsp;&nbsp; - $d2->category_name $categoryMessage</option>";


// For 3rd Level Category
/*$q3 = mysql_query("Select id, category_name from psgfurn_category where parentid = '$d2->id' and _group = 'sub'  ") or die(mysql_error());

if ((mysql_num_rows($q3) !=0) && ($layer != 2))
{
while($d3 = mysql_fetch_object($q3))
{
if ($d3->id != $id)
echo "<option value='$d3->id' >&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; -- $d3->category_name</option>";
// echo "<option value='$d->id-$d2->id-$d3->id' >&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; -- $d3->category_name</option>";
}
}*/

}
}

    }

//End Combox Box Looping
}

Oct 10, 2011

Search the google… some technique's


1.find pdf file search_key filetype:pdf
2.To find definition of a word: define  search_key
3.To find weather: weather Dhaka
4.To get the result 100+200-500+300
5.To find the links with your blog/website :link:http://itsjubayer.blogspot.com

Hide hard drive


  1.        Go to Start\Run
  2.         Type gpedit.msc
  3.        Ok\User configuration Administration templates tab windows components then double click to windows Explorer
  4.        Select hide these specified drives in My Computer from behind the menu
  5.        Right click then select properties
  6.        Select enable
  7.        Apply\Ok
  8.        To open the drive go to the previous step then select not configured Apply/Ok