public function submitreplyAction() { if ($this->request->isPost()) { $replymessage = $this->request->getPost('replymessage'); $message = $this->request->getPost('message'); $email = $this->request->getPost('email'); $name = $this->request->getPost('name'); $reason = $this->request->getPost('reason'); $coid = $this->request->getPost('coaid'); $msg = array("html" => "Hello " . $name . ",</br>This is in response to your " . $reason . " on our Resturant. </br> <br> <br>Your Message: <i>" . $message . "</i><br><br>" . $replymessage . "<br> Thank you. <br> Please write back to us if you have further queries. We will be happy to help. <br> <br> If you are recieving this message by mistake, please ignore.", "subject" => "Ticket: " . $coid . " : Resturant Query", "toemail" => $email, "fromemail" => "*****@*****.**", "fromname" => "Resturant", "trackopen" => true); $mandrill = new MandrillController(); $mandrill->sendAction($msg); $con = Contact::findFirst("co_id = '{$coid}'"); $con->co_status = 1; $con->save(); $this->response->redirect('cmessages'); } }
public function indexAction() { //Function to generate a random string to be used as salt. function genUniqueReset($length = 8) { // given a string length, returns a random password of that length $UniqueReset = ""; // define possible characters $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible) - 1), 1); // we don't want this character if it's already in the password if (!strstr($UniqueReset, $char)) { $UniqueReset .= $char; $i++; } } return $UniqueReset; } if ($this->request->isPost()) { //Get all posted values from form. $email = $this->request->getPost('email'); $user = Userdetails::findFirst(array("(u_email = :email:)", 'bind' => array('email' => $email))); if ($user == false) { } else { $user->u_reset = genUniqueReset(50); $user->save(); $msg = array("html" => "Hi " . $user->u_fname . ",</br>Please click here to reset your password: </br> <a href='http://localhost/rms/forgotpassword/set/" . $user->u_id . "/" . $user->u_reset . "'>Continue</a><br> Else please copy paste this link on your browser's URL bar: <br> <a href='http://localhost/rms/forgotpassword/set/" . $user->u_id . "/" . $user->u_reset . "'>http://localhost/rms/signup/confirm/" . $user->u_id . "/" . $user->u_reset . "</a><br> Thank you.", "subject" => "Resturant:Forgot Password email", "toemail" => $email, "fromemail" => "*****@*****.**", "fromname" => "Resturant", "trackopen" => true); $mandrill = new MandrillController(); $mandrill->sendAction($msg); } return $this->response->redirect("login"); } }
public function indexAction() { //Function to generate a random string to be used as salt. function genUniqueReset($length = 8) { // given a string length, returns a random password of that length $UniqueReset = ""; // define possible characters $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible) - 1), 1); // we don't want this character if it's already in the password if (!strstr($UniqueReset, $char)) { $UniqueReset .= $char; $i++; } } return $UniqueReset; } //If the form is posted to this action then it runs. if ($this->request->isPost()) { //Get all posted values from form. $fname = $this->request->getPost('fname'); $lname = $this->request->getPost('lname'); $email = $this->request->getPost('email'); $phno = $this->request->getPost('phno'); $pass = $this->request->getPost('pass'); $cpass = $this->request->getPost('cpass'); //check if a user exists with this email address. $user = Userdetails::findFirst(array("(u_email = :email:)", 'bind' => array('email' => $email))); if ($user == false) { //check if passwords and confirm passwords match. if ($pass == $cpass) { //Set salt and generate password combining user password and salt. $salt = genUniqueReset(16); $password = sha1($pass . $salt); //Create row in database by invoking corresponding Model Class. Set all required coloumn values accordingly. $user = new Userdetails(); $user->u_fname = $fname; $user->u_lname = $lname; $user->u_email = $email; $user->u_pass = $password; $user->u_salt = $salt; $user->u_phno = $phno; $user->u_reset = genUniqueReset(50); //Save the row in the database. if ($user->save() == 0) { foreach ($user->getMessages() as $message) { echo $message; } } else { //user successfully registered. Send confirmation email and ask him to login. $msg = array("html" => "Hi " . $fname . ",</br>Welcome To Resturant. Please confirm your email by clicking on this link: </br> <a href='http://localhost/rms/signup/confirm/" . $user->u_id . "/" . $user->u_reset . "'>Continue</a><br> Else please copy paste this link on your browser's URL bar: <br> <a href='http://localhost/rms/signup/confirm/" . $user->u_id . "/" . $user->u_reset . "'>http://localhost/rms/signup/confirm/" . $user->u_id . "/" . $user->u_reset . "</a><br> Thank you.", "subject" => "Resturant:Confirmation email", "toemail" => $email, "fromemail" => "*****@*****.**", "fromname" => "Chirag Resturant", "trackopen" => true); //echo "hello"; $mandrill = new MandrillController(); $mandrill->sendAction($msg); //echo "chillo"; } } else { //show error that passwords do not match } } else { //show error that email id is already registered. } } }