芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/account/class.user.php
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 register($fname,$lname,$email,$phone,$company_name,$business_category) { try { $stmt = $this->conn->prepare("INSERT INTO tbl_gte_tw(first_name,last_name,email,phone,company_name,business_category) VALUES(:first_name,:last_name,:email, :phone,:company_name,:business_category)"); $stmt->bindparam(":first_name",$fname); $stmt->bindparam(":last_name",$lname); $stmt->bindparam(":email",$email); $stmt->bindparam(":phone",$phone); $stmt->bindparam(":company_name",$company_name); $stmt->bindparam(":business_category",$business_category); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function contact($fname,$phone_number,$user_email,$subject,$msg) { try { $stmt = $this->conn->prepare("INSERT INTO sys_scg_tbl_contact(fname,phone_number,user_email,subject,msg) VALUES(:fname,:phone_number,:user_email,:subject, :msg)"); $stmt->bindparam(":fname",$fname); $stmt->bindparam(":phone_number",$phone_number); $stmt->bindparam(":user_email",$user_email); $stmt->bindparam(":subject",$subject); $stmt->bindparam(":msg",$msg); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function login($email,$upass) { try { $stmt = $this->conn->prepare("SELECT * FROM tbl_users WHERE email=:email_id"); $stmt->execute(array(":email_id"=>$email)); $userRow=$stmt->fetch(PDO::FETCH_ASSOC); if($stmt->rowCount() == 1) { if($userRow['userStatus']=="Y") { if($userRow['pass']==md5($upass)) { $_SESSION['userSession'] = $userRow['id']; return true; } else { header("Location: index.php?error"); exit; } } else { header("Location: index.php?inactive"); exit; } } else { header("Location: index.php?error"); 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($user_email,$msg,$subject) { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From:
' . "\r\n"; $headers .= 'bcc: kennethoben@gmail.com' . "\r\n"; $headers .= 'bcc: info@signconsultinggroup.com' . "\r\n"; mail($user_email,$subject,$msg,$headers); } }