ClsBase($connect,$include_path,"ClsThermocole"); $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->thermosheetqty =0; $this->thermosheetunit =0; } function SetGetVars() { parent::SetGetVars(); } function SetPostVars() { parent::SetPostVars(); if(isset($_POST["ClsThermocole_arrmember_id"])) $this->arrmember_id = $_POST["ClsThermocole_arrmember_id"]; //echo "post--".$this->arrstudent_id[0]; if(isset($_POST['ClsThermocole_action'])) $this->action=$_POST['ClsThermocole_action']; if(isset($_POST['ClsThermocole_hdnaction'])) $this->hdnaction=$_POST['ClsThermocole_hdnaction']; if(isset($_POST["product"])) $this->product_name = $_POST["product"]; if(isset($_POST["ClsThermocole_sess_id"])) $this->sess_id = $_POST["ClsThermocole_sess_id"]; if(isset($_POST["ClsThermocole_qty"])) $this->qty = $_POST["ClsThermocole_qty"]; if(isset($_POST["ClsThermocole_unit"])) $this->unit = $_POST["ClsThermocole_unit"]; if(isset($_POST["ClsThermocole_product_id"])) $this->product_id = $_POST["ClsThermocole_product_id"]; if(isset($_POST["ClsThermocole_qtythermosheets"])) $this->thermosheetqty = $_POST["ClsThermocole_qtythermosheets"]; if(isset($_POST["ClsThermocole_unitthermosheets"])) $this->thermosheetunit = $_POST["ClsThermocole_unitthermosheets"]; if(isset($_POST["ClsThermocole_qtythermopipe"])) $this->thermopipeqty = $_POST["ClsThermocole_qtythermopipe"]; if(isset($_POST["ClsThermocole_unitthermopipe"])) $this->thermopipeunit = $_POST["ClsThermocole_unitthermopipe"]; } //function SaveData($memberid) function SaveData($productid) { if($this->thermosheetqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->thermosheetqty', '$this->thermosheetunit')"; //echo $Query; $dbqry = new DbQuery($Query, $this->connect->connid); $this->product_id = $dbqry->insertid; } } if($this->thermopipeqty != 0) { if($productid <= 0) { $Query = "insert into cart(sess_id,product_name,qty,unit) values('$this->sess_id','$this->product_name','$this->thermopipeqty', '$this->thermopipeunit')"; //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. ?>