Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. <?php
  2. require_once "dbconf.php";
  3.  
  4. class BENUTZER
  5. {
  6.  
  7. private $conn;
  8.  
  9. public function__construct()
  10. {
  11. $database = new Database();
  12. $db = $database->dbConnection();
  13. $this->$conn = $db;
  14. }
  15.  
  16. public function query($sql)
  17. {
  18. $stmt = $this->$conn->prepare($sql);
  19. return $stmt;
  20. }
  21.  
  22. public function lastID()
  23. {
  24. $stmt = $this->$conn->lastInsertID();
  25. return $stmt;
  26. }
  27.  
  28. public function register($userEmail, $userName, $userNachname, $userWebSubdomain, $userPasswort, $verifyCode)
  29. {
  30. try
  31. {
  32. $passwort = md5($userPasswort);
  33. $stmt = $this->$conn->prepare("INSERT INTO userRegister
  34. (userEmail, userName, userNachname, userWebSubdomain, userPasswort, verifyCode)
  35. VALUES
  36. (:userEmail, :userName, :userNachname, :userWebSubdomain, :userPasswort, :verifyCode)");
  37.  
  38. $stmt->bindparam(":userEmail", $userEmail);
  39. $stmt->bindparam(":userName", $userName);
  40. $stmt->bindparam(":userNachname", $userNachname);
  41. $stmt->bindparam(":userWebSubdomain", $userWebSubdomain);
  42. $stmt->bindparam(":userPasswort", $userPasswort);
  43. $stmt->bindparam(":verifyCode", $verifyCode);
  44. }
  45. catch(PDOException $ex)
  46. {
  47. echo $ex->getMessage();
  48. }
  49. }
  50.  
  51. public function anmelden($userEmail, $userPasswort)
  52. {
  53. try
  54. {
  55. $stmt = $this->$conn->prepare("SELECT * FROM userRegister WHERE userEmail = :email");
  56. $stmt->execute(array(":email"=>$userEmail));
  57. $userRow=$stmt->fetch(PDO::FETCH_ASSOC);
  58.  
  59. if($stmt->rowcount() == 1)
  60. {
  61. if ($userRow["userStatus"] == "Y")
  62. {
  63. if ($userRow["userPasswort"] == md5($userPasswort)) {
  64. $_SESSION["userSession"] == $userRow["userID"];
  65. return true;
  66. }
  67. else{
  68. header("Location: index.php?fehler");
  69. exit;
  70. }
  71. }
  72. else
  73. {
  74. header("Location: index.php?nicht_aktiv");
  75. exit;
  76. }
  77. }
  78. else
  79. {
  80. header("Location: index.php?fehler");
  81. exit;
  82. }
  83. }
  84. catch(PDOException $ex)
  85. {
  86. echo $ex->getMessage();
  87. }
  88. }
  89.  
  90. public function ist_angemeldet()
  91. {
  92. if(issets($_SESSION["userSession"])){
  93. return true;
  94. }
  95. }
  96.  
  97. public function umleiten($url)
  98. {
  99. header("Location: $url");
  100. }
  101.  
  102. public function abmelden()
  103. {
  104. session_destroy();
  105. $_SESSION["userSession"] = false;
  106. }
  107.  
  108. public function send_server_email($email, $nachricht, $grund)
  109. {
  110. require '../mailer/PHPMailerAutoload.php';
  111.  
  112. /*$mail = new PHPMailer();
  113. $mail->IsSMTP();
  114. $mail->SMTPDebug = 0;
  115. $mail->SMTPAuth = true;
  116. $mail->SMTPSecure = "ssl";
  117. $mail->Host = "smtp.gmail.com";
  118. $mail->Port = 465;
  119. $mail->AddAddress($email);
  120. $mail->Username="yourgmailid@gmail.com";
  121. $mail->Password="yourgmailpassword";
  122. $mail->SetFrom('you@yourdomain.com','Coding Cage');
  123. $mail->AddReplyTo("you@yourdomain.com","Coding Cage");
  124. $mail->Subject = $subject;
  125. $mail->MsgHTML($message);
  126. $mail->Send();
  127. */
  128.  
  129. $mail = new PHPMailer;
  130.  
  131. $mail->From = "testphpjohn@gmail.com";
  132. $mail->FromName = "Testphp";
  133.  
  134. //To address and name
  135. $mail->addAddress($email, "Aktivieren");
  136. $mail->addAddress("recepient1@example.com"); //Recipient name is optional
  137.  
  138. //Address to which recipient will reply
  139. $mail->addReplyTo("testphpjohn@gmail.com", "John Okken");
  140.  
  141. //CC and BCC
  142. $mail->addCC("cc@example.com");
  143. $mail->addBCC("bcc@example.com");
  144.  
  145. //Send HTML or Plain Text email
  146. $mail->isHTML(true);
  147. $mail->Subject = $subject;
  148. $mail->MsgHTML($message);
  149. $mail->Send();
  150. }
  151. }
  152. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement