芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/melangeprc.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 contact($fname,$sname,$phone,$email,$name_organization,$about,$timeline,$budget) { try { //$password = md5($upass); $stmt = $this->conn->prepare("INSERT INTO tbl_melange_lw(fname,sname,phone,email,name_organization,about,timeline,budget) VALUES(:fname,:sname,:phone,:email,:name_organization,:about,:timeline,:budget,)"); $stmt->bindparam(":fname",$fname); $stmt->bindparam(":sname",$sname); $stmt->bindparam(":phone",$phone); $stmt->bindparam(":email",$email); $stmt->bindparam(":name_organization",$name_organization); $stmt->bindparam(":about",$about); $stmt->bindparam(":timeline",$timeline); $stmt->bindparam(":budget",$budget); $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: info@melangeprc.com.com' . "\r\n"; mail($email,$subject,$message,$headers); } }