芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/starckex.com/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,$location) { try { $stmt = $this->conn->prepare("INSERT INTO tbl_stk_riders_info(first_name,last_name,email,phone,location) VALUES(:first_name,:last_name,:email, :phone,:location)"); $stmt->bindparam(":first_name",$fname); $stmt->bindparam(":last_name",$lname); $stmt->bindparam(":email",$email); $stmt->bindparam(":phone",$phone); $stmt->bindparam(":location",$location); $stmt->execute(); return $stmt; } catch(PDOException $ex) { echo $ex->getMessage(); } } public function contact($fname,$lname,$email,$subject,$msg) { try { $stmt = $this->conn->prepare("INSERT INTO sys_gte_tbl_contact(fname,lname,user_email,subject,msg) VALUES(:fname,:lname,:user_email,:user_sub, :msg)"); $stmt->bindparam(":fname",$fname); $stmt->bindparam(":lname",$lname); $stmt->bindparam(":user_email",$email); $stmt->bindparam(":user_sub",$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($email,$message,$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: careers@starckex.com' . "\r\n"; mail($email,$subject,$message,$headers); } }