dbConnection(); $this->conn = $db; } public function runQuery($sql) { $stmt = $this->conn->prepare($sql); return $stmt; } public function lasdID() { $stmt = $this->conn->lastInsertId(); return $stmt; } public function changepwd($user,$pwd) { try { $rp = md5($pwd) ; $stmt = $this->conn->prepare("update admin set PASSWORD = :pd where USERNAME =:u"); $stmt->bindparam(":pd",$rp); $stmt->bindparam(":u",$user); //$stmt->bindparam(":us",$usa); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } //update public function stalldetails($fmn,$reg,$eno,$market,$town,$lga,$msection,$zone,$lineno,$stallno,$stype,$certno,$cdate,$basis,$po,$pn,$pd,$po2,$pn2,$pd2,$po3,$pn3,$pd3,$ansidno,$admin) { try { $td = date("Y-m-d") ; $ttm = date("h:i"); $stmt = $this->conn->prepare("INSERT INTO stall_details(formno,regno,en_no,market,town,lga,market_section,zone,line_no,stall_no,stall_type,alloc_cert_no,cdate,bas_of_occup,ansid_no,pao,pan,pad,pao2,pan2,pad2,pao3,pan3,pad3,admin,dateupdated) VALUES(:fm,:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:po,:pn,:pd,:po2,:pn2,:pd2,:po3,:pn3,:pd3,:o,:p)"); $stmt->bindparam(":fm",$fmn); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$eno); $stmt->bindparam(":c",$market); $stmt->bindparam(":d",$town); $stmt->bindparam(":e",$lga); $stmt->bindparam(":f",$msection); $stmt->bindparam(":g",$zone); $stmt->bindparam(":h",$lineno); $stmt->bindparam(":i",$stallno); $stmt->bindparam(":j",$stype); $stmt->bindparam(":k",$certno); $stmt->bindparam(":l",$cdate); $stmt->bindparam(":m",$basis); $stmt->bindparam(":n",$ansidno); $stmt->bindparam(":po",$po); $stmt->bindparam(":pn",$pn); $stmt->bindparam(":pd",$pd); $stmt->bindparam(":po2",$po2); $stmt->bindparam(":pn2",$pn2); $stmt->bindparam(":pd2",$pd2); $stmt->bindparam(":po3",$po3); $stmt->bindparam(":pn3",$pn3); $stmt->bindparam(":pd3",$pd3); $stmt->bindparam(":o",$admin); $stmt->bindparam(":p",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function stalldetailso($reg,$eno,$market,$town,$lga,$msection,$zone,$lineno,$stallno,$stype,$certno,$cdate,$basis,$po,$pn,$pd,$po2,$pn2,$pd2,$po3,$pn3,$pd3,$ansidno) { try { $td = date("Y-m-d") ; $ttm = date("h:i"); $stmt = $this->conn->prepare("INSERT INTO stall_detailso(regno,en_no,market,town,lga,market_section,zone,line_no,stall_no,stall_type,alloc_cert_no,cdate,bas_of_occup,ansid_no,pao,pan,pad,pao2,pan2,pad2,pao3,pan3,pad3,dateupdated) VALUES(:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:po,:pn,:pd,:po2,:pn2,:pd2,:po3,:pn3,:pd3,:p)"); // $stmt->bindparam(":fm",$fmn); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$eno); $stmt->bindparam(":c",$market); $stmt->bindparam(":d",$town); $stmt->bindparam(":e",$lga); $stmt->bindparam(":f",$msection); $stmt->bindparam(":g",$zone); $stmt->bindparam(":h",$lineno); $stmt->bindparam(":i",$stallno); $stmt->bindparam(":j",$stype); $stmt->bindparam(":k",$certno); $stmt->bindparam(":l",$cdate); $stmt->bindparam(":m",$basis); $stmt->bindparam(":n",$ansidno); $stmt->bindparam(":po",$po); $stmt->bindparam(":pn",$pn); $stmt->bindparam(":pd",$pd); $stmt->bindparam(":po2",$po2); $stmt->bindparam(":pn2",$pn2); $stmt->bindparam(":pd2",$pd2); $stmt->bindparam(":po3",$po3); $stmt->bindparam(":pn3",$pn3); $stmt->bindparam(":pd3",$pd3); //$stmt->bindparam(":o",$admin); $stmt->bindparam(":p",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } //update public function updatestall($fmn,$reg,$eno,$market,$town,$lga,$msection,$zone,$lineno,$stallno,$stype,$certno,$cdate,$basis,$ansidno,$po,$pn,$pd,$po2,$pn2,$pd2,$po3,$pn3,$pd3) { try { ///$td = date("Y-m-d") ; //$ttm = date("h:i"); $stmt = $this->conn->prepare("UPDATE stall_details SET formno =:fm, en_no =:b, market =:c, town =:d, lga =:e, market_section =:f, zone =:g, line_no =:h, stall_no =:i, stall_type =:j, alloc_cert_no =:k, cdate =:l, bas_of_occup =:m, ansid_no =:n,pao =:po,pan =:pn, pad =:pd ,pao2 =:po2,pan2 =:pn2, pad2 =:pd2 ,pao3 =:po3,pan3 =:pn3, pad3 =:pd3 where regno =:a"); $stmt->bindparam(":fm",$fmn); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$eno); $stmt->bindparam(":c",$market); $stmt->bindparam(":d",$town); $stmt->bindparam(":e",$lga); $stmt->bindparam(":f",$msection); $stmt->bindparam(":g",$zone); $stmt->bindparam(":h",$lineno); $stmt->bindparam(":i",$stallno); $stmt->bindparam(":j",$stype); $stmt->bindparam(":k",$certno); $stmt->bindparam(":l",$cdate); $stmt->bindparam(":m",$basis); $stmt->bindparam(":n",$ansidno); $stmt->bindparam(":po",$po); $stmt->bindparam(":pn",$pn); $stmt->bindparam(":pd",$pd); $stmt->bindparam(":po2",$po2); $stmt->bindparam(":pn2",$pn2); $stmt->bindparam(":pd2",$pd2); $stmt->bindparam(":po3",$po3); $stmt->bindparam(":pn3",$pn3); $stmt->bindparam(":pd3",$pd3); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function insertaddress($user,$res,$office,$phone,$emails,$code) { try { $stmt = $this->conn->prepare("INSERT INTO address(user_id,residence,office,phoneno,emails,tokenCode) VALUES(:fn,:ln,:cm,:ph,:cnt,:cd)"); $stmt->bindparam(":fn",$user); $stmt->bindparam(":ln",$res); $stmt->bindparam(":cm",$office); $stmt->bindparam(":ph",$phone); $stmt->bindparam(":cnt",$emails); $stmt->bindparam(":cd",$code); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function biodata($reg,$cname,$creg,$mid,$idno,$nat,$astate,$lga,$phone,$emails,$office,$admin) { $td = date("Y-m-d") ; try { $stmt = $this->conn->prepare("INSERT INTO allotee_biodata(regno,custodian,company_regno,identification_means,id_no,nationality,state,lga,allote_phone,allote_email,allote_office,admin,dateupdated) VALUES(:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m)"); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$cname); $stmt->bindparam(":c",$creg); $stmt->bindparam(":d",$mid); $stmt->bindparam(":e",$idno); $stmt->bindparam(":f",$nat); $stmt->bindparam(":g",$astate); $stmt->bindparam(":h",$lga); $stmt->bindparam(":i",$phone); $stmt->bindparam(":j",$emails); $stmt->bindparam(":k",$office); $stmt->bindparam(":l",$admin); $stmt->bindparam(":m",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function updatebio($reg,$cname,$creg,$mid,$idno,$nat,$astate,$lga,$phone,$emails,$office) { //$td = date("Y-m-d") ; try { $stmt = $this->conn->prepare("update allotee_biodata set custodian =:b,company_regno =:c, identification_means =:d, id_no =:e, nationality =:f, state =:g, lga =:h, allote_phone =:i, allote_email =:j, allote_office =:k where regno =:a") ; $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$cname); $stmt->bindparam(":c",$creg); $stmt->bindparam(":d",$mid); $stmt->bindparam(":e",$idno); $stmt->bindparam(":f",$nat); $stmt->bindparam(":g",$astate); $stmt->bindparam(":h",$lga); $stmt->bindparam(":i",$phone); $stmt->bindparam(":j",$emails); $stmt->bindparam(":k",$office); //$stmt->bindparam(":l",$admin); //$stmt->bindparam(":m",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function nextkin($reg,$name,$relation,$nphone,$admin) { $td = date("Y-m-d") ; try { $stmt = $this->conn->prepare("INSERT INTO nextofkin(regno,names,relationship,phoneno,admin,dateupdated) VALUES(:a,:b,:c,:d,:e,:f)"); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$name); $stmt->bindparam(":c",$relation); $stmt->bindparam(":d",$nphone); $stmt->bindparam(":e",$admin); $stmt->bindparam(":f",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function upatenextkin($reg,$name,$relation,$nphone) { //$td = date("Y-m-d") ; try { $stmt = $this->conn->prepare("update nextofkin set names =:b,relationship =:c, phoneno =:d where regno =:a"); $stmt->bindparam(":a",$reg); $stmt->bindparam(":b",$name); $stmt->bindparam(":c",$relation); $stmt->bindparam(":d",$nphone); //$stmt->bindparam(":e",$admin); //$stmt->bindparam(":f",$td); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } // airways methods public function airways_location($regno,$mlocation,$zone,$cstatus,$csize,$storeyno,$purpose,$rdate) { try { $stmt = $this->conn->prepare("INSERT INTO airway_loation(regno,market_location,zone,complex_status,complex_size,storey_no,purpose,rdate) VALUES(:a,:b,:c,:d,:e,:f,:g,:h)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$mlocation); $stmt->bindparam(":c",$zone); $stmt->bindparam(":d",$cstatus); $stmt->bindparam(":e",$csize); $stmt->bindparam(":f",$storeyno); $stmt->bindparam(":g",$purpose); $stmt->bindparam(":h",$rdate); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function airways_owner($regno,$names,$gender,$stateo,$tdescrip,$idmeans,$resaddress,$mobile,$emailad,$idno) { try { $stmt = $this->conn->prepare("INSERT INTO airways_owner_details(regno,names,gender,state_origin,trade_description,idmeans,res_address,mobile_no,email_address,id_number) VALUES(:a,:b,:c,:d,:e,:f,:g,:h,:i,:j)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$names); $stmt->bindparam(":c",$gender); $stmt->bindparam(":d",$stateo); $stmt->bindparam(":e",$tdescrip); $stmt->bindparam(":f",$idmeans); $stmt->bindparam(":g",$resaddress); $stmt->bindparam(":h",$mobile); $stmt->bindparam(":i",$emailad); $stmt->bindparam(":j",$idno); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function airways_gurantor($regno,$names,$address,$phone) { try { $stmt = $this->conn->prepare("INSERT INTO airway_guarantor(regno,names,address,phone_no) VALUES(:a,:b,:c,:d)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$names); $stmt->bindparam(":c",$address); $stmt->bindparam(":d",$phone); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function airways_doc($regno,$doc_title,$filename) { try { $stmt = $this->conn->prepare("INSERT INTO airways_documents(regno,document_title,file_name) VALUES(:a,:b,:c,:d)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$doc_title); $stmt->bindparam(":c",$filename); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function construction_approval($regno,$virgin_space,$conversion,$av_plan,$ap_agency,$sp_agency) { try { $stmt = $this->conn->prepare("INSERT INTO construction_approval(regno,virgin_space,conversion,av_plan,approving_agency,supervisory_agency) VALUES(:a,:b,:c,:d,:e,:f)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$virgin_space); $stmt->bindparam(":c",$conversion); $stmt->bindparam(":d",$av_plan); $stmt->bindparam(":e",$ap_agency); $stmt->bindparam(":f",$sp_agency); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function contractor_details($regno,$names,$address,$phone,$yrexp,$coren_reg,$app_source,$cdate) { try { $stmt = $this->conn->prepare("INSERT INTO contractor_details(regno,names,address,phone_no,yr_experience,coren_reg,approval_source,construction_date) VALUES(:a,:b,:c,:d,:e,:f,:g,:h)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$names); $stmt->bindparam(":c",$address); $stmt->bindparam(":d",$phone); $stmt->bindparam(":e",$yrexp); $stmt->bindparam(":f",$coren_reg); $stmt->bindparam(":g",$app_source); $stmt->bindparam(":h",$cdate); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } //end of air ways method public function tax($user,$yr,$val) { try { $stmt = $this->conn->prepare("INSERT INTO taxation(user_id,year,value) VALUES(:fn,:ln,:cm)"); $stmt->bindparam(":fn",$user); $stmt->bindparam(":ln",$yr); $stmt->bindparam(":cm",$val); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function monitor($activities) { try { //$at = date("Y-m-d","h:i:sa") ; $stmt = $this->conn->prepare("INSERT INTO monitor(activities) VALUES(:fn)"); $stmt->bindparam(":fn",$activities); //$stmt->bindparam(":at",$at); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function add_cat($catname) { try { //$at = date("Y-m-d","h:i:sa") ; $stmt = $this->conn->prepare("INSERT INTO expcategory(category) VALUES(:fn)"); $stmt->bindparam(":fn",$catname); //$stmt->bindparam(":at",$at); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function add_stream($catname) { try { //$at = date("Y-m-d","h:i:sa") ; $stmt = $this->conn->prepare("INSERT INTO income_stream(streams) VALUES(:fn)"); $stmt->bindparam(":fn",$catname); //$stmt->bindparam(":at",$at); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function updateadmin($usa,$level,$sno) { try { $stmt = $this->conn->prepare("update admin set LEVEL = :lv, USERNAME = :us where SN =:sno"); $stmt->bindparam(":lv",$level); $stmt->bindparam(":sno",$sno); $stmt->bindparam(":us",$usa); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function changepassword($user,$pwd) { try { $rp = md5($pwd) ; $stmt = $this->conn->prepare("update stalldata set pwd = :pd where user_id =:u"); $stmt->bindparam(":pd",$rp); $stmt->bindparam(":u",$user); //$stmt->bindparam(":us",$usa); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function updatemarket($mark,$cat,$coden,$sno) { try { $stmt = $this->conn->prepare("update markets set NAMES = :lv,category=:cat, codename =:c where SN =:sno"); $stmt->bindparam(":lv",$mark); $stmt->bindparam(":cat",$cat); $stmt->bindparam(":c",$coden); $stmt->bindparam(":sno",$sno); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function create($user,$pwd,$mail,$level,$code) { try { $password = md5($pwd); $stmt = $this->conn->prepare("INSERT INTO admin(USERNAME,PASSWORD,EMAILS,LEVEL,tokenCode) VALUES(:un,:pw,:mls,:lev,:cd)"); $stmt->bindparam(":un",$user); $stmt->bindparam(":pw",$password); $stmt->bindparam(":mls",$mail); $stmt->bindparam(":lev",$level); $stmt->bindparam(":cd",$code); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function inserttrans($mails,$unik,$reff,$purpose,$amount) { try { $pdate = date('Y-m-d') ; $stmt = $this->conn->prepare("INSERT INTO transacts(emails,uniqueid,trans_reff,payment_purpose,pdate,amount) VALUES(:a,:b,:c,:d,:e,:f)"); $stmt->bindparam(":a",$mails); $stmt->bindparam(":b",$unik); $stmt->bindparam(":c",$reff); $stmt->bindparam(":d",$purpose); $stmt->bindparam(":e",$pdate); $stmt->bindparam(":f",$amount); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function addreceipt($rno,$rname,$eno,$shopno,$rdate,$amt,$stream,$infos,$staff) { try { $stmt = $this->conn->prepare("INSERT INTO receipts(receipt_no,names,eno,shopno,rdate,amount,streams,infos,staff) VALUES(:a,:b,:en,:sh,:c,:d,:e,:in,:f)"); $stmt->bindparam(":a",$rno); $stmt->bindparam(":b",$rname); $stmt->bindparam(":en",$eno); $stmt->bindparam(":sh",$shopno); $stmt->bindparam(":c",$rdate); $stmt->bindparam(":d",$amt); $stmt->bindparam(":e",$stream); $stmt->bindparam(":in",$infos); $stmt->bindparam(":f",$staff); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function addexpensis($cat,$amt,$adate,$purpose,$staff,$admin) { try { $stmt = $this->conn->prepare("INSERT INTO expensis(category,amount,purpose,edate,user,admin) VALUES(:a,:b,:c,:d,:u,:e)"); $stmt->bindparam(":a",$cat); $stmt->bindparam(":b",$amt); $stmt->bindparam(":c",$purpose); $stmt->bindparam(":d",$adate); $stmt->bindparam(":u",$staff); $stmt->bindparam(":e",$admin); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function addincome($cat,$amt,$adate,$purpose,$admin) { try { $tdate = date("Y-m-d") ; $stmt = $this->conn->prepare("INSERT INTO income(category,amount,idate,infos,iupdate,staff) VALUES(:a,:b,:c,:d,:e,:f)"); $stmt->bindparam(":a",$cat); $stmt->bindparam(":b",$amt); $stmt->bindparam(":c",$adate); $stmt->bindparam(":d",$purpose); $stmt->bindparam(":e",$tdate); $stmt->bindparam(":f",$admin); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function registermarket($lga,$cat,$names, $coden,$img) { try { $stmt = $this->conn->prepare("INSERT INTO markets(lga,category,NAMES,codename,images) VALUES(:lg,:un,:ct,:cd,:img)"); $stmt->bindparam(":un",$cat); $stmt->bindparam(":ct",$names); $stmt->bindparam(":lg",$lga); $stmt->bindparam(":img",$img); $stmt->bindparam(":cd",$coden); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function sumitdocument($regno,$dname,$img) { try { $stmt = $this->conn->prepare("INSERT INTO documents(regno,doc_name,image) VALUES(:a,:b,:c)"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$dname); $stmt->bindparam(":c",$img); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function updatedocument($regno,$dname,$img) { try { $stmt = $this->conn->prepare("UPDATE documents set doc_name =:b, image =:c where regno =:a"); $stmt->bindparam(":a",$regno); $stmt->bindparam(":b",$dname); $stmt->bindparam(":c",$img); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function marketsection($names,$sec) { try { $stmt = $this->conn->prepare("INSERT INTO marketsection(market,section) VALUES(:un,:ct)"); $stmt->bindparam(":un",$names); $stmt->bindparam(":ct",$sec); //$stmt->bindparam(":lg",$lga); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function neworder($orderno,$item,$desc,$quant,$origin,$dest) { try { $tdate = date("Y/m/d") ; $sdate = date("l") ; $ldate = $sdate.'--'.$tdate ; $sts = 'NOT DELIVERD YET' ; $cl = 'OFFICE' ; $ttm = date("h:i"); $stmt = $this->conn->prepare("INSERT INTO trans(longsdate,transdate,order_no,items,descripts,quantity,origin,destination,curent_location,status,transtime) VALUES(:lt,:td,:odn,:itm,:ds,:qun,:org,:dst,:cln,:stu,:tt)"); $stmt->bindparam(":lt",$ldate); $stmt->bindparam(":td",$tdate); $stmt->bindparam(":odn",$orderno); $stmt->bindparam(":itm",$item); $stmt->bindparam(":ds",$desc); $stmt->bindparam(":qun",$quant); $stmt->bindparam(":org",$origin); $stmt->bindparam(":dst",$dest); $stmt->bindparam(":cln",$cl); $stmt->bindparam(":stu",$sts); $stmt->bindparam(":tt",$ttm); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function onlinereg($names,$emails,$phone,$pwd) { try { $tdate = date("Y-m-d") ; $stat = 'nill' ; $stmt = $this->conn->prepare("INSERT INTO onlinereg(names,emails,mobile,password,regdate,payment_status) VALUES(:a,:b,:c,:d,:e,:f)"); $stmt->bindparam(":a",$names); $stmt->bindparam(":b",$emails); $stmt->bindparam(":c",$phone); $stmt->bindparam(":d",$pwd); $stmt->bindparam(":e",$tdate); $stmt->bindparam(":f",$stat); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function create_blog($fnames,$gend,$uname,$email,$upass,$code,$phone) { try { $password = md5($upass); $stmt = $this->conn->prepare("INSERT INTO pblog(fname,gender,userName,userEmail,userPass,tokenCode,phone) VALUES(:fn,:gen,:user_name, :user_mail, :user_pass, :active_code,:ph)"); $stmt->bindparam(":fn",$fnames); $stmt->bindparam(":gen",$gend); $stmt->bindparam(":user_name",$uname); $stmt->bindparam(":user_mail",$email); $stmt->bindparam(":user_pass",$password); $stmt->bindparam(":active_code",$code); $stmt->bindparam(":ph",$phone); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function loginact($email,$upass) { try { $stmt = $this->conn->prepare("SELECT * FROM pblog WHERE userEmail=:email_id"); $stmt->execute(array(":email_id"=>$email)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); if($stmt->rowCount() == 1) { //if($userRow['userStatus']=="Y") //{ if($userRow['userPass']==md5($upass)) { $_SESSION['userSession'] = $userRow['userName']; //$_SESSION['usermail'] = $userRow['userEmail']; $_SESSION['userID'] = $userRow['userID']; $_SESSION['loggedin'] = true; return true; } else { header("Location: account.php?error"); exit; } //} //else //{ //header("Location: acount.php?inactive"); //exit; //} } else { header("Location: account.php?error"); exit; } } catch(PDOException $ex) { echo $ex->getMessage(); } } public function login($user,$upass) { try { $stmt = $this->conn->prepare("SELECT * FROM stalldata WHERE user_id =:user"); $stmt->execute(array(":user"=>$user)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); if($stmt->rowCount() == 1) { if($userRow['pwd']==md5($upass)) { //$_SESSION['userSession'] = $userRow['cemail']; $_SESSION['username'] = $userRow['user_id']; return true; } else { header("Location: login.php?errorp"); exit; } } else { header("Location: login.php?errore"); exit; } } catch(PDOException $ex) { echo $ex->getMessage(); } } public function loginreg($user,$upass) { try { $stmt = $this->conn->prepare("SELECT * FROM onlinereg WHERE emails =:e"); $stmt->execute(array(":e"=>$user)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); if($stmt->rowCount() == 1) { if($userRow['password']==md5($upass)) { $_SESSION['cname'] = $userRow['names']; $_SESSION['cemail'] = $userRow['emails']; return true; } else { header("Location: signin.php?errorp"); exit; } } else { header("Location: signin.php?errore"); exit; } } catch(PDOException $ex) { echo $ex->getMessage(); } } public function loginadmin($user,$upass) { try { $stmt = $this->conn->prepare("SELECT * FROM admin WHERE USERNAME =:email_id"); $stmt->execute(array(":email_id"=>$user)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); if($stmt->rowCount() == 1) { if($userRow['PASSWORD']==md5($upass)) { $_SESSION['userSession'] = $userRow['USERNAME']; $_SESSION['username'] = $userRow['USERNAME']; $_SESSION['lv'] = $userRow['LEVEL']; return true; } else { header("Location: ../admin/login?errorp"); exit; } } else { header("Location: ../admin/login?errore"); exit; } } catch(PDOException $ex) { echo $ex->getMessage(); } } public function is_logged_in() { if(isset($_SESSION['userSession'])) { return true; } } public function redirect($url) { header("Location: $url"); } public function logout() { session_destroy(); $_SESSION['userSession'] = false; } function send_mail($email,$message,$subject) { require_once('mailer/class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 0; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "titano.protonhosting.com"; $mail->Port = 465; $mail->AddAddress($email); $mail->Username="info@ansmaportal.com"; $mail->Password="ansma@2020"; $mail->SetFrom('info@ansmaportal.com','MARKET_DEVELOPEMENT'); $mail->AddReplyTo("info@ansmaportal.com","MARKET_DEVELOPEMENT"); $mail->Subject = $subject; $mail->MsgHTML($message); $mail->Send(); } }