file_names=$pt[$totpt-1]; } ////////////// END OF FILE_NAME FUNCTION/////////////////// ////////////// DISPLAY THE NUMERIC PAGING WITHOUT RECORD DETAIL/////////////////// function number_pageing_nodetail($query,$record_per_page='',$pages='') { return $this->number_pageing($query,$record_per_page,$pages,"N"); } function number_pageing_bottom_nodetail($query,$record_per_page='',$pages='') { return $this->number_pageing($query,$record_per_page,$pages,"N","Y"); } function number_pageing_bottom($query,$record_per_page='',$pages='') { return $this->number_pageing($query,$record_per_page,$pages,"","Y"); } ////////////// END OF NUMERIC PAGING FUNCTION /////////////////// function runquery($query) { return mysql_query($query); } function table($result,$titles,$fields,$passfield="",$edit,$delete,$parent="") { if($parent=="") $parent="Y"; if($passfield=="") $passfield="id"; $cont=""; foreach($titles as $K=>$V) { $cont1.="$K":" align='center'>$V"; } $cont.=$cont1.""; $cont.=""; $j=0; while($gets=mysql_fetch_object($result)) { $j=1; $cont.=""; foreach($fields as $K=>$V) { $cont.=""; } $cont.=""; $cont.=""; } if($j==0) { $cont.=""; } echo $cont.="
"; $tmps=explode(",",$V); $newval=""; foreach($tmps as $val) { $newval.=$gets->$val." "; } $cont.=(is_numeric($K))?$newval:"".$newval.""; $cont.=" $passfield."'\" value='Edit' onMouseOver=\"smsg('Edit This Record -> $newval');return document.prs_return\" onMouseOut=\"nosmsg('Done');return document.prs_return\">   $newval');return document.prs_return\" onMouseOut=\"nosmsg('Done');return document.prs_return\"> 
No Record To Display
"; } ///////////// NUMERIC FUNCTION WITH RECORD DESTAIL////////////////////////////////////// function number_pageing($conn,$query,$record_per_page='',$pages='',$detail='',$bottom='',$simple='') { $this->file_names(); $this->query=$query; if($record_per_page>0){ $this->record_per_page=$pages; $this->pages=$record_per_page; } $result = $conn->query($this->query); $totalrows= $result->rowCount(); $start=$this->start(); $data=$this->data(); $order=$_GET['order']; if($data=="data"){ $this->query.=" "; }else{ $this->query.=" limit $start,".$this->record_per_page; } $result = $conn->query($this->query); $total= $result->rowCount(); $total_pages=ceil($totalrows/$this->record_per_page); $current_page=($start+$this->record_per_page)/$this->record_per_page; $loop_counter=ceil($current_page/$this->pages); //Remove this comment so it will display the page number as per ur defined gape like 1,2,3,4,5 then 6,7,8,9,10 likewise.. //$start_loop=($loop_counter*$this->pages-$this->pages)+1; //$end_loop=($this->pages*$loop_counter)+1; $start_loop=($loop_counter*$this->pages-$this->pages)-2; if($start_loop<=0) $start_loop=1; $end_loop=($this->pages*$loop_counter)+4; if($end_loop>$total_pages) $end_loop=$total_pages+1; $tmpva=""; foreach($_GET as $V=>$K) { if($V!="start" and $V!="msg" and $V!="all" and $V!="filename" and $K!='all') $tmpva.="&".$V."=".$K; } $this->tbl="
"; if($detail!="N" and $simple !="N") $this->tbl.="Displaying ".($start+1)." - ".($start+$total)." of ".$totalrows." Records
"; $this->tbl.="View All  "; if($start>0) { $this->tbl.=""; } $this->tbl.=" "; if($simple!='N') { for($i=$start_loop;$i<$end_loop;$i++) { if($i%30==0){$this->tbl.="
";} if($current_page==$i) { $this->tbl.="  [".$i."]"; } else { $this->tbl.="  ".$i.""; } } } $this->tbl.=""; if($start+$this->record_per_page<$totalrows) { $this->tbl.="  "; } $this->tbl.="
"; if($bottom=="Y") { if($totalrows>0) return $result=array($result,$this->tbl); else return $result=array($result,""); } else { if($totalrows>0) { echo $this->tbl; return $result; } else { return $result; } } } function number_pageing_ajax($conn,$query,$record_per_page='',$pages='',$detail='',$bottom='',$simple='') { $this->file_names(); $this->query=$query; if($record_per_page>0){ $this->record_per_page=$pages; $this->pages=$record_per_page; } $result = $conn->query($this->query); $totalrows= $result->rowCount(); $start=$this->start(); $data=$this->data(); $order=$_GET['order']; if($data=="data"){ $this->query.=" "; }else{ $this->query.=" limit $start,".$this->record_per_page; } $result = $conn->query($this->query); $total= $result->rowCount(); $total_pages=ceil($totalrows/$this->record_per_page); $current_page=($start+$this->record_per_page)/$this->record_per_page; $loop_counter=ceil($current_page/$this->pages); //Remove this comment so it will display the page number as per ur defined gape like 1,2,3,4,5 then 6,7,8,9,10 likewise.. //$start_loop=($loop_counter*$this->pages-$this->pages)+1; //$end_loop=($this->pages*$loop_counter)+1; $start_loop=($loop_counter*$this->pages-$this->pages)-2; if($start_loop<=0) $start_loop=1; $end_loop=($this->pages*$loop_counter)+4; if($end_loop>$total_pages) $end_loop=$total_pages+1; $tmpva=""; foreach($_GET as $V=>$K) { if($V!="start" and $V!="msg" and $V!="all" and $V!="filename" and $K!='all') $tmpva.="&".$V."=".$K; } $this->tbl="
"; if($detail!="N" and $simple !="N") $this->tbl.="Displaying ".($start+1)." - ".($start+$total)." of ".$totalrows." Records
"; $this->tbl.="View All  "; if($start>0) { $this->tbl.="record_per_page)."','')\" class='tab2'>"; } $this->tbl.=" "; if($simple!='N') { for($i=$start_loop;$i<$end_loop;$i++) { if($i%30==0){$this->tbl.="
";} if($current_page==$i) { $this->tbl.="  [".$i."]"; } else { $this->tbl.="  record_per_page."','')\" class='tab2'>".$i.""; } } } $this->tbl.=""; if($start+$this->record_per_page<$totalrows) { $this->tbl.="  record_per_page)."','')\" class='tab2'>"; } $this->tbl.="
"; if($bottom=="Y") { if($totalrows>0) return $result=array($result,$this->tbl); else return $result=array($result,""); } else { if($totalrows>0) { echo $this->tbl; return $result; } else { return $result; } } } function number_pageing_post($conn,$query,$record_per_page='',$pages='',$detail='',$bottom='',$simple='') { $this->file_names(); $this->query=$query; if($record_per_page>0){ $this->record_per_page=$pages; $this->pages=$record_per_page; } $result = $conn->query($this->query); $totalrows= $result->rowCount(); if($_POST['txtpage']!="") $start=($_POST['txtpage']-1)*20; else $start=$this->start_post(); $data=$this->data_post(); $order=$_GET['order']; if($data=="data"){ $this->query.=" "; }else{ $this->query.=" limit $start,".$this->record_per_page; } $result = $conn->query($this->query); $total= $result->rowCount(); $total_pages=ceil($totalrows/$this->record_per_page); $current_page=($start+$this->record_per_page)/$this->record_per_page; $loop_counter=ceil($current_page/$this->pages); //Remove this comment so it will display the page number as per ur defined gape like 1,2,3,4,5 then 6,7,8,9,10 likewise.. //$start_loop=($loop_counter*$this->pages-$this->pages)+1; //$end_loop=($this->pages*$loop_counter)+1; $start_loop=($loop_counter*$this->pages-$this->pages)-2; if($start_loop<=0) $start_loop=1; $end_loop=($this->pages*$loop_counter)+4; if($end_loop>$total_pages) $end_loop=$total_pages+1; $numof_pages = 20; $current_section = ceil($current_page / $numof_pages) - 1; $start_loop = ($current_section * $numof_pages) + 1; $end_loop = ($start_loop + $numof_pages); $lastpage = ceil($totalrows/$numof_pages); $last_section = ceil($lastpage / $numof_pages) - 1; $tmpva=""; foreach($_GET as $V=>$K){ if($V!="start" and $V!="msg" and $V!="all" and $V!="filename" and $K!='all') $tmpva.="&".$V."=".$K; } $this->tbl="
"; if($detail!="N" and $simple !="N") $this->tbl.="Displaying ".($start+1)." - ".($start+$total)." of ".$totalrows." Records
"; $this->tbl.="View All  "; if($current_section>0) { $this->tbl.=" "; $this->tbl.=""; } $this->tbl.=" "; if($simple!='N'){ for($i=$start_loop;$i<$end_loop;$i++) { if($i<=$lastpage) { //if($i%30==0){$this->tbl.="
";} if($current_page==$i){ $this->tbl.="  [".$i."]"; }else{ /*$this->tbl.="  record_per_page."','')\" class='tab2'>".$i.""; */ $this->tbl.="  record_per_page."','')\" class='tab2'>".$i.""; } } } } $this->tbl.=""; if($current_section<$last_section){ $this->tbl.="  "; } $this->tbl.=" "; $this->tbl.=" of ".$lastpage."
"; if($bottom=="Y"){ if($totalrows>0) return $result=array($result,$this->tbl); else return $result=array($result,""); }else{ if($totalrows>0){ echo $this->tbl; return $result; }else{ return $result; } } } ////////////// SIMPLE NEXT-PRI PAGING /////////////////// function pageing($query,$record_per_page="",$pages="") { return $this->number_pageing($query,$record_per_page,$pages,'','','N'); } ////////////// END OF SIMPLE PAGING FUNCTION/////////////////// ////////////// WRITE ALL,A TO Z CHARACTER WITH CURRENT PAGE LINK /////////////////// function order($id='') { $this->file_names(); $ProductId = $this->getproductid(); $catid = $this->getcatid(); if($ProductId) { $this->order.="All|"; }elseif($catid){ $this->order.="All|"; }else{ $this->order.="All|"; } for($i=65;$i<91;$i++) { if($ProductId) { $this->order.="".chr($i)."|"; } elseif($catid) { $this->order.="".chr($i)."|"; } else { $this->order.="".chr($i)."|"; } } return $this->order.=""; } function order_ajax() { $this->file_names(); $this->order.="All|"; for($i=65;$i<91;$i++) { $this->order.="".chr($i)."|"; } return $this->order.=""; } function order_post() { $this->file_names(); $this->order.="All|"; for($i=65;$i<91;$i++) { $this->order.="".chr($i)."|"; } return $this->order.=""; } function MakeCombo($query,$value="",$fill_value,$comboname,$selected="") { if($value=="") $value=$fill_value; $run=$this->runquery($query); $totlist=mysql_affected_rows(); $Combo=""; echo $Combo; } } $prs_pageing= new get_pageing; function run($query) { return mysql_query($query); } function addlink($title,$file,$class="") { $str="0)?" class='$class'":""; $str.=" onMouseOver=\"smsg('$title');return document.prs_return\" onMouseOut=\"nosmsg('Done');return document.prs_return\">$title"; echo $str; } /*function CountryCombo($query="",$value="",$fill_value="",$combo_name="",$selected="") { if($query=="") $query="select * from country order by plid asc, name asc"; if($fill_value=="") $fill_value="name"; if($value=="") $value=$fill_value; if($combo_name=="") $combo_name="country"; $prs_pageing= new get_pageing; $prs_pageing->MakeCombo($query,$value,$fill_value,$combo_name,$selected); }*/ function ads($str) { return $newstr=htmlentities($str,ENT_QUOTES); } function rms($str) { return $newstr=stripslashes($str); } ////////////// END OF ORDER FUNCTION/////////////////// function getimage($nm,$mywidth,$myheight,$text="") { if(is_file($nm)) { echo $nm; }else { $nm1 = "images/noimage.jpg"; echo "sample.php?nm=$nm1&mwidth=$mywidth&mheight=$myheight&text=$text"; } //echo "sample.php?nm=$nm&mwidth=$mywidth&mheight=$myheight&text=$text"; } function getuser($condition="",$return_true,$return_false="",$tbl="") { if($condition=="") $condition="id=".$_COOKIE["UID"]; if($tbl=="") $seluser="select * from users"; else $seluser="select * from $tbl"; $seluser.=" where $condition"; $runuser=run($seluser); echo mysql_error(); $totuser=mysql_affected_rows(); if($totuser>0) { $getuser=mysql_fetch_object($runuser); return $getuser->$return_true; } else { if($return_false=="") return 0; else return $return_false; } } function getvalue($tbl,$condition="",$return_true,$return_false="") { $values=getuser($condition,$return_true,$return_false,$tbl); return $values; } ////////// functions used in bid section//////////////////////////////// function bidprovider($UserId) { $query=mysql_query("select * from users where id ='$UserId'"); $row=mysql_fetch_array($query); $provider_status=stripslashes($row["provider_info"]); $providername =stripslashes($row["memberid"]); $since =stripslashes($row["since"]); $licensed =stripslashes($row["licensed"]); $bonded =stripslashes($row["bonded"]); $insured =stripslashes($row["insured"]); $email =stripslashes($row["email"]); $address =stripslashes($row["address"]); $city =stripslashes($row["city"]); $state =stripslashes($row["state"]); $zip =stripslashes($row["zip"]); $phone =stripslashes($row["phone"]); $id =stripslashes($row["id"]); $returnprovider[0]=$provider_status; $returnprovider[1]=$providername; $returnprovider[2]=$since; $returnprovider[3]=$licensed; $returnprovider[4]=$bonded; $returnprovider[5]=$insured; $returnprovider[6]=$email; $returnprovider[7]=$address; $returnprovider[8]=$city; $returnprovider[9]=$state; $returnprovider[10]=$zip; $returnprovider[11]=$phone; $returnprovider[12]=$id; return $returnprovider; } function checkbidstatus($pid) { $bidErr=0; $bidRedirectError=0; $UserId=$_SESSION["UID"]; $today=date('Y-m-d'); $query=mysql_query("select *,timediff( bid_close, NOW( ) ) as timeleft from projects where id ='$pid'"); $row=mysql_fetch_array($query); $bidclose=$row["bid_close"]; //$daysleftforbid=dateDiff($today,$bidclose); $provider=$row["pr_uid"]; $ownerid=$row["ow_uid"]; $completed=$row["completed"]; $cancel=$row["cancel"]; $timeleft=$row["timeleft"]; if($_SESSION["UID"]) { /* $userquery="select d.id as disid,d.bid as bidstatus,d.b_no as bidno,d.months as monthstatus, d.m_no as monthno, ul.lid as ulevel,ul.fee as ufee,ul.mdated as memberdate,ul.duration as uduration from discount as d inner join users as u on u.discount=d.id inner join user_level as ul on u.id=ul.uid where u.id='$UserId'"; $userresult=mysql_query($userquery); $userrow=mysql_fetch_array($userresult); $userlevel=$userrow["ulevel"]; $ufee=$userrow["ufee"]; $disid=$userrow["disid"]; $bidstatus=$userrow["bidstatus"]; $bidno=$userrow["bidno"]; $monthstatus=$userrow["monthstatus"]; $monthno=$userrow["monthno"]; $uduration=$userrow["uduration"]; $memberdate=$userrow["memberdate"]; if($memberdate!="") { $memberdate1=explode("-",$memberdate); $year=$memberdate1[0]; $mon=$memberdate1[1]; $days=$memberdate1[2]; $memberforbidexpirydate = date("Y-m-d",mktime(0, 0, 0, date($mon)+$monthno , date($days), date($year))); $memberfreeaccountexpirydate = date("Y-m-d",mktime(0, 0, 0, date($mon)+$uduration , date($days), date($year))); } if($userlevel==0||$ufee==0) { if($bidstatus=='Y') { $bidquery="select * from bids where uid='$UserId'"; $bidresult=mysql_query($bidquery); $bidtot=mysql_affected_rows(); if($bidtot>=$bidno) { //$bidErr=6; } } if($monthstatus=='Y') { $totaldays=dateDiff($today,$memberforbidexpirydate); if($totaldays<=0) { //$bidErr=6; } } $daysremainingforfreeaccount=dateDiff($today,$memberfreeaccountexpirydate); if($daysremainingforfreeaccount<=0 and $memberfreeaccountexpirydate!="") { //$bidErr=6; } }*/ $selbids="select * from bids where pid='$pid' and uid='$UserId'"; $runbids=mysql_query($selbids); $totbids=mysql_affected_rows(); if($totbids>0) { $bidErr=7; } } if($timeleft<"00:00:00" && $provider>0) { $bidErr=1; } else if($timeleft<"00:00:00") { $bidErr=2; } else if($provider>0) { $bidErr=3; } else if($cancel=='Y') { $bidErr=4; } else if($ownerid==$_SESSION["UID"]) { $bidErr=5; } if($bidErr>0) { return $bidErr; } else { /*echo ""*/; } } function unixTm($strDT) { $arrDT = explode(" ", $strDT); $arrD = explode("-", $arrDT[0]); $arrT = explode(":", $arrDT[1]); return mktime($arrT[0], $arrT[1], $arrT[2], $arrD[1], $arrD[2], $arrD[0]); } function dateDiff($date1,$date2) { $dt2=unixTm($date2); $dt1=unixTm($date1); $r = $dt2 - $dt1; // $dd=floor($r / 86400) ; $dd=ceil($r / 86400) ; //if ($dd<=9) $dd="0".$dd ; $r=$r % 86400 ; $hh=floor($r/3600) ; if ($hh<=9) $hh=$hh ; $r=$r % 3600 ; $mm=floor($r/60) ; if ($mm<=9) $mm="0".$mm ; $r=$r % 60 ; $ss=$r ; if ($ss<=9) $ss="0".$ss ; if(!$hh) $hh="0"; echo $retval=$dd; //$retval="$hh:$mm:$ss" ; //$retval="$hh"; return $retval; // $d2=date("Y-m-d H:i:s") ; // $d1="2003-02-17 01:01:01" ; // $diff = dateDiff($d1, $d2) ; } function fetchValue($table,$where,$id,$name) { $getsql = "select $name from $table where $where='$id'"; $getres = mysql_query($getsql); $getobj = mysql_fetch_array($getres); return stripslashes($getobj[0]); } function getComboData($tablename, $curselection) { $sqlComboData ="select * from ". $tablename." order by id"; $returnContent =""; $resComboData=mysql_query($sqlComboData); $totComboData=mysql_affected_rows(); $i=0; for($i=0;$i<$totComboData;$i++) { $recComboData=mysql_fetch_array($resComboData); $fieldValue=$recComboData[0]; $fieldDisplay=$recComboData[1]; $returnContent .="