Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- @author : Shubham Maurya,
- Email id : maurya.shubham5@gmail.com
- **/
- make a file in notepad and save it as class.User.php and paste the below code.
- <?php
- /**
- *
- */
- class USER
- {
- private $db;
- //Constructor
- function __construct($DBcon)
- {
- $this->db=$DBcon;
- }
- //Signup
- public function signup($email,$code)
- {
- try {
- $stmt=$this->db->prepare("INSERT into users(email,joindate,token_Code) VALUES(:email, CURRENT_TIMESTAMP , :code )");
- if($stmt->execute(array(':email'=>$email ,':code'=>$code)))
- {
- return $stmt;
- }
- } catch (PDOException $e)
- {
- echo $e->getMessage();
- }
- }
- //Redirect
- public function redirect($url)
- {
- header("Location: $url");
- exit();
- }
- //Send Mail
- function send_mail($email,$message,$subject)
- {
- require_once('mailer/class.phpmailer.php');
- $mail = new PHPMailer();
- $mail->IsSMTP(); //Remove if mail is not sending..
- $mail->SMTPDebug = 0;
- $mail->SMTPAuth= true;
- $mail->SMTPSecure="ssl";
- $mail->Host="smtp.gmail.com";
- $mail->Port=465;
- $mail->AddAddress($email);
- $mail->Username="maurya.shubham5@gmail.com";
- $mail->Password="Submitted11@";
- $mail->SetFrom('maurya.shubham5@gmail.com');
- $mail->Subject = $subject;
- $mail->MsgHTML($message);
- $mail->Send();
- return true;
- }
- //Get Last Inserted Id
- public function lastID()
- {
- $stmt = $this->db->lastInsertId();
- return $stmt;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement