if (strpos($SCRIPT_NAME,"/cms/") >0 && strpos($SCRIPT_NAME,"index.php")==0 && strpos($SCRIPT_NAME,"LoginVerify.php")==0 && strpos($SCRIPT_NAME,"LoginVerify.php")==0) { //global $mpcb_auth; if ($mpcb_auth=="") { ?>
Home | Disclaimer | Terms & Conditions | Signout | Edit profile | Edit preferences bfname=="") $getu->bfname="Guest"; if($getu->user_id=="") $user_id=session_id(); $nos=mysql_num_rows(mysql_query("SELECT * FROM cart_trans WHERE user_id='$user_id' ")); //print "*** $user_id"; ?>
Welcome , Items in Cart ()
pghead; echo "$title"; } function display_cur_session() { global $_SESSION,$web_dir,$SESSION_USERID,$SESSION_TYPE,$SESSION_Name,$SESSION_DESIGNATION; if($_SESSION[$SESSION_TYPE]){ print ""; print "
"; if($_SESSION[$SESSION_TYPE]=='E'){ include_once "DB.php"; db_connect(); $dsg = ExecuteQuery("select Dsg_desc from Emp_designation_mast where Dsg_cd ='$_SESSION[$SESSION_DESIGNATION]'"); db_close(); print "".$_SESSION[$SESSION_Name]." (".$dsg[Dsg_desc].") ".date("d/m/Y").""; } elseif($_SESSION[$SESSION_TYPE]=='A') print "".$_SESSION["$SESSION_Name"]." (".$_SESSION["$SESSION_USERID"].") ".date("d/m/Y").""; elseif($_SESSION[$SESSION_TYPE]=='N' && $_SESSION[$SESSION_USERID]) print "".$_SESSION["$SESSION_USERID"]." ".date("d/m/Y").""; print "  
"; } } function page_header($pagetitle,$MM=1) { print "
  $pagetitle "; print "
"; } function end_html() { global $IMGPATH; $str="
Site Developed by Marathiworld.com, a division of Cybertech Networks Pvt. Ltd.
"; print $str; } function table_with_border($size) { $str="
\n"; print $str; } function field_mandatory() { echo "*"; } function db_connect() { global $dsn,$DB; $linkdb=mysql_connect("localhost","niranjan","fish"); $db=mysql_select_db("mwshop",$linkdb); } function db_close() { global $DB; $DB->disconnect(); } /*function exec_query($sql,$recname='') { global $DB; //$result = $DB->query($sql); //check_error($result,$recname); $result=mysql_query($sql) or die(mysql_error()); //return $result; return $result; }*/ function check_error($obj,$recname) { if (DB::isError($obj)) display_err_msg($obj->getMessage(),$recname); } function no_result() { print "

"; print "
"; print ""; print "No Records Found."; print "
"; } function check_auth() { global $_SESSION,$_SERVER; global $SESSION_USERID,$SESSION_TYPE,$SESSION_MENU_RIGHTS,$SESSION_CURRENT_APP; global $DB, $DB_NAME, $DB_USER, $DB_PASSWORD; //print "Session value is :$_SESSION[$SESSION_USERID]"; //global $auth_emp_id; //if($_SESSION[$SESSION_USERID]=="") header("location:index.phtml"); //exit; if($_SESSION[$SESSION_MENU_RIGHTS]=='All') return true; $filter=ereg_replace("^",".",$_SERVER[REQUEST_URI]); if(!ereg("\?",$filter)){ if(!ereg(".php$|.phtml$|.php$|.htm$|.html$",$filter)) $filter.="index.phtml"; } include_once "include/DB.php"; db_connect(); $sql="select menu_code,parent from user_rights where prg like '$filter'"; $res=exec_query($sql); if($res->numRows()) { $app_menu_rights=unserialize($_SESSION[$SESSION_MENU_RIGHTS]); while($ary1=$res->fetchrow(DB_FETCHMODE_ASSOC)) { $sql1="select parent from user_rights where menu_code=$ary1[parent]"; $res1=exec_query($sql1); $ary2=$res1->fetchrow(DB_FETCHMODE_ASSOC); if($ary1[parent]){ $ary=explode(",",$app_menu_rights[$ary2[parent]][$ary1[parent]]); if(in_array($ary1[menu_code],$ary)){ //user_log_entry(); return true; } } else { if ($app_menu_rights[$ary1[menu_code]][$ary1[menu_code]]) return true; } } db_close(); exit_application(1); }//if res else { db_close(); return true; }//else } function exit_application($reason) { /*global $web_dir; start_html("SmallSaving"); print "
"; Unauthorized access!!!"; if($reason) print "

No userrights assign for this module !"; else print "

Session not set
"; print "OR
"; print "User Session expired. Please Login again

"; print "Login Now"; print "
"; print ""; exit;*/ } function disp_link($url,$status,$disp_data,$target='') { if($target) print "$disp_data"; else print "$disp_data"; } function disp_addnew_link($url,$status,$target='') { global $IMGPATH; print "
"; if($target) print ""; else print "\n"; print "
"; } function add_space($id) { for($i=0;$i<$id;$i++) print " "; } function get_next_id($field) { $sql="select $field from Unique_id_mast"; $result=exec_query($sql); //$row=$result->fetchrow(DB_FETCHMODE_ASSOC); //$row=mysql_fetch_row($result); $row=mysql_fetch_array($result); $sql="update Unique_id_mast set $field=$field+1"; $result=exec_query($sql); return $row[$field]+1; } function generate_valid_id($id,$maxlen) { $lendif=$maxlen-strlen($id); for($i=0;$i<$lendif;$i++) $id='0'.$id; return $id; } function get_list_data($table,$id,$fieldary,$where='',$sql='') { if(!$sql) $sql="select * from $table"; if($where) $sql.=" $where"; //$result = exec_query($sql); //$result=mysql_query($sql); $result=exec_query($sql); $ary = Array(); //if($result->numRows()){ // while($row=$result->fetchrow(DB_FETCHMODE_ASSOC)){ //if(mysql_num_rows($result)I>0) //{ //WwHILE($rows=mysql_fetch_row$result()) //while($row=mysql_fetch_row($result)) //while($row=mysql_fetch_row($result)) while($row=mysql_fetch_array($result)) { $dval=''; foreach($fieldary as $val) { if($val=='Current_desg') $dval.="(".$row["$val"].") "; else $dval.=$row["$val"]." "; }//foreach $ary[$row["$id"]]=trim($dval); }//while //}//if return $ary; } function display_msg($msg) { print "


$msg
"; } function display_err_msg($msg,$recname) { if($recname){ if(ereg("already exists$",$msg)){ print "

This $recname is already exists.

"; print "Back
"; } else print "

$msg
"; } else print "

$msg
"; exit; } function format_date_db($date) { $dtary = explode("/",$date); //print_r($dtary); if (count($dtary)>1) { return $dtary[2]."-".$dtary[1]."-".$dtary[0]; } else { return($date); } } function format_date_db1($date) { $dtary = explode("-",$date); if (count($dtary)>0) { return $dtary[2]."-".$dtary[1]."-".$dtary[0]; } else { return($date); } } function display_status($status) { global $IMGPATH; if($status) $str = ""; else $str = ""; return $str; } function display_inview($width,$name,$funtb='1') { print "
"; print "
Click on '$name' to edit the details.
"; //if($funtb) table_with_border($width); } function public_display_inview($width,$name,$funtb='1') { print ""; print "
Click on '$name' to Download.
"; //if($funtb) table_with_border($width); } function display_inadd($width) { print "
"; print "
Fields with * are mandatory fields.
"; } function combo_init($sql,$fcount,$jary='dt') { $result=exec_query($sql); $dataary=Array(); if($result->numRows()) { $j=0; while($row=$result->fetchrow()) { for($i=0;$i<$fcount;$i++) $datastr.=$row[$i]."|"; $dataary[$j]=$datastr; $datastr=''; $j++; } } else $dataary['ND']='ND|No Data'; print "\n\n"; } function checkMasters($list) { $tempary = array(); foreach ($list as $k=>$v) { $sql="select * from $v"; $result=exec_query($sql); if(!$result->numRows()) array_push($tempary,$k); } if (count($tempary)) { print "
Please add data in " .implode($tempary,", ")." masters.
"; exit; } return 1; } function ExecuteQuery($sql) { $result=exec_query($sql); if($result->numRows()) { $row = $result->fetchrow(DB_FETCHMODE_ASSOC); return $row; } else return 0; } function upload_image($Upload_path,$type='photo') { global $_FILES, $Upload_block_ext, $Upload_maxsize,$Upload_image_types,$Upload_doc_types; if (is_uploaded_file($_FILES[userfile][tmp_name])) { while (list($key,$val) = each($Upload_block_ext)) { if (eregi("$val$",$_FILES[userfile][name])) { print ""; exit; } } } if($type=='photo') $chk_ary=$Upload_image_types; if($type=='docs') $chk_ary=$Upload_doc_types; if (is_uploaded_file($_FILES[userfile][tmp_name])) { $flag=1; while (list($key,$val) = each($chk_ary)) { if (eregi("$val$",$_FILES[userfile][name])) { $flag=0; break; } } } if ($flag) { print ""; exit; } if ($_FILES[userfile][size] > $Upload_maxsize || !$_FILES[userfile][size]) {?> numRows()){ while ($row1=$result1->fetchrow(DB_FETCHMODE_ASSOC)){ $distoffice[$row1["Office_cd"]] = $row1["Office_desc"]; get_offices($row1["Office_cd"]); }//wh }//if } function user_log_entry() { global $SESSION_EmpCode,$_SESSION, $SESSION_Franchisee; $uri= explode("=",$_SERVER[REQUEST_URI]); //$sql="select * from user_rights , Log_master where user_rights.prg='.$_SERVER[REQUEST_URI]' and user_rights.menu_code = Log_master.menu_id and Log_master.Status='1'"; $sql="select * from user_rights , Log_master where user_rights.prg='$uri[1]' and user_rights.menu_code = Log_master.menu_id and Log_master.Status='1'"; $row = ExecuteQuery($sql); $result = exec_query($sql); if($result->numRows()){ if($_SESSION[$SESSION_Franchisee]) $sql1 = "insert into user_log(logid , user_cd , datetime,Franc_id) values('$row[menu_code]' , '$_SESSION[$SESSION_EmpCode]' , now(),'$_SESSION[$SESSION_Franchisee]')"; else $sql1 = "insert into user_log(logid , user_cd , datetime) values('$row[menu_code]' , '$_SESSION[$SESSION_EmpCode]' , now())"; exec_query($sql1); } } function time_diff($from, $to) { if ($from > $to) { $t = $to; $to = $from; $from = $t; } $year1 = date("Y", $from); $year2 = date("Y", $to); /* $month1 = date("n", $from); $month2 = date("n", $to); $day1 = date("j", $from); $day2 = date("j", $to); */ $day1 = date("n", $from); $day2 = date("n", $to); $month1 = date("j", $from); $month2 = date("j", $to); if ($day2 < $day1) { if (($month2 - 1) == 4 || ($month2 - 1) == 6 || ($month2 - 1) == 9 || ($month2 - 1) == 11) { $day2 += 30; $month2 --; } else if (($month2 - 1) == 2) { if (date("L", $to)) { $day2 += 29; $month2 --; } else { $day2 += 28; $month2 --; } } else { $day2 += 31; $month2 --; } } $days = $day2 - $day1; if ($month2 < $month1) { $month2 += 12; $year2 --; } $months = $month2 - $month1; $years = $year2 - $year1; return "$years years, $months months, $days days"; } function format_normal_date($dt) { $dt_arr=explode("-",$dt); $normal_dt=$dt_arr[2]."-".$dt_arr[1]."-".$dt_arr[0]; return($normal_dt); } function format_normal_date1($dt) { $dt_arr=explode("-",$dt); //print_r($dt_arr); $normal_dt=$dt_arr[1]."-".$dt_arr[2]."-".$dt_arr[0]; return($normal_dt); } function show_admin_menu() { global $SESSION_TYPE; //ganesh code $type=$_SESSION[$SESSION_TYPE]; if($type!='') { $qryfet=mysql_query("select * from user_type_mast where user_type_id='$type'"); $rsfet=mysql_fetch_object($qryfet); echo mysql_error(); $t=$rsfet->user_type_desc; $qrymenu=mysql_query("select * from user_menu_rights where user_type_id='$type'"); $rsmenu=mysql_fetch_object($qrymenu); $str1=$rsmenu->Menu_rights; $str2=explode(",",$str1); for($i=0;$i$rs1->menu_desc |"; } //code added by ganesh } } function fetch_me($table1,$fld1,$fldname,$fldvalue,$table2='',$joincondn='') { if($table2=="") { $fquery="select $fld1 from $table1 where $fldname='$fldvalue'"; } else { $fquery="select $fld1 from $table1 inner join $table2 on $joincondn where $fldname='$fldvalue'"; } $fresult=mysql_query($fquery) or die(mysql_error()); $frs=mysql_fetch_array($fresult); //print $fquery; //print $frs[0]; return $frs[0]; } function update_rec($table_name) { //global } function calc_avg($param_id,$mod_id,$month_param) { /* $avg_qry="select sum(param_value) from data_rec_trans inner join data_rec_mast on data_rec_trans.data_id=data_rec_trans.data_id where month(recordingdate)='$month_param' and param_id='$param_id' and mod_id=''"; */ } function shownew($stationname,$stationid,$mod_id) { global $month,$Months; //$mod_id="0000000004"; $year=date("Y"); $t1=$year."-".$month."-01"; $tot=date("t",$t); $t2=$year."-".$month."-".$tot; $param_query="select Parameter_definition.param_id,param_display,param_unit from Parameter_module inner join Parameter_definition on Parameter_module.param_id=Parameter_definition.param_name where module_id='$mod_id' order by sequence"; $param_result=mysql_query($param_query); $param_count=mysql_num_rows($param_result); $qry=mysql_query("select type,param_id,station_id,city_id,type,location,param_value,recordingdate from data_rec_mast inner join data_rec_trans on data_rec_mast.data_id=data_rec_trans.data_id where mod_id='$mod_id' and month(recordingdate)=$month group by recordingdate,param_id order by recordingdate,data_trans_id") or die(mysql_error()); print "

Ambient Air Quality Monitored at: $stationname Junction
For ".$Months[$month].""; print "
"; print ""; print ""; $ind=0; $param_array=Array(); while($rs_param=mysql_fetch_object($param_result)) { $param_array[$ind]=$rs_param->param_id; if($param_id!="") $param_id=$param_id.",'".$rs_param->param_id."'"; else $param_id="'".$rs_param->param_id."'"; print ""; $qrylev=mysql_query("select * from param_standard where param_id in ($param_id) and type_id='0000000002'") or die(mysql_error()); // $qrylev=mysql_query("select * from param_standard where param_id in ($param_id) and type_id='0000000001'") or die(mysql_error()); print ""; $recdate=$rs->recordingdate; $station=$rs->station_id; print ""; else print ""; } print ""; print ""; print ""; } $qry=mysql_query("select param_id,station_id,city_id,Type,location,min(param_value) as min,max(param_value) as max,avg(param_value) as avg from data_rec_mast inner join data_rec_trans on data_rec_mast.data_id=data_rec_trans.data_id where mod_id='$mod_id' and month(recordingdate)=$month and param_value > 0 group by mod_id,param_id order by data_trans_id,recordingdate"); while($rs=mysql_fetch_object($qry)) { $type=$rs->Type; $avg_arr[$rs->param_id]["min"]=$rs->min; $avg_arr[$rs->param_id]["max"]=$rs->max; $avg_arr[$rs->param_id]["avg"]=$rs->avg; } print ""; for($ind=0;$ind".$avg_arr[$ind1]["min"]; print "
Sr.
No.
Date$rs_param->param_display
($rs_param->param_unit)"; $ind++; } print "
Standards"; $param_std_arr=Array(); while($rs_std=mysql_fetch_object($qrylev)) { $param_std_arr[$rs_std->param_id]=$rs_std->std_value; } for($ind=0;$ind$param_std_arr[$ind1]"; } while($rs_param=mysql_fetch_object($param_result)) { print "$rs_param->param_id"; } $recdate=""; $reccount=1; $station=""; while($rs=mysql_fetch_object($qry)) { if($recdate!=$rs->recordingdate) { print "
$reccount"; print "".format_normal_date($rs->recordingdate); $reccount++; } $qrylev=mysql_query("select * from param_standard where param_id='$rs->param_id' and type_id='$rs->type'"); $rslev=mysql_fetch_object($qrylev); if($rs->param_value==0) { $fnt="000000"; } else { if($rslev->std_value!='') { if($rslev->std_value>=$rs->param_value) $fnt='#009900'; else $fnt='#ff0000'; } else $fnt='#000000'; } if ($rs->param_value>0) print "$rs->param_valueNA
Monthly Statistics"; for($i=0;$i<$param_count;$i++) { print "MinMaxAvg
".$avg_arr[$ind1]["max"]; print ""; if($avg_arr[$ind1]["avg"]==0) print "NA"; else print number_format($avg_arr[$ind1]["avg"],2); } $readingcount=mysql_num_rows($qry); print "
"; } function start_html1() { global $DB, $lid; ?>
 
NIMA-DMS"; print ""; print ""; print ""; print ""; print ""; print ""; } // ******************** print "
"; print "Home "; $sql="select Menu_rights from Employee_menu_rights where user='$lid'"; //print $sql; $result=exec_query($sql); $row=$result->fetchrow(DB_FETCHMODE_ASSOC); $rights=unserialize($row[Menu_rights]); if($rights =='') { print "
No Rights assigned ...!!
"; } else { foreach($rights as $dim1) { foreach($dim1 as $arrvalue) { //print $arrvalue; if ($arrvalue!="") { if($mystr!="") $mystr=$mystr.",".$arrvalue; else $mystr=$arrvalue; } } } //print $queryvar; $queryvar="select * from user_rights where menu_code in($mystr) and parent='2'"; $qry=mysql_query($queryvar) or die(mysql_error()); while($rs=mysql_fetch_object($qry)) { print "
prg>$rs->menu_desc   "; } print "Logout

"; } function fetch_me_new($fquery) { $fresult=mysql_query($fquery) or die(mysql_error()); $frs=mysql_fetch_array($fresult); return $frs[0]; } function chk_auth() { global $lid,$ltype,$cur_userid, $auth_admin; if($auth_admin=='') { ?> query($sql); $result=mysql_query($sql) or die(mysql_error()); if($debug==1) print "
$sql"; //check_error($result,$recname); return $result; } ?>