ClsBase($connect,$include_path,"ClsOther"); $this->SetNullVars(); } function SetNullVars() { $this->action=""; $this->product_name=""; $this->sess_id=0; $this->arrsess_id=array(); $this->unit=0; $this->qty=0; $this->product_id=0; $this->fibreglassqty=0; $this->fibreglassunit=0; $this->mineralwoolqty =0; $this->mineralwoolunit=0; $this->bitumenqty =0; $this->bitumenunit =0; $this->tikiplastqty =0; $this->tikiplastunit =0; $this->tikibondqty=0; $this->tikibondunit=0; $this->tikiflashqty=0; $this->tikiflashunit=0; $this->tikirbaqty=0; $this->tikirbaunit=0; $this->ancillariesqty=0; $this->ancillariesunit=0; } function SetGetVars() { parent::SetGetVars(); } function SetPostVars() { parent::SetPostVars(); if(isset($_POST["ClsOther_arrmember_id"])) $this->arrmember_id = $_POST["ClsOther_arrmember_id"]; //echo "post--".$this->arrstudent_id[0]; if(isset($_POST['ClsOther_action'])) $this->action=$_POST['ClsOther_action']; if(isset($_POST['ClsOther_hdnaction'])) $this->hdnaction=$_POST['ClsOther_hdnaction']; if(isset($_POST["product"])) $this->product_name = $_POST["product"]; if(isset($_POST["ClsOther_sess_id"])) $this->sess_id = $_POST["ClsOther_sess_id"]; if(isset($_POST["ClsOther_product_id"])) $this->product_id = $_POST["ClsOther_product_id"]; if(isset($_POST["ClsOther_fibreglassqty"])) $this->fibreglassqty= $_POST["ClsOther_fibreglassqty"]; if(isset($_POST["ClsOther_fibreglassqty"])) $this->fibreglassunit= $_POST["ClsOther_fibreglassunit"]; if(isset($_POST["ClsOther_mineralwoolqty"])) $this->mineralwoolqty= $_POST["ClsOther_mineralwoolqty"]; if(isset($_POST["ClsOther_mineralwoolunit"])) $this->mineralwoolunit = $_POST["ClsOther_mineralwoolunit"]; if(isset($_POST["ClsOther_bitumenqty"])) $this->bitumenqty = $_POST["ClsOther_bitumenqty"]; if(isset($_POST["ClsOther_bitumenunit"])) $this->bitumenunit = $_POST["ClsOther_bitumenunit"]; if(isset($_POST["ClsOther_tikiplastqty"])) $this->tikiplastqty = $_POST["ClsOther_tikiplastqty"]; if(isset($_POST["ClsOther_tikiplastunit"])) $this->tikiplastunit = $_POST["ClsOther_tikiplastunit"]; if(isset($_POST["ClsOther_tikibondqty"])) $this->tikibondqty= $_POST["ClsOther_tikibondqty"]; if(isset($_POST["ClsOther_tikibondunit"])) $this->tikibondunit= $_POST["ClsOther_tikibondunit"]; if(isset($_POST["ClsOther_tikiflashqty"])) $this->tikiflashqty = $_POST["ClsOther_tikiflashqty"]; if(isset($_POST["ClsOther_tikiflashunit"])) $this->tikiflashunit = $_POST["ClsOther_tikiflashunit"]; if(isset($_POST["ClsOther_tikirbaqty"])) $this->tikirbaqty = $_POST["ClsOther_tikirbaqty"]; if(isset($_POST["ClsOther_tikirbaunit"])) $this->tikirbaunit = $_POST["ClsOther_tikirbaunit"]; if(isset($_POST["ClsOther_ancillariesqty"])) $this->ancillariesqty = $_POST["ClsOther_ancillariesqty"]; if(isset($_POST["ClsOther_ancillariesunit"])) $this->ancillariesunit = $_POST["ClsOther_ancillariesunit"]; } //function SaveData($memberid) function SaveData($productid) { if($this->fibreglassqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->fibreglassqty', '$this->fibreglassunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->mineralwoolqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->mineralwoolqty', '$this->mineralwoolunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->bitumenqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->bitumenqty', '$this->bitumenunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->tikiplastqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->tikiplastqty', '$this->tikiplastunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->tikibondqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->tikibondqty', '$this->tikibondunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->tikiflashqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->tikiflashqty', '$this->tikiflashunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->tikirbaqty!= 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->tikirbaqty', '$this->tikirbaunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->ancillariesqty!= 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->ancillariesqty', '$this->ancillariesunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } /* else { $Query =" UPDATE membership SET member_name='$this->member_name', address ='$this->address',address ='$this->address', residence_num='$this->residence_number',mobile='$this->mobile', office_num='$this->office_number',email='$this->email',year='$this->year', occupation='$this->occupation',hobbies='$this->hobbies', achivements='$this->achivements',fees = '$this->fees' WHERE member_id = $memberid"; $dbqry = new DbQuery($Query, $this->connect->connid); header("location: displaymember.php"); }*/ // return (!(is_array($this->error) and count($this->error)>0)); } function DeleteData($stradminid) { //echo "vinit".$stradminid; $Query = "DELETE FROM membership WHERE member_id IN ($stradminid) "; $dbqry = new DbQuery($Query, $this->connect->connid); } function RetriveData($sess_id) { //echo "Call Retrieve"; $Query =" SELECT * FROM cart WHERE sess_id = $sess_id"; $dbqry = new DbQuery($Query, $this->connect->connid); if($dbqry->NumRows() > 0) { $row = $dbqry->GetRowArray(); //$this->student_id = $this->InitNullVar($row["student_id"]); $this->member_name = trim($this->InitNullVar($row["member_name"],"")); $this->address = trim($this->InitNullVar($row["address"],"")); //echo "R_add".$this->address; $this->residence_number = trim($this->InitNullVar($row["residence_num"],0)); $this->mobile = trim($this->InitNullVar($row["mobile"],0)); $this->office_number = trim($this->InitNullVar($row["office_num"],0)); $this->email = trim($this->InitNullVar($row["email"],"")); $this->year = trim($this->InitNullVar($row["year"],"")); $this->occupation = trim($this->InitNullVar($row["occupation"],"")); $this->hobbies = trim($this->InitNullVar($row["hobbies"],"")); $this->fees = trim($this->InitNullVar($row["fees"],"")); } return $dbqry->NumRows(); } function CheckLogin($username,$password) { $Query = " SELECT * FROM admin_user WHERE username='$username' AND password='$password' "; $dbqry = new DbQuery($Query, $this->connect->connid); if($dbqry->NumRows()) { $row = $dbqry->GetRowArray(); // session_start(); $_SESSION["student_id"] = $row["student_id"]; $_SESSION["AdminName"]= $row["adminname"]; } return $dbqry->NumRows(); } function PageLogin() { $this->SetGetVars(); $this->SetPostVars(); if(!$this->submitted) return; if($this->action=="LI") { if(!$this->CheckLogin($this->username,$this->password)) header("location: index.php?err=".urlencode("Invalid username/password")); } } function PageLogout() { session_unset(); session_destroy(); header("location: index.php"); die(); } function PageAdminMail() { $this->SetGetVars(); $this->SetPostVars(); //if(!$this->submitted) return; //echo "hi"; if($this->action == "S") { $this->SaveData($this->mail_id); header("location: confirm.php"); } } function GetData($ssid) { //echo "call"; $retarray = array(); $this->SetGetVars(); $this->SetPostVars(); $Query = "SELECT * FROM cart WHERE sess_id = '$ssid'"; //$Query = "SELECT * FROM cart"; $dbqry = new DbQuery($Query, $this->connect->connid); //echo $Query; if($dbqry->NumRows() > 0) { while($row = $dbqry->GetRowArray()) { $retarray[$row["idn"]] = array("product_id"=>$row["idn"], "product_name"=>$row["product_name"], "qty"=>$row["qty"], "unit"=>$row["unit"]); } } return $retarray; } function PageCart() { //echo "Class"; $this->SetGetVars(); $this->SetPostVars(); //if(!$this->submitted) return; if($this->action == "E") $this->RetriveData($this->member_id); if($this->action == "S") { $this->SaveData($this->product_id); header("location: cart_inquiry.php"); } } function PageDisplayMember() { $retarray = array(); //$this->SetNullVars(); $this->SetGetVars(); $this->SetPostVars(); $temp = $this->searchpage_year; // echo " Year==".$temp; $Query = "SELECT COUNT(*) as cnt FROM membership WHERE year = '$temp'"; $dbqry = new DbQuery($Query, $this->connect->connid); if($dbqry->NumRows() > 0) { $row = $dbqry->GetRowArray(); $totalrecord = $row["cnt"]; } $this->GetPageNavigation($totalrecord, $this->perpagerecord, $this->currentpage, $this->recordfrom, $this->recordto, $limit, $this->numofpages); if($temp != "") { $Query = "SELECT member_id,member_name,email,mobile,office_num,residence_num FROM membership WHERE year = '$temp'".$limit; //echo "gg==".$Query; //echo " Limit==".$limit; $dbqry = new DbQuery($Query, $this->connect->connid); if($dbqry->NumRows() > 0) { while($row = $dbqry->GetRowArray()) { // echo " name==".$row["member_name"]; $retarray[$row["member_id"]] = array("member_id"=>$row["member_id"], "member_name"=>$row["member_name"], "email"=>$row["email"], "mobile"=>$row["mobile"], "residence_num"=>$row["residence_num"], "office_num"=>$row["office_num"], ); } } } return $retarray; } function PageDisplaystudent() { $this->SetNullVars(); $this->SetGetVars(); $this->SetPostVars(); //if(!$this->submitted) return; // echo "Action---".$this->action; if($this->hdnaction == "D") { // echo "action delete ".arrstudent_id; if(is_array($this->arrmember_id) && count($this->arrmember_id)) { // echo "gg".$this->arrmember_id[0]; $stridn=""; foreach($this->arrmember_id as $row) { if($row!=0) $stridn = $row.",".$stridn; } if(strlen($stridn)) $stridn = substr($stridn,0,strlen($stridn)-1); //echo "acsdsgd".$stridn; $this->DeleteData($stridn); $this->DisplayMessage= "Delete Data Successfully."; } } } }// end of class. ?>